trait_axis {adapt3}R Documentation

Create a Data Frame of Trait Data for Invasion Analysis

Description

Function trait_axis() provides all necessary data for invasion analysis. It lists the specific variations to MPMs for each variant run. Variants can be given via overwritten matrix elements, proxy matrix elements, additive offsets on matrix elements, matrix element multipliers, and additive offsets to y-intercepts in vital rate models.

Usage

trait_axis(
  historical = NULL,
  stagebased = NULL,
  agebased = NULL,
  stageframe = NULL,
  stage3 = NULL,
  stage2 = NULL,
  stage1 = NULL,
  age3 = NULL,
  age2 = NULL,
  eststage3 = NULL,
  eststage2 = NULL,
  eststage1 = NULL,
  estage3 = NULL,
  estage2 = NULL,
  givenrate = NULL,
  offset = NULL,
  multiplier = NULL,
  type = NULL,
  type_t12 = NULL,
  surv_dev = NULL,
  obs_dev = NULL,
  size_dev = NULL,
  sizeb_dev = NULL,
  sizec_dev = NULL,
  repst_dev = NULL,
  fec_dev = NULL,
  jsurv_dev = NULL,
  jobs_dev = NULL,
  jsize_dev = NULL,
  jsizeb_dev = NULL,
  jsizec_dev = NULL,
  jrepst_dev = NULL,
  jmatst_dev = NULL
)

Arguments

historical

A single logical value indicating whether the MPMs intended will be historical or ahistorical. Defaults to TRUE.

stagebased

A single logical value indicating whether the MPM will be stage-based or age-by-stage. Defaults to TRUE.

agebased

A single logical value indicating whether the MPM will be age-based or age-by-stage. Defaults to FALSE.

stageframe

The stageframe used to produce the MPM. Required if producing any stage-based or age-by-stage MPM. Must be omitted for purely age-based MPMs.

stage3

String vector of stage names in occasion t+1 in the transition to be affected. Abbreviations for groups of stages are also usable (see Notes). Required in all stage-based and age-by-stage MPMs.

stage2

String vector of stage names in occasion t in the transition to be affected. Abbreviations for groups of stages are also usable (see Notes). Required in all stage-based and age-by-stage MPMs.

stage1

String vector of stage names in occasion t-1 in the transition to be affected. Only needed if a historical matrix is to be produced. Abbreviations for groups of stages are also usable (see Notes). Required for historical stage-based MPMs.

age3

An integer vector of the ages in occasion t+1 to use in transitions to be affected. Required for all age- and age-by-stage MPMs.

age2

An integer vector of the ages in occasion t to use in transitions to be affected. Required for all age- and age-by-stage MPMs.

eststage3

String vector of stage names to replace stage3 in a proxy transition. Only needed if a transition will be replaced by another estimated transition, and only in stage-based and age-by-stage MPMs.

eststage2

String vector of stage names to replace stage2 in a proxy transition. Only needed if a transition will be replaced by another estimated transition, and only in stage-based and age-by-stage MPMs.

eststage1

String vector of stage names to replace stage1 in a proxy historical transition. Only needed if a transition will be replaced by another estimated transition, and the matrix to be estimated is historical and stage-based. Stage NotAlive is also possible for raw hMPMs as a means of handling the prior stage for individuals entering the population in occasion t.

estage3

Integer vector of age at time t+1 to replace age3 in a proxy transition. Only needed if a transition will be replaced by another estimated transition, and only in age-based and age-by-stage MPMs.

estage2

Integer vector of age at time t to replace age2 in a proxy transition. Only needed if a transition will be replaced by another estimated transition, and only in age-based and age-by-stage MPMs.

givenrate

A numeric vector of fixed rates or probabilities to replace for the transition described by stage3, stage2, stage1, and/or age2.

offset

A numeric vector of fixed numeric values to add to the transitions described by stage3, stage2, stage1, and/or age2.

multiplier

A numeric vector of multipliers for the transition described by stage3, stage2, stage1, and/or age2, or for the proxy transitions described by eststage3, eststage2, eststage1, and/or estage2. Defaults to 1.

type

Integer vector denoting the kind of transition between occasions t and t+1 to be replaced. This should be entered as 1, S, or s for the replacement of a survival transition; 2, F, or f for the replacement of a fecundity transition; or 3, R, or r for a fecundity set value / general multiplier. If empty or not provided, then defaults to 1 for survival transition.

