r - contrasts error in linear model with one dependent variable and four independent variables -
i new r coding. trying build linear model as:
lmmodel <- lm(dv ~ iv1 + iv2 + iv3 + iv4)
i have dependent variable money data type (decimal value) , 4 independent variables, mixture of categorical , date:
issuancedate region account clientname price 01-01-2015 south account1 abc 02-01-2015 north account2 na 03-01-2015 northeast account3 bcd 04-01-2015 southeast account4 na 05-01-2015 na account5 m/sbedf 06-01-2015 west account6 campus ltd 07-01-2015 southwest account7 offshoreltd 08-01-2015 northwest account8 sitenew
price predicted. see below error:
error in contrasts<-(tmp, value = contr.funs[1 + isof[nn]]) : contrasts can applied factors 2 or more levels
you haven't given price
in example data, but: problem once rows containing na
removed data set, 1 of categorical dependent variables no longer has more single level. can't fit model using categorical variable single level ...
Comments
Post a Comment