mvtll
Group-based multivariate trajectories
mvtll(y, x, beta, sig, prob)
mvtem(y, x, beta, sig, prob, maxit = 500, tol = 1e-08)The group-based trajectory model with several normal indicators per unit
(Nagin 1999; Magrini 2022): given group k, the r indicators of a unit
at period t are multivariate normal with mean B_k' x_t and covariance
S_k, independently over periods. mvtll() evaluates the
log-likelihood and posterior memberships; mvtem() fits by EM with
closed-form steps from the values given. A period with any missing
indicator is left out for that unit.
Parameters
Section titled “Parameters”yThe indicators: an array of units by periods by indicators;
NAallowed, not infinite values.xThe design: a matrix with one row per period.
betaThe coefficients: an array of design columns by indicators by groups.
sigThe covariances: an array of indicators by indicators by groups, each positive definite.
probThe group shares: positive numbers summing to 1.
maxitThe most iterations: a whole number from 1.
tolStop when an iteration gains at most
tol (1 + |ll|).
Returns
Section titled “Returns”mvtll(): a list of ll and post. mvtem(): a list of the
fitted beta, sig, prob, post, ll and iter.
References
Section titled “References”Magrini, A. (2022). Assessment of agricultural sustainability in European Union countries: a group-based multivariate trajectory approach. AStA Advances in Statistical Analysis, 106. doi:10.1007/s10182-022-00437-9
Examples
Section titled “Examples”set.seed(1)x <- cbind(1, 1:5)y <- array(rnorm(40 * 5 * 2), c(40, 5, 2))y[1:20, , 1] <- y[1:20, , 1] + 3b <- array(c(0, 0, 0, 0, 3, 0, 0, 0), c(2, 2, 2))s <- array(diag(2), c(2, 2, 2))mvtem(y, x, b, s, prob = c(0.5, 0.5))$probGenerated from the R help page: mvtll in the R reference.