[R] Regression; how to get t-values for all parameters estimates

gzf200 at few.vu.nl gzf200 at few.vu.nl
Sat Jun 27 14:15:56 CEST 2009


Dear all,

Even after a couple of hours looking at old messages I still haven't found a
solution for my problem. 
I'm trying to fit an additive linear regression model with 2 effects, both
fixed, to some dataset. The function contrasts(effectA) <- contr.sum can
gaurantee that the coefficients per parameter sum to one, and the function
dummy.coef provices the estimates of all coefficientss. But I would also like to
be able to obtain the corresponding t-values for ALL parameters (not just the
number of effects minus 1, provided by summary()). Does anyone know how to get
(all of) them?  

Here comes what I've already tried:
## Try data:
> Data <- rbinom(1000,50,.9);
> Dates <- Sys.Date()-(1000:1)
> facweek <- factor(weekdays(Dates,abbreviate=TRUE))
> facmonth <- factor(months(Dates,abbreviate=TRUE))
> contrasts(facweek) <- contr.sum ;
> contrasts(facmonth) <- contr.sum ;
> fit <- lm(formula = Data ~ facweek + facmonth)  
> summary(fit)

Call:
lm(formula = Data ~ facweek + facmonth)

Residuals:
    Min      1Q  Median      3Q     Max 
-8.7498 -1.3774  0.1778  1.5108  5.1643 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 45.01452    0.06976 645.252   <2e-16 ***
facweek1    -0.37114    0.16836  -2.204   0.0277 *  
facweek2     0.40360    0.16836   2.397   0.0167 *  
facweek3    -0.19918    0.16885  -1.180   0.2384    
facweek4    -0.13689    0.16834  -0.813   0.4163    
facweek5    -0.07049    0.16835  -0.419   0.6755    
facweek6     0.40974    0.16836   2.434   0.0151 *  
facmonth1   -0.12046    0.22053  -0.546   0.5850    
facmonth2   -0.10832    0.26155  -0.414   0.6789    
facmonth3    0.25281    0.21731   1.163   0.2450    
facmonth4    0.40161    0.22627   1.775   0.0762 .  
facmonth5   -0.37409    0.21731  -1.721   0.0855 .  
facmonth6    0.06645    0.26155   0.254   0.7995    
facmonth7    0.13627    0.22509   0.605   0.5451    
facmonth8   -0.04789    0.21731  -0.220   0.8256    
facmonth9   -0.22910    0.21731  -1.054   0.2920    
facmonth10   0.11752    0.22053   0.533   0.5942    
facmonth11  -0.27233    0.21731  -1.253   0.2104    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 2.174 on 982 degrees of freedom
Multiple R-squared: 0.02673,    Adjusted R-squared: 0.009879 
F-statistic: 1.586 on 17 and 982 DF,  p-value: 0.06097 
> print(dummy.coef(fit),digits=3)
Full coefficients are 
                                                               
(Intercept):         45                                        
facweek:            Fri     Mon     Sat     Sun     Thu     Tue
                -0.3711  0.4036 -0.1992 -0.1369 -0.0705  0.4097
facmonth:           Apr     Aug     Dec     Feb     Jan     Jul
                -0.1205 -0.1083  0.2528  0.4016 -0.3741  0.0664
                                                               
(Intercept):                                                   
facweek:            Wed                                        
                -0.0357                                        
facmonth:           Jun     Mar     May     Nov     Oct     Sep
                 0.1363 -0.0479 -0.2291  0.1175 -0.2723  0.1775




More information about the R-help mailing list