[R] APE: compar.gee( )

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Feb 8 19:15:11 CET 2004

```juli g. pausas wrote:

> Dear all,
> I don't understand the following behaviour: Running  compar.gee   (in
> library ape ) with and without the option 'data', it give me different
> results
> Example:
>
> .... Start R ....
>
>> ls()
>
> [1] "gee.na" "mydata" "mytree"
>
>> library(ape) # runnig with the option data= mydata
>> compar.gee(alt ~ R, family="gaussian", data=mydata, phy=mytree)
>
> geeformula.q 4.13 98/01/27"
> [1] "running glm to get initial regression estimate"
> [1] 7.9500000 0.5155172
>
> Call:
>  formula: alt ~ R
>
> Number of observations:  37
> Model:
> Link:                      identity Variance to Mean Relation: gaussian
> Summary of Residuals:
>        Min          1Q      Median          3Q         Max -12.1267954
> -9.4267954  -7.4267954  -0.4267954  20.7903982
>
> Coefficients:
>            Estimate     S.E.        t Pr(T > |t|)
> (Intercept) 9.209602 4.760274 1.934679  0.08798892
> R1          3.217194 2.548273 1.262500  0.24130121
>
> Estimated Scale Parameter:  86.39367
> "Phylogenetic" df (dfP):  10.24615
>
>> # Second way, without the option data (so attaching the dataframe)
>> attach(mydata)
>> compar.gee(alt ~ R, family="gaussian", phy=mytree)
>
> [1] "Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27"
> [1] "running glm to get initial regression estimate"
> [1] 7.9500000 0.5155172
>
> Call:
>  formula: alt ~ R
>
> Number of observations:  37
> Model:
> Link:                      identity Variance to Mean Relation: gaussian
> Summary of Residuals:
>       Min         1Q     Median         3Q        Max -14.123399
> -11.423399  -8.856398  -1.856398  20.143602
>
> Coefficients:
>            Estimate     S.E.        t Pr(T > |t|)
> (Intercept) 9.856398 5.137029 1.918696  0.09020828
> R1          4.567001 2.351966 1.941781  0.08701965
>
> Estimated Scale Parameter:  103.2713
> "Phylogenetic" df (dfP):  10.24615
>
>> search()
>
> [1] ".GlobalEnv"      "mydata"          "package:gee"
> "package:ape"    [5] "package:methods" "package:ctest"
> "package:mva"     "package:modreg" [9] "package:nls"
>
>>
>
> (R 1.8.1 for Windows
> ape 1.2)

>
>
> Note that the results are different.
> Am I doing something wrong? Which is the correct answer?
> Thanks for any help

I guess that one with the data argument:
Are you sure there is no object called "alt" or "R" in your workspace
before attaching the data frame (it will mask the attached object)?

You might want to check that:
identical(R, mydata\$R)
identical(alt, mydata\$alt)

If those objects are identical, you might want to ask the maintainer of

Uwe Ligges

> Juli
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help