Last chance! 50% off unlimited learning
Sale ends in
lnL.M
calculates the loglikelihood of the maximum likelihood function for
temporal coefficients of selection from Engen et al. 2012. Returns the estimate
of alpha for a given temporal variance-covariance matrix (M) if desired.
lnL.M(D, At, at, npar, ret.alphas = FALSE)
lnL.M
returns the loglikelihood estimate (for ret.alpha = FALSE
)
or the temporal mean selection coefficients (for ret.alpha = TRUE
) for a
given temporal variance-covariance matrix M.
fs
, but can be applied as
a standalone.The upper triangular matrix (D) of the Cholesky decomposition of M is defined
as M = t(D)%*%D
.
Details of the method is provided in Engen et al. 2012.
lmf
, fs
, chol
#Data set from Engen et al. 2012
data(sparrowdata)
#Fit model
lmf.1 <- lmf(formula = cbind(recruits, survival) ~ weight + tars,
age = age, year = year, data = sparrowdata)
#Extract At and at
At <- lmf.1$At
at <- lmf.1$at
#Estimate D
D <- as.vector(chol((Reduce('+', At) / length(At))))
D <- D[D != 0]
#Estimate loglikelihood
lnL.M(D = D, At = At, at = at, npar = 3, ret.alphas = FALSE)
#Estimate temporal mean selection coefficients
lnL.M(D = D, At = At, at = at, npar = 3, ret.alphas = TRUE)
Run the code above in your browser using DataLab