Hello,

Is there an example out there that shows how to treat each of the predictor
variable types when doing logistic regression in R? Something like this:

glm(y~x1+x2+x3+x4, data=mydata, family=binomial(link="logit"),
na.action=na.pass)

I'm drawing mostly from:
http://www.ats.ucla.edu/stat/r/dae/logit.htm

...but there are only two types of variable in the example given. I'm
wondering if the answer is that easy or if I have to consider more with
different types of variables. It seems like as.factor() is doing a lot of
the organization for me.

I will need to understand how to perform logistic regression in R on all
data types all in the same model (potentially).

As it stands, I think I can solve all of my data type issues with:

as.factor(x,ordered=T) ...for all discrete ordinal variables
as.factor(x, ordered=F) ...for all discrete nominal variables
...and do nothing for everything else.

I'm pretty sure its not that simple because of some other posts I've seen,
but I haven't seen a post that discusses ALL data types in logistic
regression.

Here is what I think will work at this point:

glm(y ~ **all_other_vars + as.factor(disc_ord_var,ordered=T) +
as.factor(disc_nom_var,ordered=F), data=mydata,
family=binomial(link="logit"), na.action=na.pass)

I'm also looking for any best practices help as well. I'm new'ish to
R...and oddly enough I haven't had the pleasure of doing much regression R
yet.

Regards,

Ben

        [[alternative HTML version deleted]]

______________________________________________
[email protected] 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.

Reply via email to