简体   繁体   中英

Error running PGLS in ape: “no covariate specified”

I just re-visited an old r script to double check my analyses. I'm getting this new error when I try to run PGLS:

No covariate specified, species will be taken as ordered in the data frame. To avoid this message, specify a covariate containing the species names with the 'form' argument.

I wonder if it has to do with a new update? I don't think there's anything wrong with my script because I also got this error when I tried to replicate previous tutorials. But just in case I'm wrong, I've pasted my script below:

gls(Diet_PC1~Habitat_PC1,correlation = corBrownian(phy = PrimateTree.phy), data=traits, method="ML")

Does anyone have any solutions?

Thanks! MD

I ran into similar issues while running through a tutorial a while back. From what I figured out, it's related to an update to 'ape' that was pushed in June. the cor[MODEL] functions now require a formula specifying the taxa covariate. Per the reference manual:

a one sided formula of the form ~ t, or ~ t |g, specifying the taxa covariate t and, optionally, a grouping factor g. A covariate for this correlation structure must be character valued, with entries matching the tip labels in the phylogenetic tree. When a grouping factor is present in form, the correlation structure is assumed to apply only to observations within the same grouping level; observations with different grouping levels are assumed to be uncorrelated. Defaults to ~ 1, which corresponds to using the order of the observations in the data as a covariate, and no groups.

Code example from the manual:

gls(Y ~ X, dat, correlation=corBrownian(1, tree.primates, form = ~Species))

At the time, I wasn't able to figure out how to use the "form" parameter with the tutorial I was using and get the expected results. So, I installed the prior version of "ape" released and everything ran perfectly fine (obtained the expected results for the tutorial). I'm sure this is a really useful paramter, but I wasn't able to find any good resources on how to correctly use it at the time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM