Running an rxLogit() function that may be expected to be equivalent to a glm() and rxGlm() call on the same data may return different results than expected.
In the following simple example, the coefficients returned by glm() and rxGlm() will match but those returned by rxLogit() may be different.
The key is to set initialValues = NA in rxLogit().
For rxLogit, initialValues defaults to NULL. From the help for rxLogit: "The initial values will be estimated based on a linear regression. This can speed up convergence significantly in many cases. If the model fails to converge using these values, estimation is automatically re-started using the NA option for the initial values." If NA is used, "Initial values of the parameters are computed by a weighted least squares step". For rxGlm, initialValues defaults to NA.
So if the results from rxLogit are unexpectedly different, it may be that the model does converge with initialValues=NULL and the function returns different results. When running the example with initalValues=NA in the rxLogit(), all results match.
In the following simple example, the coefficients returned by glm() and rxGlm() will match but those returned by rxLogit() may be different.
myFormula <- as.formula("y ~ x1 + x2 + x3 ")
model <- rxLogit( myFormula, data = sampleData)
modelGLM <- glm(myFormula,family=binomial(logit),data=sampleData)
modelrxGLM <- rxGlm(myFormula,family=binomial(logit), data=sampleData)
For rxLogit, initialValues defaults to NULL. From the help for rxLogit: "The initial values will be estimated based on a linear regression. This can speed up convergence significantly in many cases. If the model fails to converge using these values, estimation is automatically re-started using the NA option for the initial values." If NA is used, "Initial values of the parameters are computed by a weighted least squares step". For rxGlm, initialValues defaults to NA.
So if the results from rxLogit are unexpectedly different, it may be that the model does converge with initialValues=NULL and the function returns different results. When running the example with initalValues=NA in the rxLogit(), all results match.