CMRSimVars: Simulate a set af co-Variables

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

Description

Simulate a set of co-Variables in a format suitable for a call to CMRSimData

Usage

1
2
3
4
5
CMRSimVars(n=10, npop=4, start, step="6 months", nstep=24, length="5 weeks", factind=NULL,
           	numind=NULL, numtps=NULL, numspts=NULL,	step.spts="month",clage=NULL, 
                minage=NULL, maxage=NULL)
## S3 method for class 'CMRCTVars'
print(x, ...)

Arguments

n

an integer used to define the total number of individuals to be simulated. Let N=n*p to be the total number of individuals to be simulated with p equal to the product of 'npop' with the product of the number of modalities of all factors in 'factind' and the number of age classes when 'clage' is provoded (i.e., p=npop * prod(sapply(factind, length)) * (length(clage +1))). By default 'n=10'.

npop

the number of populations to simulate.

start

(POSIXct) define beginning of the study period i.e., the date at which the variables 'T' and 't' should start. See ?CMRData for more details.

step

define the age unit and the time step used to define the variables 'T' and 't'. It must be defined as the argument 'by' in seq.POSIXt. See ?seq.POSIXt for details. By default 'step="6 months"'.

nstep

(POSIXct) the number of time step to be simulated. By default 'nstep=10'

length

(POSIXct) the length of the capture occasions. It must be defined as the argument 'by' in seq.POSIXt. By default 'length="5 weeks"'.

factind

(optional) a named list where each element is a character vector containing the levels of a given individual factor to be simulated.

numind

(optional) a named list where each element is a numeric vector containing respectively the min and max of a given individual covariate (numeric) to be simulated.

numtps

(optional) a named list where each element is a numeric vector containing respectively the min and max of a given temporal covariate (numeric) to be simulated.

numspts

(optional)a named list where each element is a numeric vector containing respectively the min and max of a given spatio-temporal covariate (numeric) to be simulated.

step.spts

the time step at which each spatio-temporal covariate is updated.

clage

(optional) a numeric vector defining the superior limit of the n-1 first age classes. For instance, to define three age classes 0:1, 1:2 and +2 'clage' should be 'c(1,2)'.

minage

(optional) the minimal age at capture.

maxage

(optional) the maximal age at capture.

x

an object of class 'CMRCTVars'.

...

additional arguments to be passed to or from other methods.

Details

The variables names 'T' (time defined as factor), 't' (time defined as numeric) are reserved and should not be specified by the user in 'factind', 'numind' or 'numtps'. They will be automatically generated when calling 'CMRSimData'.

Value

An object of class CMRCTSimVars.

Author(s)

Hugues Santin-Janin (hugues_sj@yahoo.fr) and David Fouchet (david.fouchet@univ-lyon1.fr)

References

Fouchet D., Santin-Janin H., Sauvage F., Yoccoz N.-G. & Pontier D. (submitted) An R package for analyzing survival using continuous-time open capture-recapture models: an example with feral cats on sub-Antarctic islands.

See Also

seq.POSIXt, CMRData, CMRFit

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
##An example with simulated data
##Let define some arguments
start <- as.POSIXct(strptime("01/01/2000", "%d/%m/%Y"))
factind <- list(sex=c("M", "F"))
##numind <- list(weight=c(0.5, 4))
numtps <- list(rain=c(0, 100))

##Simulate the set of covariables
set.seed(123)
simvars <- CMRSimVars(n=15 , npop=4, start=start, step="6 months",
nstep=12, factind=factind, numtps=numtps, length="5 weeks",
clage=c(2), minage=0.1, maxage=20)

##Plot the simulated capture occasions
plot(simvars)


## End(Not run)

CMRCT documentation built on May 2, 2019, 6:44 p.m.