Dear Emmanuel,

thank you for this. Unfortunately we get the following very cryptic error 
message when running "predict(mod,df)": "Error in match.arg(type) : 'arg' must 
be NULL or a character vector". Please see code and output below.

We can't work out what this error message is supposed to mean. We tried 
redefining both variables as numbers (sex = 0/1, poll = 0/1) and redefining 
them as characters using as.character, but to no avail. 

We'd be grateful for suggestions.

Many thanks,

Nina Hobbhahn and Megan Welsford



> DF.MegsSort<-DF.Megs[phy17[[1]]$tip.label, ]
> mod<-compar.gee(FHsize~poll*sex, phy=phy17[[1]], data=DF.MegsSort, 
> family=gaussian)

Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
running glm to get initial regression estimate
(Intercept)       pollW        sexM  pollW:sexM 
  265.31404   -30.81771   -29.03028  -134.19117 
Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
running glm to get initial regression estimate
(Intercept)       pollW        sexM  pollW:sexM 
  265.31404   -30.81771   -29.03028  -134.19117 

> mod

Call: compar.gee(formula = FHsize ~ poll * sex, data = DF.MegsSort, 
    family = gaussian, phy = phy17[[1]])
Number of observations:  34 
Model:
                      Link: identity 
 Variance to Mean Relation: gaussian 

QIC: 1920817 

Summary of Residuals:
        Min          1Q      Median          3Q         Max 
-210.193547 -138.663156 -119.285868    4.672248  736.012732 


Coefficients:
              Estimate         S.E.             t Pr(T > |t|)
(Intercept)  244.51760 1.256536e+02  1.945966e+00   0.1285677
pollW         54.77936 5.384660e+01  1.017323e+00   0.3703143
sexM         -29.03269 8.148837e-05 -3.562802e+05   0.0000000
pollW:sexM  -134.18408 1.502553e-04 -8.930409e+05   0.0000000

Estimated Scale Parameter:  64026.63
"Phylogenetic" df (dfP):  7.734134 

> df<-expand.grid(poll=levels(DF.MegsSort$poll), sex=levels(DF.MegsSort$sex))
> df

  poll sex
1    I   F
2    W   F
3    I   M
4    W   M

> predict(mod,df)
Error in match.arg(type) : 'arg' must be NULL or a character vector




On 2013-12-03, at 1:05 PM, Emmanuel Paradis wrote:

> Dear Nina,
> 
> You may try:
> 
> df <- expand.grid(poll = levels(data$poll), sex = levels(data$sex))
> predict(mod, df)
> 
> mod is the output from compar.gee. This will give you the predicted means for 
> each combination of the factors (which are linear combinations of the 
> coefficient estimates).
> 
> HTH
> 
> Emmanuel

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to