zhang chi wrote:
> I write three line porgram as following:
> rt = r.read_table("exam0203.txt", header=1)
> lm_sol = r.lm("Weight ~ Height", data = rt)
> r.summary(lm_sol)
> 
> the first line is to read a file
> the second line is to make a linear regression
> the third line is to display the content of variate lm_sol
> 
> but there is nothing to display.   why?????

  Try each line one at a time in the Python console and you might see 
something. I see this:


  >>> lm_sol = r.lm("Weight ~ Height", data = rt)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
rpy.RException: Error in terms.default(formula, data = data) :
         no terms component


  - so its the lm that is failing and not the summary.

  You need to make your formula into a formula, because otherwise R 
thinks it's a character string. Just wrap it in a r() call:

  >>> lm_sol = r.lm(r("Weight ~ Height"), data = rt)

  You're eventually going to have to play with the conversion mode too, 
just read this handy guide to doing regressions in Rpy:

http://www2.warwick.ac.uk/fac/sci/moac/currentstudents/peter_cock/python/lin_reg/

Barry

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to