Description Usage Arguments Value Author(s) References See Also Examples
View source: R/gam.gradients.R
gam.gradients uses numerical approximations to the first and second order partial derivatives of population mean fitness with respect to population mean phenotype to obtain directional and quadratic selection gradients.
1 2 3 | gam.gradients(mod, phenotype, covariates = NULL, standardized = FALSE,
se.method = "boot.para", n.boot = 1000,
parallel = "no", ncpus = 1, refit.smooth = FALSE)
|
mod |
a gam object. Must include predictor variables specified by |
phenotype |
a vector of one or two character strings specifying predictor variables in selection gradients are to be calculated |
covariates |
a character vector listing any covariates in the model |
se.method |
the method by which to obtain standard errors and P-values of the selection gradients. Options are 'n' for none, 'boot.para' for parametric bootstrapping (default), 'boot.case' for case bootstrapping, 'posterior' for an algorithm based on simulation from the multivariate normal approximation to the posterior distribution of the model parameters, and 'permute' for permutation-based P-values (no SEs). |
n.boot |
number of bootstrap replicates for evaluating statistical uncertainty in the selection gradients. |
standardized |
whether or not to standardize to unit variance to obtain selection gradient estimates that are comparable across traits and populations |
parallel |
whether or not to use parallel processing to speed up computation of bootstrap standard errors. Default in 'no' for no parallel computing. Under linux only, |
ncpus |
the number of cpus to be used for parallel processing of bootstrap standard errors. Only used under linux. |
refit.smooth |
whether or not to re-estiamte smoothing parameters when |
A list. Element 1 is a table of estimates, standard errors and P-values, and element 2 contains the bootstrap or permutation values.
Michael Morrissey michael.morrissey@st-andrews.ac.uk
M.B. Morrissey and K. Sakrejda. 2013. Unification of regression-based methods for the analysis of natural selection. Evolution 67: 2094-2100.
gam.gradients,moments.differentials,gam
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # simulated data (stabilizing selection)
z<-rnorm(200,0,2)
W<-rpois(200,exp(1-0.3*z^2))
d<-as.data.frame(list(W=W,z=z))
# characterize the fitness function
library(mgcv)
ff<-gam(W~s(z),family='poisson',data=d)
# derive selection gradients
gam.gradients(mod=ff,phenotype="z",se.method='n',standardized=FALSE)$ests
# or gam.gradients() can be used to do the
# equivalent of a basic Lande and Arnold
# 1983 regression
LA<-gam(W~z+I(z^2),family='gaussian',data=d)
gam.gradients(mod=LA,phenotype="z",se.method='n',standardize=FALSE)$ests
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.