开发者

Stata and R results not matched in Logistic Regression with two categorical predictors and their interaction [closed]

开发者 https://www.devze.com 2023-03-28 00:37 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I am getting confused when i am trying to compare the results of Stata and R. I am using example given on the webpage http://www.ats.ucla.edu/stat/stata/webbooks/logistic/chapter2/default.htm First run the following command in Stata

use http://www.ats.ucla.edu/stat/stata/webbooks/logistic/apilog, clear

and then use following commands given in the section (2.2.2 A 2 by 2 Layout with Main Effects and Interaction)

generate cred_ed = cred_hl*pared_hl
logit hiqual cred_hl pared_hl cred_ed

These two command will produce the results given on the webpage.

And then i have used following R code to reproduce same example

Data<- read.csv("Book1.csv",header=T)
data.glm<-glm(hiqual~cred_hl + pared_hl + cred_hl*pared_hl,family=binomial,  data=Data)
summary(data.glm)

But results are not matched!

Data file for R can be download from following l开发者_C百科ink

https://spreadsheets.google.com/spreadsheet/ccc?key=0Ajt182RLsguldFlLQmd6Z1ZoczJCenJIdmREUkhxTFE&hl=en_US

Note: Results for model with only main effects are matched but when we include interaction, it is not matched.

Thanks in Advance.


They give the same results to me (using ucla's data).

library(foreign)
d1 <- read.dta('http://www.ats.ucla.edu/stat/stata/webbooks/logistic/apilog.dta')
m1 <- glm(hiqual~cred_hl + pared_hl + cred_hl*pared_hl,family=binomial,  data=d1)
0

精彩评论

暂无评论...
验证码 换一张
取 消