apollo_lc {apollo} | R Documentation |
Using the conditional likelihoods of each latent class, as well as teir classification probabilities, calculate the weighted likelihood of the whole model.
apollo_lc(lc_settings, apollo_inputs, functionality)
lc_settings |
List of arguments used by
|
apollo_inputs |
List grouping most common inputs. Created by function apollo_validateInputs. |
functionality |
Character. Can take different values depending on desired output.
|
The returned object depends on the value of argument functionality
as follows.
"estimate": vector/matrix/array. Returns the probabilities for the chosen alternative for each observation.
"prediction": List of vectors/matrices/arrays. Returns a list with the probabilities for all alternatives, with an extra element for the chosen alternative probability.
"validate": Boolean. Returns TRUE if all tests are passed.
"zero_LL": vector/matrix/array. Returns the probability of the chosen alternative when all parameters are zero.
"conditionals": Same as "prediction".
"output": Same as "estimate" but also writes summary of choices into temporary file (later read by apollo_modelOutput
).
"raw": Same as "prediction".
data(apollo_modeChoiceData) database <- apollo_modeChoiceData rm(apollo_modeChoiceData) N <- nrow(database) lc_settings <- list(inClassProb=list(rnorm(N), rnorm(N)), classProb=list(stats::runif(N), stats::runif(N))) apollo_control <- list(indivID="ID") x <- apollo_lc(lc_settings, apollo_control, functionality="estimate") summary(x)