fit_k: Fit a k-aggregated model

Description Usage Arguments Examples

View source: R/fun.r

Description

Fit a k-aggregated model with a fixed k.

Usage

1
2
3
4
5
fit_k(model = c("poisson", "negbinom", "cmp", "Tpoisson", "Tnegbinom",
  "Tcmp"), count, k = 0, type = 0, model_par = list(Xc = NA, Xz = NA,
  Xrc = NA, Xrz = NA, maxiter = 50, size_upper = 100),
  jags_par = list(chain = 3, sample = 500, thin = 10, method =
  "rjparallel", burnin = 1000, inits = inix))

Arguments

model

character string, partially matched to c('poisson', 'negbinom', 'cmp', 'Tpoisson','Tnegbinom', 'Tcmp'): see 'Details'.

k

numeric (non-negative integer).

type

numeric value, specifying the type of regression model: 0: no covariates; 1: with covariates; 2: with covariates and random effects. Defaults to 0.

model_par

list of model parameters. Xc is the covariate dataframe for the count model, Xrc is a dataframe of the covariate of the random effect for the count model, Xz is the covariate dataframe for the zero/one model, Xrz is the covariate dataframe of the random effect for the zero/one model, size_upper is the upper bound of the prior of the size parameter of a negative binomial distribution (defaults to 100) and maxiter is a positive integer, specifying the number of positive term to keep in the calculation of the Conway-Maxwell-Poisson distribution (defaults to 50).

jags_par

list of variables to pass to run.jags function.

data

numeric vector of counts.

Examples

1
fit = fit_k('n', poss$X.Lb, k=1, model_par = list(Xc = log(1+poss['X.Stags']), Xz = log(1+poss['X.Stags'])) # Fit 1-aggregated negative model to the Leadbeater's possum abundance data

HVoltBb/konez documentation built on Nov. 7, 2019, 1:30 a.m.