Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"undefined column selected" with pglmm_plot_ranef #65

Open
jusinowicz opened this issue Mar 26, 2021 · 2 comments
Open

"undefined column selected" with pglmm_plot_ranef #65

jusinowicz opened this issue Mar 26, 2021 · 2 comments

Comments

@jusinowicz
Copy link

jusinowicz commented Mar 26, 2021

Hello,

First, thanks for this awesome R package! It's allowing me to do things that I haven't been able to do with any other GLMM package.

I'm trying to use pglmm_plot_ranef() to extract the random effects predictions on simulated data and I noticed that if I name my "species" phylogeny variable anything other than "sp" that it returns the error:

Error in [.data.frame(data, , sp.var) : undefined columns selected

I ran into this problem with a simulated data set, but it seems to be reproducible running the "### Detailed analysis showing covariance matrices ###" example under the pglmm() documentation. If I run this simulation but change the name of "sp" in the data frame "d" to anything else (and then change the name in the calls to pglmm and pglmm_plot_ranef, of course), then pglmm_plot_ranef will return the error (even though pglmm runs fine). E.g. at these lines change the name and run:


d <- data.frame(species= rep(phy$tip.label, times = nsite),
site = rep(1:nsite, each = nspp))

d$Y <- Y.sp + Y.site + Y.attract + Y.e

#Works
pglmm(Y ~ 1 + (1|species__) + (1|site) + (1|species__@site), data = d, cov_ranef = list(species = phy))

#Does not
re <- pglmm_plot_ranef(Y ~ 1 + (1|species__) + (1|site) + (1|species__@site), data = d,
cov_ranef = list(species= phy), show.image = FALSE, show.sim.image = FALSE)

Am I missing something?
Thanks.

@daijiang
Copy link
Owner

Hi Jacob!
Can you try pglmm_plot_ranef(sp.var = "species") and see whether that work?

Btw, it has been several years since our last interaction! Hope to catch up with you sometime soon.

Best,
Daijiang

@jusinowicz
Copy link
Author

jusinowicz commented Mar 26, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants