if (FALSE) {
set.seed(1)
MTD <- MTDmodel(Lambda = c(1, 3), A = c(0, 1), lam0 = 0.01)
X <- perfectSample(MTD, N = 200) # small N to keep examples fast
init <- list(
p0 = c(0.4, 0.6),
lambdas = c(0.05, 0.45, 0.5),
pj = list(
matrix(c(0.2, 0.8, 0.45, 0.55), byrow = TRUE, ncol = 2),
matrix(c(0.25, 0.75, 0.3, 0.7), byrow = TRUE, ncol = 2)
)
)
fit <- MTDest(X, S = c(1, 3), init = init, iter = TRUE)
print(fit)
summary(fit)
coef(fit) # Works by inheritance
logLik(fit)
BIC(fit)
}
Run the code above in your browser using DataLab