Hi Etienne,

>
> I imagine that the fact that the fact that av will be a true R object
> will help the summary() function to find the good method summary.aov 
> ().

Not only do you need to have R call the correct R fucntion, it must  
have a correct R object.  When the conversion R-->Python happens,  
some information is lost, so the av object itself isn't a valid aov R  
object when Python--R conversion happens.

-G



> However, I tried to call explicitly summary_aov() with no success.
> But I have to test it before to go further.
> Thanks again !!
> -Etienne
>
>
> Gregory Warnes a écrit :
>>
>> Hi Etienne,
>>
>> The basic problem is that under the default conversion mode
>> (BASIC_CONVERSION) all R objects are converted to roughly-equivalent
>> python structures.  As a consequence, the object 'av' isn't actually
>> an R object, so r.summary(av) won't treat it as such.  The simplest
>> solution is to change the conversion mode to NO_CONVERSION adn then
>> explicitly request conversion of an object when you need the python
>> version. IE:
>>
>>> set_default_mode(NO_CONVERSION)
>>> v = r.aov(r.formula("score~factor+Error(id_subject/factor)"),
>>> data=Res)set_default_mode(BASIC_CONVERSION)
>>> set_default_mode(BASIC_CONVERSION)
>>> r.summary(av)
>>
>> -G
>>
>> On Dec 18, 2007, at 1:52PM , Etienne Gaudrain wrote:
>>
>>> Hi everyone,
>>>
>>> I'm new to RPy, and I came to this terrific module as I was used to
>>> make some of my analyses in R, and I came to Python in  
>>> replacement of
>>> Matlab. Formerly, I manipulated data with Matlab, put it in a MySQL
>>> database, and made my stats in R via ODBC. I'm now thinking about
>>> jumping one step by calling R directly from Python with RPy.
>>>
>>> The analysis I almost always have to do is a repeated measure ANOVA.
>>> The way I do this in R is :
>>>
>>>
>>> # /after odbc connection and sql query, Res contains my data
>>> /
>>> library('stats')
>>> av <- aov( score~factor+Error(id_subject/factor), data=Res)
>>> summary(av)
>>>
>>>
>>> Now I tried the same in RPy :
>>>
>>>
>>> # /retrieve data from sql query, Res is a dictionnary
>>> /
>>> r.library('stats')
>>> av = r.aov("score~factor+Error(id_subject/factor)", data=Res)
>>>
>>>
>>> This fails saying that "Error" isn't defined in the dataframe...
>>> After reading some R doc about GLM, I found that using the R  
>>> function
>>> formula() seemed to solve this problem:
>>>
>>> av = r.aov(r.formula("score~factor+Error(id_subject/factor)"),  
>>> data=Res)
>>> r.summary(av)
>>>
>>> However, a new problem rose in r.summary(). This function returns
>>> something that isn't readable, and that does not contain the p
>>> values, or anything similar. It seems that the r.summary_aov()
>>> function might be adequat, but this function returns an Error saying
>>> that there is a NaN somewhere...
>>>
>>> Does anybody have an advice on how to perform the repeated  
>>> measure ANOVA?
>>> Thanks!
>>> -Etienne
>>>
>>>
>>> PS : I use Windows XP, Python 2.5.1, Numpy 1.0.3.1 and RPy
>>> 1.0.1-Numpy-py2.5 and R 2.6.1.
>>>
>>> -------------------------------------------------------------------- 
>>> -----
>>> SF.Net email is sponsored by:
>>> 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<mime-attachment.txt>
>>
>> --------------------------------------------------------------------- 
>> ---
>>
>> --------------------------------------------------------------------- 
>> ----
>> SF.Net email is sponsored by:
>> 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
>>
>
>
> ---------------------------------------------------------------------- 
> ---
> SF.Net email is sponsored by:
> 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


-------------------------------------------------------------------------
SF.Net email is sponsored by:
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