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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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