gppr.gradients: A function to calculate selection gradients from generalized...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/gppr.gradients.R

Description

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.

Usage

1
2
3
gppr.gradients(mod, phenotype, covariates = NULL, standardized = FALSE, 
          se.method = "boot.para", n.boot = 1000, 
          parallel = "no", ncpus = 1)

Arguments

mod

a fitted object produced by gppr. Must include predictor variables specified by phenotype

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 mod for which selection gradients are not to be cacluated

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, parallel='multicore' allows parallel processing, using the number of processors specified by ncpus

ncpus

the number of cpus to be used for parallel processing of bootstrap standard errors. Only used under linux.

Value

A list. Element 1 is a table of estimates, standard errors and P-values, and element 2 contains the bootstrap or permutation values.

Author(s)

Michael Morrissey michael.morrissey@st-andrews.ac.uk

References

M.B. Morrissey. in prep.

See Also

gam.gradients,gppr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# simulated data (two traits, stabilizing selection on trait 1)
n<-250
z<-cbind(rnorm(n,0,1),rnorm(n,0,1))
W<-rpois(n,exp(2-0.6*z[,1]^2))
d<-as.data.frame(cbind(W,z))
names(d)<-c("W","z1","z2")

fit.func<-gppr(y="W",xterms=c("z1","z2"),data=d,family="poisson",
   nterms=2,max.terms=2)

gppr.gradients(mod= fit.func,phenotype=c("z1","z2"),se.method='n',standardize=FALSE)

Example output

          estimates SE P.value
B-z1     0.02470909 NA      NA
B-z2    -0.02660252 NA      NA
G-z1    -0.97348924 NA      NA
G-z2    -0.74933073 NA      NA
G-z1-z2  0.03168936 NA      NA

gsg documentation built on May 2, 2019, 9:37 a.m.