edit_lM {lefko3}R Documentation

Edit an MPM based on Supplemental Data

Description

Function edit_lM() edits existing lefkoMat objects with external data supplied by the user. The effects are similar to function supplemental(), though function edit_lM() allows individuals matrices within lefkoMat objects to be edited after creation, while supplemental() provides external data that modifies all matrices within a lefkoMat object.

Usage

edit_lM(
  mpm,
  pop = NULL,
  patch = NULL,
  year2 = NULL,
  stage3 = NULL,
  stage2 = NULL,
  stage1 = NULL,
  age2 = NULL,
  eststage3 = NULL,
  eststage2 = NULL,
  eststage1 = NULL,
  estage2 = NULL,
  givenrate = NULL,
  multiplier = NULL,
  type = NULL,
  type_t12 = NULL
)

Arguments

mpm

The lefkoMat object to be edited.

pop

A string vector denoting the populations to be edited. Defaults to NULL, in which case all populations are edited.

patch

A string vector denoting the patches to be edited. Defaults to NULL, in which case all patches are edited.

year2

A string vector denoting the years to be edited. Defaults to NULL, in which case all years are edited.

stage3

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

stage2

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

stage1

The name of the stage in occasion t-1 in the transition to be replaced. 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.

age2

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

eststage3

The name of the stage 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

The name of the stage 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

The name of the stage 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.

estage2

The 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 fixed rate or probability to replace for the transition described by stage3, stage2, and stage1.

multiplier

A vector of numeric multipliers for fecundity or for proxy transitions. Defaults to 1.

type

A 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 multiplier. If empty or not provided, then defaults to 1 for survival transition.

type_t12

An optional 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.

Value

An edited copy of the original MPM is returned, also as a lefkoMat object.

Notes

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).

See Also

supplemental()

Examples

data(cypdata)

cypraw_v1 <- verticalize3(data = cypdata, noyears = 6, firstyear = 2004,
  patchidcol = "patch", individcol = "plantid", blocksize = 4,
  sizeacol = "Inf2.04", sizebcol = "Inf.04", sizeccol = "Veg.04",
  repstracol = "Inf.04", repstrbcol = "Inf2.04", fecacol = "Pod.04",
  age_offset = 3, NAas0 = TRUE, NRasRep = TRUE)

cyp_rl <- rleslie(data = cypraw_v1, start_age = 0, last_age = 6, continue = TRUE,
  fecage_min = 3, year = "all", pop = NA, patch = "all", yearcol = "year2",
  patchcol = "patchid", indivcol = "individ")

ddd1 <- edit_lM(cyp_rl, age2 = c(0, 1, 2, 3, 4, 5, 6),
  givenrate = c(0.25, 0.25, 0.4, 0.4, NA, NA, NA),
  multiplier = c(NA, NA, NA, NA, 2000, 2000, 2000),
  type = c(1, 1, 1, 1, 3, 3, 3))
  
ddd1 <- edit_lM(ddd1, age2 = 6, multiplier = 1.5, type = 3, patch = "B",
  year2 = "2005")


[Package lefko3 version 6.2.1 Index]