# standard error for difference in prediction using R

I want to calculate standard error for difference between two predictions, but have little idea.

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!

• It depends on the model: what kind of object is hsg_prob? – whuber Mar 23 '20 at 21:46
• @whuber hsg_prob is a probit model. This is to examine if the tax credit policy adoption increases the labor force participation (LFP) of the treatment group. Basically the difference is therefore LFP of the treatment group minus that of the control group. I want to have the standard error of that difference! – Girim Ban Mar 23 '20 at 23:20
• Please explain that by editing your post. – whuber Mar 24 '20 at 14:05