Description Usage Arguments Value Examples
Carry out several short EM fits to test for optimal starting locations.
1 2 3 4 |
x |
An n-by-p design matrix. |
y |
A vector of observation of length n. |
b.init |
The method to initialize EM parameters. Built in methods are "random" and "fit" for pure white noise, and white noise around GLM estimates. Alternatively, pass a list of length K, each element consisting of a vector of length p. Users can also pass a zero-argument function to produce starting states. |
weight |
A n length vector of observation weight terms. This is currently designed to be either the exposure for a Poisson model or the number of trials for a Logistic model. |
K |
Number of EM classes to be fit. |
maxiter |
Maximum number of re-weighting rounds to do in fitting the EM model. Primarily used to perform the 'small.em' warm-up routine. |
tol.1 |
Escape tolerance of the Newton-Raphson step. |
tol.2 |
Escape tolerance of the re-weighting step. |
noise |
Standard deviation of the white noise to be applied when generating random initial states. |
sample.size |
Number of cases to randomly select from the input data. |
repeats |
Number of repetitions of the initialization to make. |
debug |
Returns step-size in NR and re-weighting steps as a message if TRUE. |
family |
GLM family to fit. |
method |
Control string. Set to 'numeric' or 'pracma'. |
maxiter.NR |
Maximum number of Newton-Raphson steps to take. |
A 'small.em' list containing the parameters, weights, log likelihood and BIC values.
1 2 3 4 5 6 7 8 9 10 | x <- model.matrix(~ factor(wool) + factor(tension), warpbreaks)
y <- warpbreaks$breaks
warm_up <- small.em(x = x, y = y, K = 2, b.init = "random", sample.size = 50)
summary(warm_up)
params <- select_best(warm_up)
m <- em.glm(x = x, y = y, K = 2, b.init = params)
summary(m)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.