model_params: Estimate model parameters

Description Usage Arguments Details Value References See Also Examples

View source: R/model.R

Description

Model estimated parameters for fitting double logistic curve.

Usage

1
2
model_params(DT, returns = NULL, id = "id", year = "yr",
  xmidS = NULL, xmidA = NULL, scalS = NULL, scalA = NULL)

Arguments

DT

data.table of NDVI time series. Also optionally starting estimates. See Details.

returns

either 'models' or 'columns'. 'models' will return a data.table of model outcomes by id and year. 'columns' will append model estimate parameters to the input DT.

id

id column. default is 'id'. See details.

year

year column name. default is 'yr'.

xmidS

starting estimates. see Details. - "spring inflection point"

xmidA

starting estimates. see Details. - "fall inflection point"

scalS

starting estimates. see Details. - "scale parameter for spring green-up portion of the NDVI curve"

scalA

starting estimates. see Details. - "scale parameter for fall dry-down portion of the NDVI curve"

Details

Arguments xmidS, xmidA, scalS, scalA allow users to provide either group level or global starting estimates to be used for all models.

Either: a character indicating the column name which stores a group level starting parameter (possibly created by model_start OR a numeric value used as a global value for all models. See nls for more details on starting parameters.

Default value for the year column is 'yr'. If you only have one year of data, set to NULL.

The id argument is used to split between sampling units. This may be a point id, polygon id, pixel id, etc. depending on your analysis. This should match the id provided to filtering functions.

Formula and arguments xmidS, xmidA, scalS, scalA following this from Bischoff et al. (2012).

fitted = \frac{1}{1 + \exp{\frac{xmidS - t}{scalS}}} - \frac{1}{1 + \exp{\frac{xmidA - t}{scalA}}}

Value

data.table of model estimated parameters for double logistic model. If any rows are NULL, nls could not fit a model given starting parameters to the data provided.

References

https://www.journals.uchicago.edu/doi/abs/10.1086/667590

See Also

Other model: model_ndvi, model_start

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Load data.table
library(data.table)

# Read in example data
ndvi <- fread(system.file("extdata", "ndvi.csv", package = "irg"))

# Filter and scale NDVI time series
filter_ndvi(ndvi)
scale_doy(ndvi)
scale_ndvi(ndvi)

# Guess starting parameters for xmidS and xmidA
model_start(ndvi)

# Double logistic model parameters
#   given global starting parameters for scalS, scalA
#   and output of model_start for xmidS, xmidA
mods <- model_params(
  ndvi,
  returns = 'models',
  xmidS = 'xmidS_start',
  xmidA = 'xmidA_start',
  scalS = 0.05,
  scalA = 0.01
)

robitalec/irg documentation built on March 20, 2020, 2:03 a.m.