[R] using categorical variable in multiple regression

Weidong Gu anopheles123 at gmail.com
Sun Jun 12 15:35:37 CEST 2011


for categorical independent variables, regression models in R will
generate dummy indicators based on your setting of contrasts (default
contr.treatment). Use model.matrix(your model) to see how R does this
internally.

Weidong Gu

On Sun, Jun 12, 2011 at 2:38 AM, setlist <yespuppy90 at hanmail.net> wrote:
> Hello, I wanted to do the multiple regression on categorical predictor data
> there's variable x1,x2,x3 and x3 is categorical one.
> so i just used as.factor(x3) and then ran multiple regression
> is it a good way to do the multiple regression on categorical predictor
> data?
> and how can I interpret the estimates?
> also if using as.factor is a good way, is there any difference with doing
> dummy coding for categorical variable and then running regression?
> Thanks.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/using-categorical-variable-in-multiple-regression-tp3591517p3591517.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.
>



More information about the R-help mailing list