type_t12

An optional integer vector denoting the kind of transition between occasions t-1 and t. Only necessary if a historical MPM in deVries format is desired. This should be entered as 1, S, or s for a survival transition; or 2, F, or f for a fecundity transitions. Defaults to 1 for survival transition, with impacts only on the construction of deVries-format hMPMs.

surv_dev

An optional vector of numeric deviations to the y-intercept of the survival model used in function-based MPM creation. Defaults to NA for all values.

obs_dev

An optional vector of numeric deviations to the y-intercept of the observation model used in function-based MPM creation. Defaults to NA for all values.

size_dev

An optional vector of numeric deviations to the y-intercept of the primary size model used in function-based MPM creation. Defaults to NA for all values.

sizeb_dev

An optional vector of numeric deviations to the y-intercept of the secondary size model used in function-based MPM creation. Defaults to NA for all values.

sizec_dev

An optional vector of numeric deviations to the y-intercept of the tertiary size model used in function-based MPM creation. Defaults to NA for all values.

repst_dev

An optional vector of numeric deviations to the y-intercept of the reproduction model used in function-based MPM creation. Defaults to NA for all values.

fec_dev

An optional vector of numeric deviations to the y-intercept of the fecundity model used in function-based MPM creation. Defaults to NA for all values.

jsurv_dev

An optional vector of numeric deviations to the y-intercept of the juvenile survival model used in function-based MPM creation. Defaults to NA for all values.

jobs_dev

An optional vector of numeric deviations to the y-intercept of the juvenile observation model used in function-based MPM creation. Defaults to NA for all values.

jsize_dev

An optional vector of numeric deviations to the y-intercept of the juvenile primary size model used in function-based MPM creation. Defaults to NA for all values.

jsizeb_dev

An optional vector of numeric deviations to the y-intercept of the juvenile secondary size model used in function-based MPM creation. Defaults to NA for all values.

jsizec_dev

An optional vector of numeric deviations to the y-intercept of the juvenile tertiary size model used in function-based MPM creation. Defaults to NA for all values.

jrepst_dev

An optional vector of numeric deviations to the y-intercept of the juvenile reproduction model used in function-based MPM creation. Defaults to NA for all values.

jmatst_dev

An optional vector of numeric deviations to the y-intercept of the juvenile maturity model used in function-based MPM creation. Defaults to NA for all values.

Value

A data frame of class adaptAxis. This object can be used as input in function invade3().

Variables in this object include the following:

variant

Denotes each variant in order, with each row corresponding to a novel variant.

stage3

Stage at occasion t+1 in the transition to be replaced.

stage2

Stage at occasion t in the transition to be replaced.

stage1

Stage at occasion t-1 in the transition to be replaced.

age3

Age at occasion t+1 in the transition to be replaced.

age2

Age at occasion t in the transition to be replaced.

eststage3

Stage at occasion t+1 in the transition to replace the transition designated by stage3, stage2, and stage1.

eststage2

Stage at occasion t in the transition to replace the transition designated by stage3, stage2, and stage1.

eststage1

Stage at occasion t-1 in the transition to replace the transition designated by stage3, stage2, and stage1.

estage3

Age at occasion t+1 in the transition to replace the transition designated by age3.

estage2

Age at occasion t in the transition to replace the transition designated by age2.

givenrate

A constant to be used as the value of the transition.

offset

A constant value to be added to the transition or proxy transition.

multiplier

A multiplier for proxy transitions or for fecundity.

convtype

Designates whether the transition from occasion t to occasion t+1 is a survival transition probability (1), a fecundity rate (2), or a fecundity multiplier (3).

convtype_t12

Designates whether the transition from occasion t-1 to occasion t is a survival transition probability (1), a fecundity rate (2).

surv_dev

Numeric deviations to the y-intercept of the vital rate model of survival.

obs_dev

Numeric deviations to the y-intercept of the vital rate model of observation.

size_dev

Numeric deviations to the y-intercept of the vital rate model of primary size.

sizeb_dev

Numeric deviations to the y-intercept of the vital rate model of secondary size.

sizec_dev

Numeric deviations to the y-intercept of the vital rate model of tertiary size.

repst_dev

Numeric deviations to the y-intercept of the vital rate model of reproduction.

fec_dev

Numeric deviations to the y-intercept of the vital rate model of fecundity.

