fnGammaASRV
- fnGammaASRV
submodel : | SiteMixtureModel (pass by const reference) |
Sub-model. | |
alpha : | RealPos (pass by const reference) |
The alpha parameter of the gamma distribution. | |
n : | Integer (pass by const reference) |
The number of bins to approximate the gamma distribution. | |
Default : 4 | |
median : | Bool (pass by const reference) |
Should we use the median (or the mean) | |
Default : FALSE |
# fnGammaASRV( ) constructs a mixture model that represents both the underlying
# rate matrix and Gamma-distributed rate variation.
for (i in 1:10) { taxa[i] = taxon("T"+i) }
psi ~ dnBDP(lambda=1, rootAge=1, taxa=taxa)
alpha ~ dnExp(1/10)
er ~ dnDirichlet( [1,1,1,1,1,1] )
pi ~ dnDirichlet( [1,1,1,1] )
M := fnGammaASRV( fnGTR(er, pi), alpha, 4)
seq ~ dnPhyloCTMC(psi, M, type="DNA",nSites=10)
# As an alternative approach, models can be built up iteratively using pipes.
M := fnGTR(er,pi) |> fnGammaASRV(alpha, 4)
M := fnGTR(er,pi) |> fnGammaASRV(alpha, 4) |> fnInvASRV(p_inv) # This has 5 (4+1) components - faster.
M := fnGTR(er,pi) |> fnInvASRV(p_inv) |> fnGammaASRV(alpha, 4) # This has 8 (2*4) components - slower.
# The site model parameter can be a mixture model
weights ~ dnDirichlet([1,1])
pi1 ~ dnDirichlet( [1,1,1,1,1,1 ] )
pi2 ~ dnDirichlet( [1,1,1,1,1,1 ] )
M := fnMixtureASRV([fnGTR(er,pi1),fnGTR(er,pi2)],weights) |> fnGammaASRV(alpha) |> fnInvASRV(p_inv)