Extract Log-Likelihood
Usage
# S3 method for class 'fitculta'
logLik(object, ...)
Value
Returns an object of class logLik
.
This is a number with at
the attribute, "df"
(degrees of freedom),
giving the number of (estimated) parameters in the model,
and "correction"
which is the scaling correction factor for MLR.
Examples
if (FALSE) { # \dontrun{
# complete list of R function arguments -------------------------------------
# random seed for reproducibility
set.seed(42)
# dimensions
n <- 1000 # number of individuals
m <- 6 # measurement occasions
p <- 4 # number of items
q <- 1 # common trait dimension
# covariate parameters
mu_x <- 11.4009
sigma_x <- 24.67566
# profile membership and transition parameters
nu_0 <- -3.563
kappa_0 <- 0.122
alpha_0 <- -3.586
beta_00 <- 2.250
gamma_00 <- 0.063
gamma_10 <- 0.094
# trait parameters
psi_t <- 0.10 * diag(1)
mu_t <- 0
psi_p <- diag(p)
psi_p_1 <- 0.10
psi_p_2 <- 0.10
psi_p_3 <- 0.50
psi_p_4 <- 0.50
diag(psi_p) <- c(
psi_p_1,
psi_p_2,
psi_p_3,
psi_p_4
)
mu_p <- rep(x = 0, times = p)
common_trait_loading <- matrix(
data = 1,
nrow = p,
ncol = q
)
# state parameters
common_state_loading <- matrix(
data = 1,
nrow = p,
ncol = 1
)
phi_0 <- 0.000
phi_1 <- 0.311
psi_s0 <- 1.00
psi_s <- 0.25
theta <- 0.15 * diag(p)
# profile-specific means
mu_profile <- cbind(
c(2.253, 1.493, 1.574, 1.117),
c(-0.278, -0.165, -0.199, -0.148)
)
# data generation -----------------------------------------------------------
data <- GenCULTA2Profiles(
n = n,
m = m,
mu_x = mu_x,
sigma_x = sigma_x,
nu_0 = nu_0,
kappa_0 = kappa_0,
alpha_0 = alpha_0,
beta_00 = beta_00,
gamma_00 = gamma_00,
gamma_10 = gamma_10,
mu_t = mu_t,
psi_t = psi_t,
mu_p = mu_p,
psi_p = psi_p,
common_trait_loading = common_trait_loading,
common_state_loading = common_state_loading,
phi_0 = phi_0,
phi_1 = phi_1,
psi_s0 = psi_s0,
psi_s = psi_s,
theta = theta,
mu_profile = mu_profile
)
# model fitting -------------------------------------------------------------
# NOTE: Model fitting takes time
fit <- FitCULTA2Profiles(data = data)
logLik(fit, level = 0.95)
} # }