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

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 link

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.

--------------Solutions-------------

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)

Category:r Time:2011-08-12 Views:0
Tags: stata glm

Related post

  • regular expression: How do I limit to one result per match 2010-10-29

    I'm using a simple regular expression on some text data. The expression seems to work fine. The problem I need to get around now, is to only return one result per match as seen in desired matches below. Of course the data would be much larger than th

  • How to highlight jQuery Autocomplete results that match the text already typed? 2011-08-22

    I've implemented jQuery Autocomplete for a client. Now they want me to highlight (e.g. make bold) the the portion of the result that matches the text they've typed. e.g. the user types "something", and the results are as follows: something a somethin

  • I want my search to only show results with matching field values. How is this done? 2011-10-25

    I want my search to only display results that match values in the same row. I have two search fields: 'search' and 'search term' the field names in my database are name lastname email So for example: If i search 'mike' in 'search' and 'smith' in 'sea

  • if result.responseText.match not exist 2012-01-23

    i don't know mutch about javascript but i found this greasemonekey script that i'm trying to edit. var rating = document.links; for (i = 0; i < rating.length; i++) { if (rating[i].href.indexOf("/shows/") != -1){ GM_xmlhttpRequest({ method: 'get',

  • Incorrect results using MATCH with TIMEVALUE even when using ROUND 2013-11-03

    I'm getting incorrect results using MATCH with TIMEVALUE even when using ROUND Cells A1:A3 = 3:14:00 PM 3:14:01 PM 3:14:02 PM Cell B1 = =MATCH(ROUND(TIMEVALUE("3:14:00 PM"),15),A1:A3) returns the incorrect result #N/A Change the TIMEVALUE to "3:14:01

  • Conditional Logistic Regression - detailed examples 2010-01-25

    anyone has online resources / book references that has detailed tutorials/examples on setting up Conditional Logistic Regression ? (Preferably in R, Matlab or Python) --------------Solutions------------- Look for clogit function in this page (for R)

  • Logistic Regression in R (SAS-like output) 2010-08-09

    I have a problem at hand which I'd think is fairly common amongst groups were R is being adopted for Analytics in place of SAS. Users would like to obtain results for logistic regression in R that they have become accustomed to in SAS. Towards this e

  • Categorical Logistic Regression, library 2011-04-14

    I'm currently working on a project concerning segmentation of geographical regions based on the plants that grow in each, over multiple significant layers (that is to say, each segmentation layer has a meaning that is unique wrt the other layers) In

  • Step by step procedure on how to run nested logistic regression in R 2011-05-06

    Please provide me with detailed (as possible) steps on how to do nested logistic regression in R. I'm new to R so it would help me a lot if i can get a detailed answer. We tested how fisher's decision to exit the fishery is affected by different soci

  • Avoiding a for loop in R in an attempt to evaluate percentage of true positives/negatives when using logistic regression 2011-07-20

    What I got: A matrix where I got the predicted probability of an outcome (from a logistic regression model) and the known outcome. For those curious I actually got two regression models and an independent test dataset where I wish to compare these tw

  • Logistic Regression Using R 2011-09-01

    I am running logistic regressions using R right now, but I cannot seem to get many useful model fit statistics. I am looking for metrics similar to SASS: http://www.ats.ucla.edu/stat/sas/output/sas_logit_output.htm Does anyone know how (or what packa

  • How to perform likelihood ratio test on logistic regression in SAS? 2011-10-12

    I want to perform the standard likelihood ratio test in logsitic regression using SAS. I will have a full logistic model, containing all variables, named A and a nested logistic model B, which is derived by dropping out one variable from A. If I want

  • Predicted values for logistic regression from glm and stat_smooth in ggplot2 are different 2012-01-13

    I'm trying to make this logistic regression graph in ggplot2. df <- structure(list(y = c(2L, 7L, 776L, 19L, 12L, 26L, 7L, 12L, 8L, 24L, 20L, 16L, 12L, 10L, 23L, 20L, 16L, 12L, 18L, 22L, 23L, 22L, 13L, 7L, 20L, 12L, 13L, 11L, 11L, 14L, 10L, 8L, 10L

  • Automatic selection of gcc compiler optimization using Logistic Regression model 2012-02-12

    I'm doing a project based on selection of optimization options for gcc compiler using an algorithm called LRM (Logistic Regression Model) based on this paper... http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=5066672 . In this algorithm, Firs

  • Plot two curves in logistic regression in R 2012-02-13

    I am running logistic regression in R (glm). I then manage to plot the result. My code is as follow: temperature.glm = glm(Response~Temperature, data=mydata,family=binomial) plot(mydata$Temperature,mydata$Response, ,xlab="Temperature",ylab="Probabili

  • R: Bayesian Logistic Regression for Hierarchical Data 2012-02-24

    This is a repost from stats.stackexchange where I did not get a satisfactory response. I have two datasets, the first on schools, and the second lists students in each school who have failed in a standardized test (emphasis intentional). Fake dataset

  • Confidence intervals for predictions from logistic regression 2013-01-20

    In R predict.lm computes predictions based on the results from linear regression and also offers to compute confidence intervals for these predictions. According to the manual, these intervals are based on the error variance of fitting, but not on th

  • Bootstrap aggregation (bagging) of logistic regression classifiers 2014-02-13

    So I'm taking N bootstrap samples and training N logistic regression classifiers on these samples. Each classifier gives me some probability of being in a binary class and then I average these N probabilities to get a final prediction. My question is

  • Model Fit statistics for a Logistic Regression 2010-07-26

    I'm running a logistic regression model in R. I've used both the Zelig and Car packages. However, I'm wondering if there is a simple way to get the model fit statistics for the model. (pseudo R-square, chi-square, log liklihood,etc) --------------Sol

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.586 (s). 13 q(s)