Equivalent rxLogit() and glm() calls.

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.

 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)
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.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

Article ID: 3104219 - Last Review: 10/29/2015 06:32:00 - Revision: 1.0

Revolution Analytics

  • KB3104219