| fit_inad | R Documentation |
Fits INAD models by maximum likelihood.
fit_inad(
y,
order = 1,
thinning = c("binom", "pois", "nbinom"),
innovation = c("pois", "bell", "nbinom"),
blocks = NULL,
max_iter = 50,
tol = 1e-06,
verbose = FALSE,
init_alpha = NULL,
init_theta = NULL,
init_tau = 0.4,
init_nb_inno_size = 1,
nb_inno_size_ub = 50,
na_action = c("fail", "complete", "marginalize")
)
y |
Integer matrix n_sub by n_time. |
order |
Integer in {0, 1, 2}. |
thinning |
One of "binom", "pois", "nbinom". |
innovation |
One of "pois", "bell", "nbinom". |
blocks |
Optional integer vector length n_sub. Default NULL. |
max_iter |
Max iterations for FE coordinate descent. |
tol |
Tolerance for FE log likelihood stopping. |
verbose |
Logical. |
init_alpha |
Optional initial alpha. For order 1 numeric length 1 or n_time. For order 2 matrix n_time by 2 or list(alpha1, alpha2). |
init_theta |
Optional initial theta numeric length 1 or n_time. |
init_tau |
Optional initial tau. Scalar expands to c(0, x, ..., x). Vector forces first to 0. |
init_nb_inno_size |
Optional initial size for innovation nbinom, length 1 or n_time. |
nb_inno_size_ub |
Upper bound for innovation negative binomial size
parameter when |
na_action |
How to handle missing values:
|
No fixed effect: time separable optimization using logL_inad_i with theta eliminated by moment equations for order 1 and 2.
Fixed effect: block coordinate descent using nloptr BOBYQA, updating tau, alpha, theta, and nb_inno_size if needed.
A list of class "inad_fit" containing:
Estimated antedependence parameter(s)
Estimated innovation parameter(s)
Estimated block effects (if applicable)
Estimated innovation NB size parameter(s), when
innovation = "nbinom"
Maximized log-likelihood
Akaike information criterion
Bayesian information criterion
Number of free parameters
Convergence code
Model and fitting settings
set.seed(1)
y <- simulate_inad(
n_subjects = 60,
n_time = 5,
order = 1,
thinning = "binom",
innovation = "pois",
alpha = 0.3,
theta = 2
)
fit <- fit_inad(y, order = 1, thinning = "binom", innovation = "pois", max_iter = 20)
fit$log_l
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.