I want to calculate standard error for difference between two predictions, but have little idea.
Please see the code below:
pred <- predict(hsg_prob, newdata=data.frame("three_kids" = 1,
"post_arra" = c(0,1),
"three_x_arra" = c(0,1)),
se.fit = TRUE,
type = "response")
pred
This gives me
$fit
1 2
0.7469388 0.7578797
$se.fit
1 2
0.01388808 0.01621392
$residual.scale
[1] 1
What I am interested in is the standard error of pred$fit[2]
-pred$fit[1]
, which is the standard error of these two predictions 0.7578797
- 0.7469388
I also tried using diff(pred)
, but it doesn't come out with a standard error.
Is there any easy way to calculate standard error for this?
Thanks!
hsg_prob
? $\endgroup$ – whuber♦ Mar 23 '20 at 21:46