fitness.landscape: A function to estimate fitness landscapes, i.e. the...

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

View source: R/fitness.landscape2.R View source: R/fitness.landscape.R

Description

fitness.landscape() takes a fitness function, i.e., the relationship between fitness and indivdiual phenotype, as characterized using the function gam() from the package mgcv, and calculates a corresponding fitness landscape in one or two dimensions

Usage

1
2
3
4
fitness.landscape(mod, phenotype, covariates = NULL, points = NULL, 
        plt.density = 25, PI.method = "boot.para", 
        PI.interval = c(0.25, 0.75), n.boot = 50, refit.smooth = FALSE,
        parallel = "no", ncpus = 1)

Arguments

mod

a gam object. Must include predictor variables specified by phenotype

phenotype

a vector of one or two character strings specifying predictor variables in mod that are the phenotypic traits with respect to which the fitness landscape is to be calculated

covariates

a character vector listing any covariates in the model mod to be excluded from chanracterization of the fitness landscape

points

(optional) a matrix, array, or data frame with traits in columns and points in rows, specifying the series of points at which to evaluate the estimated fitness landscape. If missing, the fitness landscape is evaluated at points from one standard deviation below, to one standard deviation above the mean values, at as many points as specified by plt.density

plt.density

(optional) the number of points (per phenotypic trait) at which to evaluate the fitness landscape. only used if points is NULL

PI.method

the method by which to obtain a prediction interval for the fitness landscape. Options are 'n' for none, 'boot.para' for parametric bootstrapping, and 'boot.case' for case bootstrapping.

PI.interval

the upper and lower bounds of the prediction interval. Defaults to c(0.5, 0.75) in order to generate a prediction interval that is interpretable similarly to a standard error.

n.boot

number of bootstrap replicates for evaluating the prediction interval of the fitness landscape

refit.smooth

whether or not to re-estiamte smoothing parameters when gam objects are refitted in bootstrapping and permutation algorithms

parallel

whether or not to use parallel processing to speed up computation of bootstrap prediction intervals. 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 prediction intervals. Only used under linux.

Value

$points

the points at which the fitness landscape was evaluated

$Wbar

population mean absolute fitness at points

$WbarPI

bounds of the prediction interval of Wbar at points

Note

Fitness landscapes are hypothetical constructs used to provide a visual representation of the magnitude of selection. Care must be taken in the interpretation of these landscapes as the increase population mean fitness that would actually be realized from a given amount of selection. This is because there are many assumptions, such as independence of evolution of the mean and variance, which are in fact likely to scale together, lack of density dependence of population growth (i.e. fitness), the assumption that evolution of the trait itself does not change the environment, etc.

Author(s)

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

References

M.B. Morrissey and K. Sakrejda. 2013. Unification of regression-based methods for the analysis of natural selection. Evolution 67: 2094-2100.

See Also

gam.gradients,moments.differentials,gam

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# simulated data (stabilizing selection)
z<-rnorm(200,0,2)
W<-rpois(200,exp(1-1*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)

# characterize fitness landscape
fl<-fitness.landscape(mod=ff,phenotype="z",PI.method='n')

# (not run) plotting
# plot(fl$points[,1],fl$Wbar,type='l')
# lines(fl$points[,1],fl$WbarPI[1,],lty='dashed')
# lines(fl$points[,1],fl$WbarPI[2,],lty='dashed')

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