[R] Logistic regression

2012-03-28 Thread carlb1
Hi

does anyone know how to do a logistic regression in R? 

any help appreciated 

Carl

--
View this message in context: 
http://r.789695.n4.nabble.com/Logistic-regression-tp4512658p4512658.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] error message in logistic regression

2012-03-30 Thread carlb1
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")
> tort
   D  P NF NTA Na  R
1  1 1  27   8  19  30
2  1 2 29   722 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@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.


Re: [R] error message in logistic regression

2012-03-30 Thread carlb1
I wont lie it is for a home exam yes and i know that i need to do a logistic
regression on this data set I have already done one on another data set and
i am just asking how to overcome the problem in R. 

--
View this message in context: 
http://r.789695.n4.nabble.com/error-message-in-logistic-regression-tp4518865p4519416.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] Uploading into R

2012-02-03 Thread carlb1
Hi 

I am just starting out in R and im trying to upload some data into it. I
have saved a small file from excel as a .txt file in the working directory i
am using in a folder of the same name as the .txt file. When i write the
function to open it I keep getting this message 

> snow<-read.table("working directory")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'working directory': Permission denied

I cant seem to get any help on the internet to what I am doing wrong and
what does this mean? 

any help appreciated 

C

--
View this message in context: 
http://r.789695.n4.nabble.com/Uploading-into-R-tp4354538p4354538.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Uploading into R

2012-02-03 Thread carlb1
Thank you very much its appreciated 

--
View this message in context: 
http://r.789695.n4.nabble.com/Uploading-into-R-tp4354538p4354960.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.