My name is Kuda Makoni from the University of Malawi and i wanted to ask a basic stata question
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?
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.
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?
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
==>
y-3.4-0.89b_2=0.58b_1
So,
y1-3.4-0.89b_2=0.58(b_1+0.9)
-
y0-3.4-0.89b_2=0.58b_1
=> y1-y0=0.58*0.9
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?
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
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.