Skip to content
Prev 308532 / 398506 Next

se's and CI's for fitted lines in multivariate regression analysis

On Oct 16, 2012, at 11:58 AM, Sigrid wrote:

            
The SE's for treatment "slope" will vary depending on the colpos values. Using `predict`, pick the mid-point of the colpos and rowpos variables (which is where the SE of the estimates will be minimized). This should be covered in any basic regression text.

model<-lm(decrease ~ rowpos  + colpos + treatment + treatment:colpos + 0, data=OrchardSprays)

# I do not think the use of the non-intercept version matters here and it's not in general a good practice, but it allows all the parameters to be labeled as you apparently expect.

predict(model, newdata=data.frame(colpos=4.5, treatment=unique(OrchardSprays$treatment), rowpos=mean(OrchardSprays$rowpos) ), se.fit = TRUE, interval = "confidence")
$fit
     fit        lwr       upr
1 35.000  20.331646  49.66835
2 63.125  48.456646  77.79335
3  7.625  -7.043354  22.29335
4 90.250  75.581646 104.91835
5 68.500  53.831646  83.16835
6 69.000  54.331646  83.66835
7 25.250  10.581646  39.91835
8  4.625 -10.043354  19.29335

$se.fit
       1        2        3        4        5        6        7        8 
7.291375 7.291375 7.291375 7.291375 7.291375 7.291375 7.291375 7.291375 

$df
[1] 47

$residual.scale
[1] 20.62312
[1] D E B H G F C A
Levels: A B C D E F G H
A      B      C      D      E      F      G      H 
 4.625  7.625 25.250 35.000 63.125 69.000 68.500 90.250