Last data update: 2014.03.03

R: Makes a list of IPMs where there is a discrete covariate.
sampleSequentialIPMsR Documentation

Makes a list of IPMs where there is a discrete covariate.

Description

Wrapper function to build the IPM corresponding to every level of the discrete covariate, and return a list of these.

Usage

sampleSequentialIPMs(dataf, nBigMatrix = 10, minSize = -2, 
    maxSize = 10,	
	integrateType = "midpoint", correction = "none", 
	explSurv = surv ~ size + size2 + covariate, 
	explGrow = sizeNext ~ size + size2 + covariate,
	regType = "constantVar", 
	explFec = fec ~size,  Family="gaussian", 
	Transform = "none", 
	fecConstants = data.frame(NA))

Arguments

dataf

a dataframe with columns ‘size’, ‘sizeNext’, 'surv', 'fec', 'covariate', 'covariatel'; and 'age' indicating which individuals are seedlings for identifying the mean and variance in seedling size.

nBigMatrix

number of bins in size.

minSize

minimum size.

maxSize

maximum size.

integrateType

integration type.

correction

correction for unintentional eviction (individuals move outside the size range of the IPM). This correction redistributes individuals so that column sums of the IPM match expected survival for that column.

explSurv

Formula and explanatory variables used in the survival model.

explGrow

explanatory variables used in the growth model.

regType

Formula and regression Type for growth (normal density function, truncated, etc).

explFec

explanatory variables used in the fecundity.

Family

a character vector containing the names of the families to be used for the glms, e.g., binomial, poisson, etc. Again, these must appear in the order defined by the list of formula

Transform

a character vector containing the names of the transforms to be used for the response variables, e.g., log, sqrt, -1, etc. Again, these must appear in the order defined by the list of formula

fecConstants

data.frame of constant multipliers for the fecundity model.

Value

list of matrices corresponding to covariates, in order.

Note

Formerly makeListIPMs(). makeListIPMs() is no longer supported but has been hidden (.makeListIPMs()) and can be accessed for backward compatibility.

Author(s)

Cory Merow, C. Jessica E. Metcalf, Sean M. McMahon, Roberto Salguero-Gomez, Eelke Jongejans.

Examples

dff <- generateData()
IPMlist <- sampleSequentialIPMs(dff, Transform="log")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(IPMpack)
Loading required package: Matrix
Loading required package: MASS
Loading required package: nlme
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/IPMpack/sampleSequentialIPMs.Rd_%03d_medium.png", width=480, height=480)
> ### Name: sampleSequentialIPMs
> ### Title: Makes a list of IPMs where there is a discrete covariate.
> ### Aliases: sampleSequentialIPMs .makeListIPMs
> ### Keywords: ~kwd1 ~kwd2
> 
> ### ** Examples
> 
> dff <- generateData()
> IPMlist <- sampleSequentialIPMs(dff, Transform="log")
surv ~ size + size2 + covariate
<environment: 0x705fdf8>
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>