simulate_data: Simulate new dynamics and sampling data

View source: R/simulate_data.R

simulate_dataR Documentation

Simulate new dynamics and sampling data

Description

simulate_data conducts a parametric bootstrap to simulate new data and potentially simulate new population dynamics and associated variables

Simulate new data given various potential procedures to propagate uncertainty about parameters.

Using sample_fixed=TRUE (the default) in sample_variable is similar to using type=3 in simulate_data, while using sample_fixed=TRUE in sample_variable is similar to using type=4 in simulate_data. Sampling fixed effects will sometimes cause numerical under- or overflow (i.e., output values of NA) in cases when variance parameters are estimated imprecisely. In these cases, the multivariate normal approximation being used is a poor representation of the tail probabilities, and results in some samples with implausibly high (or negative) variances, such that the associated random effects then have implausibly high magnitude.

Usage

simulate_data(fit, type = 1, random_seed = NULL)

Arguments

fit

output from fit_model

type

integer stating what type of simulation to use from the following options:

  • type=1 is a "measurement error" or "conditional" simulator that simulates new data conditional upon estimated fixed and random effects.

  • type=2 is an "unconditional" simulator that simulates new random effects conditional upon fixed effects (but not otherwise conditioning upon original data), and new data conditional upon both.

  • type=3 simulates new fixed and random effects from the joint precision matrix (i.e., conditioning upon the original data), and new data conditional upon these values.

  • type=4 simulates new random effects from the internal Hessian matrix evaluated at the MLE (i.e., conditional on fixed effects estimates and the original data), and new data conditional upon these values.

random_seed

integer passed to set.seed, where the default value random_seed=NULL resets the random-number seed.

Value

Report object containing new data and population variables including

b_i

New simulated data

D_gcy

Density for each grid cell g, category c, and year y

Index_cyl

Index of abundance for each category c, year y, and stratum l


James-Thorson/FishStatsUtils documentation built on Feb. 6, 2024, 4:26 a.m.