[R] error message in logistic regression
David Winsemius
dwinsemius at comcast.net
Fri Mar 30 17:16:58 CEST 2012
On Mar 30, 2012, at 8:12 AM, carlb1 wrote:
> Hi
> I am trying to do a logistic regression on a small data file yet
> when i get
> up to plotting the first set of graphs instead of 4 I only get one
> graph,
> and some error messages. Yet it still looks like the program is doing
> something due to the "blue wheel" of the mouse. Below is the script
> copied
> from R and where I get up to before the message occurs. The data
> set is
> based on how accurate dogs are at giving a trained response when
> finding
> drugs.
> D=dogs, P= phase of test, NF= number found, NTA= times they gave the
> trained
> alert, NA= times they did not give the alert, R= reliability in %
>
>> file.choose()
> [1] "E:\\Rhome exam\\question4\\table1Q4.txt"
>> tort<-read.table("E:\\Rhome exam\\question4\\table1Q4.txt")
At this point my brain said to itself... "this looks like a take-home
exam problem. I wonder what the academic policy is at this person's
institution about soliciting online help during exams?"
--
David.
>> tort
> D P NF NTA Na R
> 1 1 1 27 8 19 30
> 2 1 2 29 7 22 24
> 3 2 1 30 16 14 53
> 4 2 2 26 25 1 96
>> summary(glm(cbind(NTA,NF-NTA)~P,tort,family=binomial))
>
> Call:
> glm(formula = cbind(NTA, NF - NTA) ~ P, family = binomial, data =
> tort)
>
> Deviance Residuals:
> 1 2 3 4
> -1.339 -3.727 1.236 4.511
>
> Coefficients:
> Estimate Std. Error z value Pr(>|z|)
> (Intercept) -0.9671 0.6022 -1.606 0.1082
> P 0.6487 0.3830 1.694 0.0903 .
> ---
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> (Dispersion parameter for binomial family taken to be 1)
>
> Null deviance: 40.462 on 3 degrees of freedom
> Residual deviance: 37.556 on 2 degrees of freedom
> AIC: 54.505
>
> Number of Fisher Scoring iterations: 4
>
>> anova(glm(cbind(NTA,NF-NTA)~P,tort,family=binomial),test="Chisq")
> Analysis of Deviance Table
>
> Model: binomial, link: logit
>
> Response: cbind(NTA, NF - NTA)
>
> Terms added sequentially (first to last)
>
>
> Df Deviance Resid. Df Resid. Dev Pr(>Chi)
> NULL 3 40.462
> P 1 2.9064 2 37.556 0.08823 .
> ---
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>> par(mfrow=c(2,2))
>> plot(glm(cbind(NTA,NF-NTA)~P*factor(D)+Na,tort,family=binomial))
> Error in qqnorm.default(rs, main = main, ylab = ylab23, ylim =
> ylim, ...) :
> y is empty or has only NAs
> In addition: Warning messages:
> 1: Not plotting observations with leverage one:
> 1, 2, 3, 4
> 2: In min(x) : no non-missing arguments to min; returning Inf
> 3: In max(x) : no non-missing arguments to max; returning -Inf
>>
>
>
> I have tried multiple ways of swapping and changing the factors
> around in
> the equation yet I am still no further forward. Can anyone please
> help and
> give me a hint as to where im going wrong?
>
> Much appreciated in advance
>
> --
> View this message in context: http://r.789695.n4.nabble.com/error-message-in-logistic-regression-tp4518865p4518865.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list