Description Usage Arguments Value See Also Examples
View source: R/1-onlineLogMixture.R
This function allows you to initialize an online logistic regression
model. After initialization by providing the model description (in terms of
the number of predictors $p$ of each logistic regression model and the number
of mixture components $k$) one can use the add.observation
method to add observations and update the parameters and call the summary()
and plot()
methods.
1 2 | online_log_mixture(p, k, beta = matrix(runif(k * p, -1, 1), nrow = k),
ak = generate_probability_vector(k), ll.window = 500, trace = FALSE)
|
p |
Number of predictors for each logistic regression model |
k |
Number of mixture components |
beta |
A $k$ by $p$ matrix with the true regression coefficients for each mixture component |
ak |
A vector of length $k$ summing to 1 for the mixture probabilties |
ll.window |
The length of the (lagged) mean log-likelihood window |
trace |
Whether or not the parameter estimates and the lagged mean log likelihood should be traced
can be set to an integer, $x > 0$, and it will store a snapshot every x-th datapoint.
WARINING: when using |
An object of class "online_log_mixture" The object contains the following slots:
params
A list containing all the parameters of the model. Contains the objects beta
, Sak
, n
descriptives
A list containing the (lagged) mean log-likelihood, the max log-likelihood, and the AIC and BIC approximations
trace
A list containing the trace of each of the parameters
For more detailed examples see add_observation
1 2 | online_log_mixture(3,2)
online_log_mixture(2,4, ak=c(.1,.2,.3,.4), trace=100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.