perspectev.simulate {perspectev} | R Documentation |
Simulate upper/lower level selection at different intensities and observe resulting p values.
Description
Perform simulations of natural selection on a data set, and observe what p values result. Performs linear transformation of trait vs. survivorship (using provided or fitted slope and intercept) and then transforms into survviorship probabilites using inv.logit function.
Usage
perspectev.simulate(data,simulations,cores,traitfun=mcpRange,vlist=NULL,
binary=NA,intercept=NA,slope=NA,level=NA,noise=0,fit=FALSE,quiet=FALSE)
Arguments
data |
Dataframe in perspectev format. See ?perspectev.read for more information. |
simulations |
Number of simulations to perform. At least 1000 is recommended but can be slow. |
cores |
Number of cores over which to parallelize the simulations. |
traitfun |
Function for calculating trait value at each level. |
vlist |
Optional variable list for trait function. |
intercept |
Intercept of the regression between range and survivorship. Can be manually provided or, if not provided, is fit to the data set. Will attempt to set automatically if unspecified. |
slope |
Slope of the regression between range and survivorship. Can be manually provided or, if not provided, is fit to the data set. Will attempt to set automatically if unspecified. |
level |
Simulate either upper or lower level selection. Accepts either "lower" or "upper" respectively. Will set to 'upper' if unspecified. |
noise |
Extra stochasticity to the simulation. |
fit |
Fit simulation to observed parameters? Will do automatically if intercept or slope are not specified. |
binary |
Is survivorship binary or continuous? Will attempt to set automatically if unspecified. |
quiet |
Suppress information messages? |
Value
correlation_simulated |
Correlation between trait and surivovorship from permuted groups at each simulation. |
correlation_observed |
Observed correlation between trait and surivovorship from simulated groups. |
pvalue |
p value observed under simulation of selection. |
level |
Level of simulated selection. |
intercept |
Intercept of simulation. |
slope |
Slope of the simulation. |
noise |
Noise level selected for simulation. |
fitted_model |
Was the model fitted to the data set? |
Note
See original publication and tutorial for more information on simulation.
Author(s)
Kenneth B. Hoehn <perspectev@gmail.com>