[R] Odd coefficent behavior

David Winsemius dwinsemius at comcast.net
Tue Jul 21 21:11:27 CEST 2009


On Jul 21, 2009, at 2:42 PM, 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]]

The linearModel function that is easiest to find appears (on the basis  
of its help page anyway) to be designed as a dialog control function  
rather than to be used in the manner you are illustrating. Of course I  
could be wrong about which package you are using, and the the  
appropriate use of linearModel, but why not see if you don't get more  
expected results with:

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)


>
> 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list