[R] Odd coefficent behavior

Peter Ehlers ehlers at ucalgary.ca
Tue Jul 21 21:38:57 CEST 2009


Idgarad,

I guess that all of your factor variables are indicators with levels
"0" and "1". Try changing the levels to "NO", "YES" for one of the
variables and see what you get. I think that the output will clarify
the (actually not) "random" 1s.

  -Peter

Idgarad wrote:
> Why are my coefficients getting appended with a 1? It borks a match I
> do later against the original list that doesn't have the random 1
> added to the end.
> 
>> linearModel[[1]]
> 
> Call:
> lm(formula = modelSource ~ +UNITBUILD + UNITDB + ITBUILD + ITDB +
> UATBUILD + UATDB + HOGANCODE + RCF + ReleaseST1 + ReleaseST2 +
> ReleaseBLA + Small.Bank.Acquisitions + HLY.NewYear + HLY.MLK +
> HLY.PRES + HLY.MEMORIAL + HLY.J4 + HLY.LABOR + HLY.COLUMBUS +
> HLY.VETS + HLY.THANKS + HLY.XMAS + HLY.ELECT + HLY.PATRIOT +     EOM,
> data = mcReg)
> 
> Coefficients:
>              (Intercept)                UNITBUILD1                   UNITDB1
>                 405.8326                   -8.5675                   13.5029
>                 ITBUILD1                     ITDB1                 UATBUILD1
>                  33.0950                   -6.1938                    0.2625
>                   UATDB1                HOGANCODE1                      RCF1
>                  -3.7793                   -3.4825                    5.3243
>              ReleaseST11               ReleaseST21               ReleaseBLA1
>                  13.6911                   -9.4573                   -3.3526
> Small.Bank.Acquisitions1              HLY.NewYear1                  HLY.MLK1
>                  36.6445                  -92.5360                   22.1168
>                HLY.PRES1             HLY.MEMORIAL1                   HLY.J41
>                   7.1886                  -13.0013                  -14.3520
>               HLY.LABOR1             HLY.COLUMBUS1                 HLY.VETS1
>                  -0.9740                  -16.9177                   16.2969
>              HLY.THANKS1                 HLY.XMAS1                HLY.ELECT1
>                 -15.9056                  -65.9887                  -10.9916
>             HLY.PATRIOT1                      EOM1
>                 -20.2531                   15.4775
> 
> Now all the variables with a 1 appended are factors so is that normal
> behavior? (if so then I can adjust the match() command to pad a 1 to
> the master list.)
> 
> ______________________________________________
> 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