| em_inad | R Documentation |
Fits INAD models using the Expectation-Maximization algorithm. This is an alternative to direct likelihood optimization.
em_inad(
y,
order = 1,
thinning = "binom",
innovation = "pois",
blocks = NULL,
max_iter = 200,
tol = 1e-07,
alpha_init = NULL,
theta_init = NULL,
tau_init = NULL,
nb_inno_size = NULL,
safeguard = TRUE,
verbose = FALSE
)
y |
Integer matrix with n_subjects rows and n_time columns. |
order |
Model order (1 or 2). Order 0 does not require EM. |
thinning |
Thinning operator: "binom", "pois", or "nbinom". |
innovation |
Innovation distribution: "pois", "bell", or "nbinom". |
blocks |
Optional integer vector of length n_subjects for block effects. |
max_iter |
Maximum number of EM iterations. |
tol |
Convergence tolerance for log-likelihood change. |
alpha_init |
Optional initial values for alpha parameters. |
theta_init |
Optional initial values for theta parameters. |
tau_init |
Optional initial values for tau parameters. |
nb_inno_size |
Size parameter for negative binomial innovation (if used). |
safeguard |
Logical; if TRUE, use step-halving when likelihood decreases. |
verbose |
Logical; if TRUE, print iteration progress. |
For Gaussian and CAT EM entry points, see em_gau and
em_cat. For CAT specifically, fit_cat() supports
na_action = "em" for orders 0/1 and na_action = "marginalize"
for order 2 missing-data fits.
A list with class "inad_fit" containing estimated parameters.
em_gau, em_cat, fit_inad,
fit_cat
set.seed(1)
y <- simulate_inad(
n_subjects = 50,
n_time = 5,
order = 1,
thinning = "binom",
innovation = "pois",
alpha = 0.25,
theta = 2
)
fit <- em_inad(y, order = 1, thinning = "binom", innovation = "pois", max_iter = 20, tol = 1e-6)
fit$log_l
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.