Hi, If your predictor variable is categorical than it should be converted to a factor. If it is continuous or being treated as such, you do not need to. It is generally quite easy to do:
varname <- factor(varname) or if it is in a data frame yourdf$varname <- factor(yourdf$varname) Cheers, Josh On Thu, Sep 9, 2010 at 8:09 AM, karena <dr.jz...@gmail.com> wrote: > > Hi, thank you very much for the help. > one more quick question: is that, my predictor variable should be coded as > 'factor' when using either 'lm' or 'glm'? > > sincerely, > > karena > -- > View this message in context: > http://r.789695.n4.nabble.com/regression-function-for-categorical-predictor-data-tp2532045p2533035.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. > -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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.