Description Usage Arguments Details Value Author(s) References See Also Examples
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.
1 2 3 
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 
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
).
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 
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.
procomp
, promat
, eigenl
,
lm.extract
, fs
, atCfn
,
nfs
, boot.lmf
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)

Warning message:
In lmf(formula = cbind(recruits, survival) ~ weight + tars, age = age, :
The years '1999', '2000', '2001' had too few observations for at least one age class and were excluded
ESTIMATING FLUCTUATING SELECTION IN AGESTRUCTURED POPULATIONS
Call:
lmf(formula = cbind(recruits, survival) ~ weight + tars, age = age,
year = year, data = sparrowdata)
Temporal alpha estimates (a(M)):
(Intercept) weight tars
0.88555 0.10305 0.14641
Temporal covariance matrix (M):
(Intercept) weight tars
(Intercept) 2.0438e03 3.5459e05 7.5199e03
weight 3.5459e05 6.1525e07 1.3047e04
tars 7.5199e03 1.3047e04 2.7669e02
Maximization diagnostics:
convergence iterations
yes 342
Running time:
total.elapsed optim.elapsed
0.271 0.169
End
ESTIMATING FLUCTUATING SELECTION IN AGESTRUCTURED POPULATIONS
Call:
lmf(formula = cbind(recruits, survival) ~ weight + tars, age = age,
year = year, data = sparrowdata)
Projection matrix (l):
[,1] [,2]
[1,] 0.0000 0.5102
[2,] 0.3284 0.7143
Lambda:
0.9004
Stable age dist.(u) and reprod. values(v):
age u v
1 0.3617 0.4735
2 0.6383 1.2983
Variance components:
Environmental
0.09144
Demographic
age estimate SD df
1 0.3368 0.06142 38
2 0.5811 0.12971 24
(total) 0.4927 0.08572 62
Temporal alpha estimates (a(M)):
Estimate Std. Error t value Pr(>t)
(Intercept) 0.8855528 0.0452080 19.59 <2e16 ***
weight 0.1030518 0.0007844 131.38 <2e16 ***
tars 0.1464114 0.1663393 0.88 0.382

Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Temporal covariance matrix (M):
(Intercept) weight tars
(Intercept) 2.044e03 3.546e05 7.520e03
weight 3.546e05 6.152e07 1.305e04
tars 7.520e03 1.305e04 2.767e02
Temporal alpha estimates assuming no fluct. selection (a(M=0)):
Estimate Std. Error t value Pr(>t)
(Intercept) 0.88727 0.08948 9.916 2.07e14 ***
weight 0.08902 0.16049 0.555 0.581
tars 0.11730 0.12454 0.942 0.350

Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Temporal covariance matrix assuming no fluct. selection (A):
(Intercept) weight tars
(Intercept) 0.008007 0.001772 0.001284
weight 0.001772 0.025756 0.009256
tars 0.001284 0.009256 0.015510
End
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.