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")


This gives me

        1         2 
0.7469388 0.7578797 

         1          2 
0.01388808 0.01621392 

[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?


  • $\begingroup$ It depends on the model: what kind of object is hsg_prob? $\endgroup$ – whuber Mar 23 '20 at 21:46
  • $\begingroup$ @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! $\endgroup$ – Girim Ban Mar 23 '20 at 23:20
  • $\begingroup$ Please explain that by editing your post. $\endgroup$ – whuber Mar 24 '20 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.