Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Equivalent rxLogit() and glm() calls.


View products that this article applies to.

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.

↑ Back to the top


Keywords: kb

↑ Back to the top

Article Info
Article ID : 3104219
Revision : 1
Created on : 1/7/2017
Published on : 10/29/2015
Exists online : False
Views : 58