[R] contrasts error message in lm

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jul 31 22:29:18 CEST 2007


On Tue, 31 Jul 2007, A Serebrenik wrote:

> Dear all,
>
> I would like to find a linear regression model for a rather large dataset
> (27 independent variables). However, when I run lm the following error is
> reported:
>
>> out <- lm(Result ~ AppealA + AppealsB + AppealC + AppealD + AppealE +
> Apply + ApplyAmount + Aprove + Closecase + Decidelocally + Healthassessment +
> HealthassessmentHealth + Postponedecision + Propertyassessment + PropertyassessmentPropertyvalue
> + RejectA + RejectB + RejectC + RejectD + RejectE + Reportacceptance +
> + ReportrejectionA + ReportrejectionB + ReportrejectionC + ReportrejectionD +
> + ReportrejectionE + Timeout)
>
> Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") :
>         contrasts can be applied only to factors with 2 or more levels
>
>
> I've checked the documenation but somehow I fail to find an explanation
> what does it mean...

So one of your 'variables' isn't: it is a factor with only one level?

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list