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

caper with multiple rescaling #60

Closed
mwpennell opened this issue Dec 9, 2013 · 2 comments
Closed

caper with multiple rescaling #60

mwpennell opened this issue Dec 9, 2013 · 2 comments
Assignees

Comments

@mwpennell
Copy link
Collaborator

so looking at the caper interface, it is possible to estimate any combination of parameters (lambda, delta, kappa) for the pgls, but i am not sure how to handle this (or whether it is even valid) when rescaling for model adequacy, as the order seems to matter

library(geiger)
library(caper)
set.seed(1)
phy <- sim.bdtree(stop="taxa")
d1 <- sim.char(phy, 1, model="BM")[,,]
d2 <- sim.char(phy, 1, model="BM")[,,]

traits <- cbind.data.frame(d1, d2, phy$tip.label)
colnames(traits)[3] <- "species"
cd <- comparative.data(phy, traits, species)

now fit the model with both kappa and delta

fit <- pgls(d1~d2, data=cd, kappa="ML", delta="ML")

ignoring s2, rescale the tree first by delta, then kappa

delta.phy <- rescale(phy, model="delta", delta=fit$param["delta"])
dk.phy <- rescale(delta.phy, model="kappa", kappa=fit$param["kappa"])

now rescale by kappa, then by delta

kappa.phy <- rescale(phy, model="kappa", kappa=fit$param["kappa"])
kd.phy <- rescale(kappa.phy, model="delta", delta=fit$param["delta"])

these are not equivalent

kd.phy$edge.length == dk.phy$edge.length

@ghost ghost assigned lukejharmon Dec 9, 2013
@richfitz
Copy link
Member

richfitz commented Dec 9, 2013

One option is just to detect that someone has done this and throw an error. Does fitting multiple rescaling parameters make any sense?

@mwpennell
Copy link
Collaborator Author

I don't think it makes any sense at all but caper does not check for this. writing caper parsing fxns now and am just throwing error if more than one model is used.

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

3 participants