02132016 06:30 PM
My name is Kuda Makoni from the University of Malawi and i wanted to ask a basic stata question
02132016 09:01 PM
02252016 12:01 PM
How do i do that basically what i am trying to do is
simulation but i am not sure how to do the code. I have a linear equation
y=c+0.05X1+1.28X2
so here i am trying to obtain the values of y and b2 when I fix b1 first at 2 then 0
How do i do that?
02132016 10:51 PM
So you have a function
y(b_1, b_2) = 3.4 + 0.58b_1 + 0.89b_2,
define a new function as
dy(b_1, b_2) = y(b_1, b_2 + 0.9)  y(b_1, b_2)
choose a range for b_1 and b_2, and a resolution db for your simulation
Calculate the values of dy
data simul;
low_b_1 = 0;
high_b_1 = 3;
low_b_2 = 2;
high_b_2 = 2;
db = 0.1;
do b_1 = low_b_1 to high_b_1 by db;
do b_2 = low_b_2 to high_b_2 by 1;
dy = 3.4 + 0.58*b_1 + 0.89*(b_2+0.9)  (3.4 + 0.58*b_1 + 0.89*b_2);
output;
end;
end;
keep b_1 b_2 dy;
run;
Plot the results with proc sgplot or sgpanel.
proc sgplot data=simul;
series y=dy x=b_1 / group=b_2;
run;
proc sgpanel data=simul;
panelby b_2;
series y=dy x=b_1;
run;
Of course, the results will not look very interesting unless dy is not a constant function... but you get the idea.
02252016 12:02 PM
I am so confused right now i am just trying to do a simulation but i am not sure how to do the code. I have a linear equation
y=c+0.05X1+1.28X2
so here i am trying to obtain the values of y and b2 when I fix b1 first at 2 then 0
How do i do that?
02142016 08:20 PM
It is totally depended on the coefficient of b_1 ( 0.58 ), since you don't care about other covariables.
y=3.4+0.58b_1 +0.89b_2
==>
y3.40.89b_2=0.58b_1
So,
y13.40.89b_2=0.58(b_1+0.9)

y03.40.89b_2=0.58b_1
=> y1y0=0.58*0.9
02252016 12:03 PM
I am a bit confused the only thing i am trying to do is a simulation but i am not sure how to do the code. I have a linear equation
y=c+0.05X1+1.28X2
so here i am trying to obtain the values of y and b2 when I fix b1 first at 2 then 0
How do i do that?
02252016 08:37 PM
02252016 09:26 PM
I am trying to run a multiple regression analysis where i set beta 1 to a certain value then see what happens to x2 and y