[R] Error logistic analysis

2014-04-08 Thread lghansse
I'm trying to conduct a single level logistic analysis (as a beginning step
for a more advanced Multi-level analysis). However, when I try to run it, I
get following error:

Warning messages:
1: In model.response(mf, numeric) :
  using type = numeric with a factor response will be ignored
2: In Ops.factor(y, z$residuals) : - not meaningful for factors

I haven't got a clue why I'm getting this because I used the exact same
syntax (same data preparation etc...) for a similar analysis (same
datastructure, different country). 

Syntax: 
Single_model1 - lm(openhrs1 ~ genhealt1 + age + sexpat1 + hhincome1 +
edupat1 
+ etniciteit1, data=Slovakije)

My Missing data are coded as such, I already tried to run the analysis in a
data frame without the missing cases, but that didn't work either. 



--
View this message in context: 
http://r.789695.n4.nabble.com/Error-logistic-analysis-tp4688385.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 logistic analysis

2014-04-08 Thread Marc Schwartz

On Apr 8, 2014, at 7:20 AM, lghansse lise.hanss...@ugent.be wrote:

 I'm trying to conduct a single level logistic analysis (as a beginning step
 for a more advanced Multi-level analysis). However, when I try to run it, I
 get following error:
 
 Warning messages:
 1: In model.response(mf, numeric) :
  using type = numeric with a factor response will be ignored
 2: In Ops.factor(y, z$residuals) : - not meaningful for factors
 
 I haven't got a clue why I'm getting this because I used the exact same
 syntax (same data preparation etc...) for a similar analysis (same
 datastructure, different country). 
 
 Syntax: 
 Single_model1 - lm(openhrs1 ~ genhealt1 + age + sexpat1 + hhincome1 +
 edupat1 
 + etniciteit1, data=Slovakije)
 
 My Missing data are coded as such, I already tried to run the analysis in a
 data frame without the missing cases, but that didn't work either. 


You are using the lm() function above, which is a regular least squares linear 
regression for a continuous response variable.

If you want to run a logistic regression, you need to use glm() with 'family = 
binomial':

Single_model1 - glm(openhrs1 ~ genhealt1 + age + sexpat1 + hhincome1 +
 edupat1 + etniciteit1, family = binomial, data = Slovakije)


Regards,

Marc Schwartz

__
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.