UNIVERSITY OF CALIFORNIA, LOS ANGELES
Department of Economics

Economics 143 (Cameron) - Applied Regression Analysis

Computing Lab Session #3:

Distribution of Sample Regression Functions


Tasks to be Performed
  1. Using TED, copy the program n:plotsrf.sha from the network (or download it from the Web site) to your c: or a: drive, so that it can be edited.

  2. While you are in TED, note the location specified for the READ file and alter this as necessary to reflect the location from which you will be reading the data file, which is called n:table5_1.dat on the network. You will probably be writing your output to the screen, so file 6 need not be specified.

  3. Preliminaries: Look over the contents of the program so you have a feel for what tasks will be performed.

    1. Find the OLS regression that uses the entire population of 55 observations.

    2. Find the block of commands enclosed by do #=1,[nsim] at the beginning and endo at the end. Each time the program loops through this set of commands, the character # is replaced in the code by the number of the current iteration.

    3. Notice the use of the sort and sample commands to obtain different random samples from the population of 55 observations.

    4. Note the options on the ols commands (within this "do-loop") that save the fitted coefficients from each regression (coef=)as well as the vector of fitted values for the dependent variable (predict=).

    5. If you enjoy the challenge, review the basic matrix commands in SHAZAM and figure out what is happening in the matrix and copy commands. Don't panic if you do not know matrix algebra. This program is also just a tool to demonstrate an important point. You will not be expected to write SHAZAM code of this complexity during the course.

    6. Find the crucial plot commands. When the sample is set to sample 1 [nsamsim], the plot qdd pdd / gnu will display the range of alternative fitted sample regression functions from alternative samples. When the sample is set to sample 1 [nsim], the plot bb1 bb2 / gnu will show the correlation between the slope and the intercept estimates across the different sample regressions we will be estimating.

  4. Before exiting TED, change the value of the number of simulations by altering the nsim:100 statement to nsim:20. The nsamsim:1000 statement will have to be changed accordingly to nsamsim:200. This will help if the simultaneous execution of a large number of SHAZAM programs on the network slows the system to a crawl (as it used to do in the old lab). Use F7 to save the program on your c:\ or a: drive and exit.

  5. Now, run the plotsrf.sha program. Have a pencil and paper handy. When the program first pauses, you should be able to see the regression estimates for the entire population (all 55 observations). Note these "true" values for the slope and intercept parameters.

  6. Hit the enter key and watch the program go through the iterations. In each iteration, a separate random sample is drawn, and a sample regression function is calculated. When you get to the next pause, make a note of the recommended form of the first plot command, given the values you have established for the number of simulations. Hit enter to continue.

  7. At the next pause, note the second set of plotting instructions for the current run of the program. Hit enter to continue.

  8. When you get to the TYPE COMMAND prompt, issue the recommended plotting commands and observe what happens.

  9. Questions:

    1. When we study "confidence intervals for prediction," in simple regression, we will derive the shape of the distribution of sample regression fitted values around the true population regression function. Describe what shape you expect this confidence band to have, based on the evidence in your simulations. (You may need to try 50 or 100 simulations to get a clear sense of this shape.)

    2. How would you describe the shape of the sampling distribution of intercepts? Of slopes? (Again, you may need 100 simulations to see a tendency.)

    3. What is the relationship between the slope and the intercept across your different random samples from the population and the different sample regression functions they produce? Are they correlated? How? Is this logical?


COURSE OUTLINE LECTURE OUTLINES PROBLEM SETS PROBLEM SOLUTIONS COMPUTER LABS
SHAZAM EXAMPLES DATA SETS ONLINE QUIZZES GRAPHICS HANDOUTS

Updated: February 2, 1998
Prepared by: Trudy Ann Cameron