Fitting agestructured selection model
Description
lmf
fit linear models within each combination of year and age class and
estimates coefficients of selection using maximum likelihood procedures.
lmf
is compatible with populations without agestructure.
Usage
1 2 3 
Arguments
formula 
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted when estimating coefficients of selection. Format: response ~ terms. The detail of model specification are given under 'Details'. 
age 
used to define the name of the age column in the data set. Use NULL if no age data are available in the data set. 
year 
used to define the name of the year column in the data set. 
data 
data set with individual ids (optional), year of reproduction (year), maternal age (age; may be omitted if a model without age is desired), number of female offspring (recruits), survival to the next reproductive event (survival) and phenotypic measurements. Age classes should have a natural order of increasing age. E.g. 1, 2, 3, ... 
na.action 
a function which indicate what should happend when the data contain NAs. The
default is 
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 
Details
lmf
use formulas for model specification. These should be formatted as
decribed under arguments. Note however that your response should be specified
as a twocolumn matrix with the columns recruits and survival. The first column
should give the number of recruits that an individual produced a given year and
the second column should contain information on whether the individual survived
or not (1 or 0) to the next breeding season. These two columns will be used to
calculate the individual reproductive values (Wj) which the model will substitute
for the response in the age and year specific linear regressions
(i.e. Wj ~ terms
).
Value
lmf
returns an object of class "lmf".
The function summary
is used to obtain and
print a summary of the results. For construction of confidene intervals or
perform statistical inference on the parameters the function boot.lmf
is used.
An object of class "lmf" is a list containing the following components:
running.time 
the total time used for computation. 
optim.time 
the time used for maximation of the loglikelihood. 
call 
the matched call. 
npar 
the number of parameters in the model. 
uage 
the unique age classes in the data set. 
nage 
the number of unique age classes in the data set. 
maxage 
the final age class. 
l 
the estimated projection matrix. 
lambda 
the deterministic multiplicative growth rate of the population. 
u 
the stable age distribution. 
v 
the vector of reproductive values for each age class. 
uyear 
the unique years in the data set. 
nyear 
the number of unique years in the data set. 
nobs 
the number of observations (counting individualyear). 
nobs.age 
the number of observations per age class. 
indnr 
assigned individual numbers (1:nobs). 
ajt 
a list containing the named vectors of the estimated selection coefficient for each age class within each year. Sorted by age class and year. 
Ajt.us 
a list containing the named unscaled variancecovariance matrix for each age class within each year. Sorted by age class and year. 
sigma.djt 
a list containing the vectors of residual standard errors from the linear regression for each age class within each year. Sorted by age class and year. 
dof 
a list containing the vectors of degrees of freedom (dof) from the linear regression for each age class within each year. Sorted by age class and year. 
res 
a list containing the vectors of residuals from the linear regression for each age class within each year. Sorted by age class and year. 
fit 
a list containing the vectors of fitted values from the linear regression for each age class within each year. Sorted by age class and year. 
leverage 
a list containing the vectors of estimated leverage for each
data point from the linear regression for each age class within each year
(see 
cook 
a list containing the vectors of estimated Cook's distance for each
data point from the linear regression for each age class within each year
(see 
sigma2.dj 
a list containing the demographic variance for each age class. Sorted by age class. 
sigma2.dj.dof 
a list containing the degrees of freedom (dof) for the demographic variance for each age class. Sorted by age class. 
sigma2.dj.sd 
a list containing the standard deviation (sd) for the demographic variance for each age class. Sorted by age class. 
sigma2.d 
the total demographic variance of the population. 
sigma2.d.dof 
the degrees of freedom (dof) for the total demographic variance of the population. 
sigma2.d.sd 
the standard deviation (sd) for the total demographic variance of the population. 
Ajt 
a list containing the named variancecovariance matrix (scaled by sigma2.dj) for each age class within each year. Sorted by age class and year. 
at 
a list containing the named vectors of the estimated selection coefficient for each year. Sorted by year. 
At 
a list containing the named variancecovariance matrix (scaled by sigma2.dj) for each year. Sorted by year. 
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. 
atC 
the best linear predictor for the estimated yearly selection coefficients (i.e. corrected for sampling errors). 
Anf 
the estimated temporal covariance matrix assuming no fluctuating selection. 
anf 
the estimated temporal mean selection coefficients assuming no fluctuating selection. 
sigma2.e 
the environmental variance of the population. 
data.set 
the data set used in the analyses with a column of individual reproductive values addad 
Author(s)
Thomas Kvalnes
References
Engen, S., Saether, B.E., Kvalnes, T. and Jensen, H. 2012. Estimating fluctuating selection in agestructured populations. Journal of Evolutionary Biology, 25, 14871499.
See Also
procomp
, promat
, eigenl
,
lm.extract
, fs
, atCfn
,
nfs
, boot.lmf
Examples
1 2 3 4 5 6 7 8 9 10 11  #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)
#View diagnostic plots
plot(lmf.1)
#View output
print(lmf.1)
#Print summary
summary(lmf.1)
