[R-sig-ME] using nlme

Ben Bolker bbolker at gmail.com
Sun Aug 11 02:51:57 CEST 2013


Robert Corty <rcorty at ...> writes:

> 
> I am having trouble running nlme.  Here is the relevant snippet of my
> code.  Any ideas?
> 
>     df <- data.frame(phen = phen.info.box[,2], hap = as.factor(mouse.haps),
> strain = as.factor(mouse.strains))
> 
>     fit <- nlme(model = phen ~ hap + strain,
>                 data = df,
>                 fixed = hap + strain ~ 1,
>                 random = strain ~ 1,
>                 start = rep(0, nrow(df)),
>                 correlation = K)
> 
> The error is:
> 
> Error in getGroups.data.frame(dataMix, eval(parse(text = paste("~1",
> deparse(groups[[2]]),  :
>   invalid formula for groups
> 
> -Robert
> 

  Can you give a small reproducible example and say a little more
about what you're trying to do?  It looks like you're fitting an
additive model, which seems odd (although perhaps you're just
warming up for something more complex).  You don't seem to have a 
grouping variable in your 'random' specification ... ? That only
works if you use a groupedData object to fit ...



More information about the R-sig-mixed-models mailing list