jsurv_dev

Numeric deviations to the y-intercept of the vital rate model of juvenile survival.

jobs_dev

Numeric deviations to the y-intercept of the vital rate model of juvenile observation.

jsize_dev

Numeric deviations to the y-intercept of the vital rate model of juvenile primary size.

jsizeb_dev

Numeric deviations to the y-intercept of the vital rate model of juvenile secondary size.

jsizec_dev

Numeric deviations to the y-intercept of the vital rate model of juvenile tertiary size.

jrepst_dev

Numeric deviations to the y-intercept of the vital rate model of juvenile reproduction.

jmatst_dev

Numeric deviations to the y-intercept of the vital rate model of juvenile maturity.

Notes

Negative values are not allowed in givenrate and multiplier input, but are allowed in offset, if values are to be subtracted from specific estimated transitions. Stage entries should not be used for purely age-based MPMs, and age entries should not be used for purely stage-based MPMs.

Entries in stage3, stage2, and stage1 can include abbreviations for groups of stages. Use rep if all reproductive stages are to be used, nrep if all mature but non-reproductive stages are to be used, mat if all mature stages are to be used, immat if all immature stages are to be used, prop if all propagule stages are to be used, npr if all non-propagule stages are to be used, obs if all observable stages are to be used, nobs if all unobservable stages are to be used, and leave empty or use all if all stages in stageframe are to be used. Also use groupX to denote all stages in group X (e.g. group1 will use all stages in the respective stageframe's group 1).

Type 3 conversions are referred to as fecundity set values, or general fecundity multipliers. These set the transitions to be used as fecundity transitions. Transitions set here will be interpreted as being generally reproductive, meaning that the from and to stages will be used to determine the general fecundity transitions to incorporate into stage-based MPMs, while the age portion of the input will be used to incorporate the actual multiplier(s) specified. If only stage transitions at certain ages are expected to be the sole contributors to fecundity, then type 2 conversions should also be included in the supplement (Type 1 and 2 conversions can be purely age-specific, and do not set reproductive transitions in MPM creation). For example, if all stage 2 to stage 3 transitions above age 2 yield fecundity, then stage 2 to stage 3 can be set to multiplier = 1.0 with convtype = 3, and the same transition for age2 = c(1, 2) can be set to multiplier = c(0, 0).

Several operations may be included per transition. Operations on the same row of the resulting data frame are generally handled with given rate substitutions first, then with proxy transitions, then by additive offsets, and finally by multipliers. This order can be manipulated by ordering operations across rows, with higher numbered rows in the data frame being performed later.

See Also

ta_skeleton()

Examples

library(lefko3)

data(cypa_data)

sizevector <- c(0, 0, 0, 0, 0, 0, 1, 2.5, 4.5, 8, 17.5)
stagevector <- c("SD", "P1", "P2", "P3", "SL", "D", "XSm", "Sm", "Md", "Lg",
  "XLg")
repvector <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
obsvector <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
matvector <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
immvector <- c(0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0)
propvector <- c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
indataset <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
binvec <- c(0, 0, 0, 0, 0, 0.5, 0.5, 1, 1, 2.5, 7)

cypframe_raw <- sf_create(sizes = sizevector, stagenames = stagevector,
  repstatus = repvector, obsstatus = obsvector, matstatus = matvector,
  propstatus = propvector, immstatus = immvector, indataset = indataset,
  binhalfwidth = binvec)

cypraw_v1 <- verticalize3(data = cypa_data, noyears = 18, firstyear = 1994,
  individcol = "plant_id", blocksize = 2, sizeacol = "Inf.94",
  sizebcol = "Veg.94", repstracol = "Inf.94", fecacol = "Inf.94",
  stageassign = cypframe_raw, stagesize = "sizeadded", NAas0 = TRUE,
  NRasRep = TRUE)

cypa_ta <- trait_axis(stageframe = cypframe_raw,
  stage3 = c("P1", "P1", "P1", NA, NA, NA),
  stage2 = c("rep", "rep", "rep", NA, NA, NA),
  multiplier = c(0.5, 2.0, 10., NA, NA, NA), type = c(2, 2, 2, NA, NA, NA),
  obs_dev = c(NA, NA, NA, 0.5, 2.0, 50), fec_dev = c(NA, NA, NA, -1000, 0, 1000))


[Package adapt3 version 1.0.1 Index]