Description Usage Arguments Details Value Author(s) References See Also Examples
fs
is a function which estimates the temporal covariance matrix (i.e.
fluctuating selection) and the temporal mean alpha coefficients (i.e. directional
selection) through a numerical maximization of a loglikelihood function.
1 
At 
a list containing the named yearly variancecovariance matrices. Sorted by year. 
at 
a list containing the named yearly vectors of the estimated selection coefficients. Sorted by year. 
npar 
the number of parameters in the model for the estimates selection coefficients. 
nyear 
the number of years with estimates of selection. 
method 
defines what optimalization algorithm to be used in the maximization of the
loglikelihood. Alternatives are: "NelderMead", "BFGS" (default), "CG",
"LBFGSB" and "SANN". Not all are applicable here. See 
control 
a list of control parameters for the maximization of the likelihood.

... 
additional arguments to be passed to optim for the maximization of the
loglikelihood. See 
fs
is used internally in lmf
when estimating temporal coefficients
of selection, but given the right data can be executed as a standalone. The input
to the arguments At and at are estimated within lmf
by correctly combining
estimates of coefficients and variancecovariance within each age class and year
to a estimate for each year.
fs
used optim
for the numerical maximization of the
log likelihood function lnL.M
. Problems of nonpositive definite matrices
appearing as maximas, due to numerical rounding, are solved with nearPD
,
which implement the smallest possible numerical changes of some componets of the
matrices to achive positive definiteness. These changes does not affect the
results in any significant way.
Engen et al. 2012 describe the maximum likelihood method in details.
fs
returns a list containing the following components:
convergence 
"yes" indicates that the numerical maximation of the
likelihood successfully converged before reaching the iteration limit 
iterations 
the number of iterations of the function in the numerical maximation of the likelihood. 
M 
the estimated temporal covariance matrix (fluctuating selection). 
aM 
the estimated temporal mean selection coefficients. 
Thomas Kvalnes
Engen, S., Saether, B.E., Kvalnes, T. and Jensen, H. 2012. Estimating fluctuating selection in agestructured populations. Journal of Evolutionary Biology, 25, 14871499.
1 2 3 4 5 6 7 8 9 10 11 12 13 14  #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 temporal selection coefficients
flusel < fs(At = At, at = at, npar = 3, nyear = 7, method = "BFGS",
control = list(maxit = 500, reltol = sqrt(.Machine$double.eps)))
#View output
str(flusel)
flusel

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.