[R] lm regression

Joshua Wiley jwiley.psych at gmail.com
Fri Nov 26 21:38:38 CET 2010


Can you create a small example that replicates your problem?  If not,
at least send the code you are running right before R throws an error
(e.g., the exact call to lm) and some basic information on your data
like the class of each variable and the number of observations.

Is your outcome variable, Y, a factor?  That is what the warning
suggests (model.response extracts the response (outcome, the variable
on the left side of the ~ ) variable from your model.

HTH,

Josh

On Fri, Nov 26, 2010 at 6:06 AM, effeesse <scarpino86 at gmail.com> wrote:
>
> I found one error in in the code, however, I still receive errors.
>
> Error in storage.mode(y) <- "double" :
>  invalid to change the storage mode of a factor
> Moreover: Warning message:
> In model.response(mf, "numeric") :
>  using type="numeric" with a factor response will be ignored
>
> >From my understanding of the warning there are two errors, maybe they are
> connected. I think I should change an option in the lm changing the responso
> from "numeric" to "factor". Is it true? How it can be done?
> --
> View this message in context: http://r.789695.n4.nabble.com/lm-regression-tp3060123p3060363.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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list