[R] Outliers in Binary Logistic Regressions
arun
smartpink111 at yahoo.com
Thu Sep 6 00:43:35 CEST 2012
Hi,
Not sure how your data looks like. With the sample data below, the code works.
Try this:
set.seed(1)
dat1<-data.frame(MIGRATION=sample(c(0,1),100,replace=TRUE),distance=sample(40:80,100,replace=TRUE))
RR.rebuild<-glm(MIGRATION~distance,data=dat1,subset=!(1:100 %in% c(56,23,20,9,19)),family=binomial(link="logit"))
RR.rebuild
#Call: glm(formula = MIGRATION ~ distance, family = binomial(link = "logit"),
# data = dat1, subset = !(1:100 %in% c(56, 23, 20, 9, 19)))
#Coefficients:
#(Intercept) distance
#-0.0781611 -0.0004483
#Degrees of Freedom: 94 Total (i.e. Null); 93 Residual
#Null Deviance: 131.4
#Residual Deviance: 131.4 AIC: 135.4
A.K.
----- Original Message -----
From: Marcus Tullius <tullius at europe.com>
To: r-help at r-project.org
Cc:
Sent: Wednesday, September 5, 2012 3:42 PM
Subject: [R] Outliers in Binary Logistic Regressions
Hallo folks,
I know I should not ask the same question again. But I have a problem I cannot solve and without the solution I am stuck and lost, unable to get along with my work!
Someone suggested I should try the code below in order to eliminate the outliers from my data. I did as I was told, but I got a negative reply. The code did not function. I am including it here so that, if possible, someone may correct it for me. That would really be very much appreciated!
My data has 1439 rows.
*RR.rebuild <- glm(RR, subset=remove)
glm(RR, subset=!(1:1439 %in% c(56,303,365,391,512,746,859,940,1037,1042,1138,1355))
influence(RR.rebuild)
influence.measures(RR.rebuild)*
Many thanks in advance for any help and sorry for being annoyingly persistent!
Francisco
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list