fit | R Documentation |
This function creates a list of parameters, sets up TMB object and attempts to do fitting / estimation
fit(
data_list,
silent = FALSE,
inits = NULL,
control = list(eval.max = 2000, iter.max = 1000, rel.tol = 1e-10),
limits = NULL,
fit_model = TRUE
)
data_list |
A list of data, as output from create_data |
silent |
Boolean passed to TMB::MakeADFun, whether to be verbose or not (defaults to FALSE) |
inits |
Optional named list of parameters for starting values, defaults to NULL |
control |
Optional control list for stats::nlminb. For arguments see ?nlminb. Defaults to eval.max=2000, iter.max=1000, rel.tol=1e-10. For final model runs, the rel.tol should be even smaller |
limits |
Whether to include limits for stats::nlminb. Can be a list of (lower, upper), or TRUE to use suggested hardcoded limits. Defaults to NULL, where no limits used. |
fit_model |
Whether to fit the model. If not, returns a list including the data, parameters, and initial values. Defaults to TRUE |
data(fishdist)
# example of fitting fixed effects, no trends, no random effects
set.seed(1)
datalist <- create_data(fishdist[which(fishdist$year > 1970), ],
asymmetric_model = FALSE,
est_mu_re = FALSE, est_sigma_re = FALSE
)
fit <- fit(datalist)
#
# # example of model with random effects in means only, and symmetric distribution
# set.seed(1)
# datalist <- create_data(fishdist[which(fishdist$year > 1970),], asymmetric_model = FALSE,
# est_sigma_re = FALSE)
# fit <- fit(datalist)
# # example of model with random effects in variances
# set.seed(1)
# datalist <- create_data(fishdist[which(fishdist$year > 1970),], asymmetric_model = TRUE,
# est_mu_re = TRUE)
# fit <- fit(datalist)
#
# # example of model with poisson response
# set.seed(1)
# datalist <- create_data(fishdist[which(fishdist$year > 1970),], asymmetric_model = FALSE,
# est_sigma_trend=FALSE, est_mu_trend=FALSE, est_mu_re = TRUE,
# family="poisson")
# fit <- fit(datalist)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.