t1=p1*c1 p1 is the mean of a variable, c1 is the coefficient of a regression for this variable
t2=p2*c2 the same as t1 with a different variable
tot=t1+t2
I calculated the value of tot by the linear combinations of the numbers. My coauthor asked me to get the variance for the value of tot.
I created a bootstrap program to calculate the confidence intervals of tot, but there are many error messages. I am wondering whether I am at the right direction. Here are the codes
Code:
capture program drop bootc
program define bootc,rclass
drop quant p1 p2 c1 c2 t1 t2 tot
gen quant=40000
mean cond1
gen p1=r(mean)
mean cond2
gen p2=r(mean)
glm cost i.cond $char, family(gamma) link(log) le(95)
gen c1=_b[1.cond]
gen c2=_b[2.cond]
gen t1=quant*p1*c1
gen t2=quant*p2*c2
gen tot=t1+t2
end
simulate tot=r(tot), reps(4) seed(12345): bootc
estat bootstrap, all
0 Response to bootstrap to get the confidence intervals for a linear cobmination of regression coefficients
Post a Comment