FYI: modelQ2_1 is a mixed logit model
coef(modelQ2_1)[c("cl","sd.cl")]
pnorm(0,mean = (coef(modelQ2_1)["cl"]), sd= (coef(modelQ2_1["sd.cl"])))
# Error in pnorm(0, mean = (coef(modelQ2_1)["cl"]), sd = (coef(modelQ2_1["sd.cl"]))) :
# Non-numeric argument to mathematical function
However, when I check the class for the argument , both arguments are numeric.
When i try this due to the error:
pnorm(0,mean = as.numeric(coef(modelQ2_1)["cl"]), sd= as.numeric(coef(modelQ2_1["sd.cl"])))
The output is
numeric(0)
instead of an answer.
Instead I have to resort to this code:
pnorm(0, mean = (modelQ2_1$coefficients["cl"]), sd = (modelQ2_1$coefficients["sd.cl"]))
The above code works fine. However, they are the same, aren’t it?
New contributor
Alex Chua is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.