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

constrain behaves weirdly if doubly constraining a parameter: #5

Open
richfitz opened this issue Nov 18, 2013 · 0 comments
Open

constrain behaves weirdly if doubly constraining a parameter: #5

richfitz opened this issue Nov 18, 2013 · 0 comments

Comments

@richfitz
Copy link
Owner

Reported by @dwbapst:

library(diversitree)
pars <- c(0.1, 0.2, 0.03, 0.03, 0.01, 0.01)
set.seed(2)
phy <- tree.bisse(pars, max.t=60, x0=0)
lik <- make.bisse(phy, phy$tip.state)
lik.2 <- constrain(lik, lambda0 ~ lambda1, lambda0 ~ mu0)

last line generates warning:

Warning message:
In rels[i] <- res[[2]] : (symbol) object cannot be coerced to type 'list'

but the likelihood function doubly constrains lambda0:

BiSSE likelihood function:
  * Parameter vector takes 5 elements:
     - lambda1, mu0, mu1, q01, q10
  * Function constrained (original took 6 elements):
     - lambda0 ~ lambda1
     - lambda0 ~ mu0
  * Function takes arguments (with defaults)
     - pars: Parameter vector
     - ...: Additional arguments to underlying function
     - pars.only [FALSE]: Return full parameter vector?
  * Phylogeny with 203 tips and 202 nodes
     - Taxa: sp1, sp27, sp29, sp31, sp41, sp43, sp46, sp47, sp48, ...
  * References:
     - Maddison et al. (2007) doi:10.1080/10635150701607033
     - FitzJohn et al. (2009) doi:10.1093/sysbio/syp067
R definition:
function (pars, ..., pars.only = FALSE)  
lik.2(2:6, pars.only=TRUE)

gives

lambda0 lambda1     mu0     mu1     q01     q10 
      3       2       3       4       5       6 
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

1 participant