BookmarkSubscribeRSS Feed
khalillx
Fluorite | Level 6

In my simulation exercise I have to change the error term in my code from 

data samples;
do samp = 1 to 1000;
do t = 1 to 100;
u = rannor(1996)*5;
x = 100 + 3*rannor(6991);
y = 10 + 0.5*x + u;
output;
end;
end;
run;

 

to 

 

data samples;
do samp = 1 to 1000;
do t = 1 to 100;
u = 3 + rannor(1996)*5;
x = 100 + 3*rannor(6991);
y = 10 + 0.5*x + u;
output;
end;
end;
run;

 

Then I'm supposed to comment on the changes to the mean and variance of B1hat and B0hat. But the only thing that changed was the intercept's mean increased by 3. Not sure why. I thought a lot would change if I made the error code have a mean of 3 instead of a mean of zero. Am I doing something wrong with the code? The shape of the histogram for both B1hat and B0hat are still symmetric as well. I'm super confused.

2 REPLIES 2
PaigeMiller
Diamond | Level 26

You don't state that you are performing linear regression (are you?), but if you are, then the mean of the residuals is always zero. This is just plain old algebra, and there's no way to get any other mean of the residuals.

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 776 views
  • 0 likes
  • 3 in conversation