Code: Select all
Error in apollo_makeLogLike(apollo_beta, apollo_fixed, apollo_probabilities, :
When using weights, apollo_weighting should be called inside apollo_probabilities.
Thanks!
Code: Select all
Error in apollo_makeLogLike(apollo_beta, apollo_fixed, apollo_probabilities, :
When using weights, apollo_weighting should be called inside apollo_probabilities.
Code: Select all
model = apollo_estimate(apollo_beta, apollo_fixed,
apollo_probabilities_class, apollo_inputs,
estimate_settings=list(writeIter=FALSE,silent=TRUE,hessianRoutine="none"))
Code: Select all
apollo_probabilities_class=function(apollo_beta, apollo_inputs, functionality="estimate"){
### Attach inputs and detach after function exit
apollo_attach(apollo_beta, apollo_inputs)
on.exit(apollo_detach(apollo_beta, apollo_inputs))
### Create list of probabilities P
P = list()
### Load posterior class allocation probabilities from inputs
h_1=apollo_inputs$h1
h_2=apollo_inputs$h2
h_3=apollo_inputs$h3
h_4=apollo_inputs$h4
h_grouped=list(h_1,h_2,h_3,h_4)
### Take logs of class allocation probabilities
log_pi_values=lapply(pi_values,log)
### Define model that aims to minimise difference between posterior and unconditional class allocation probabilities
P[["model"]]=exp(Reduce('+', mapply('*',h_grouped,log_pi_values,SIMPLIFY = FALSE)))
### Prepare and return outputs of function
P = apollo_prepareProb(P, apollo_inputs, functionality)
return(P)
}