Mathematical Modeling of Complex Systems
Dr. Courtney Brown
Assignment #8
The data for unemployment rates from 1948 to 1968 for white males, white females, and black males are supplied in a table format readable by R as a data frame HERE. Your assignment is to plot white male unemployment rates and white female unemployment rates overtime (both on the same plot). Do the same for white male unemployment rates and black male unemployment rates. Take a look at those plots. Print them out and study them closely.
Now plot the first differences for black male unemployment rates. Also calculate and look at the regression that corresponds with this plot.
Then plot a first-order linear difference equation on top of black male unemploment rates overtime (like you did with assignment 2). Take a look. Hmmmm. Notice that things are not working so nicely as they did in assignment 2.
Re-group.
Now regress white female unemployment rates on white male unemployment rates. Also regress black male unemployment rates on white male unemployment rates. (In both cases, white male unemployment rates are the independent variable.) Now plot white female unemployment rates on top of white male unemployment rates, as well as black male unemployment rates on top of white male unemployment rates, all on the same plot. Be sure that white male unemployment rates are on the horizontal axis for both plots, and note that these are not plots with time on the horizontal axis. Make the plots look nice, as you did with the plots in other assignments. You may want to look at Frank McGowan's nice intro to graphing in R in order to figure out how to plot two sets of data on the same plot. One way to do this is to use the plot and the line commands together. You did this in assignment 2. But this time make sure that both plots look similar, as in two sets of points connected by lines. Alternatively, you can use the plot statement twice, but between the two plot statements include a line with the statement par(new=TRUE). This will stop the second plot statement from erasing the first, and you can place two plots on top of each other on the same graph. But if you use this method, be sure to use the same xlim and ylim statements with both plot statements.
Your assignment is to figure out what is being demonstrated by the series of plots and regressions descibed above. That is, what is happening SUBSTANTIVELY (that is, in the real world economy) to produce these results? What does this tell you about dynamic modeling with these data?
Make some nice tables, and print these out with your plots. Write up a few pages of text that interpret your results, and hand it all in.
NOTE: The concept of this interesting assignment was originally developed by Professor John Sprague.
To give you a start, below is the SAS code that will do the analysis of the data. Now, we are using R in this course, so the SAS code is offered here only as a help to guide your R programming.
GOPTIONS lfactor=10 hsize=6 in vsize=6 in horigin=1 in vorigin=2 in ftitle=swissb
ftext=swissb htitle=2 htext=1.5;
options nocenter;
**********************************************************;
* CLASS, NOTE THAT IF YOU BEGIN A LINE WITH AN ASTERISK *
* THEN YOU CAN PUT NOTES IN YOUR PROGRAM FILES. THIS IS
* LIKE A COMMENT CARD IN SPSS. HOWEVER, REMEMBER
* TO EVENTUALLY PUT A FINAL SEMICOLON AT THE END OF YOUR COMMENTS.;
***********************************************************;
* NOTE THAT I INDENT SOME STATEMENTS. THIS
* IS JUST FOR NEATNESS.;
***********************************************************;
* COPYRIGHT (c) Courtney Brown 2004, All Rights Reserved;
* Permission granted to use this file and computer code for any nonprofit and
* educational purposes, including classroom instruction.
* No further permission required.
* Please cite source as "From www.courtneybrown.com";
***********************************************************;
DATA SASSIGN8;
INPUT YEAR 1-4 WMALE 6-8 WFEMALE 10-12 BLKMALE 14-17;
CARDS;
1948 3.4 3.8 5.8
1949 5.6 5.7 9.6
1950 4.7 5.3 9.4
1951 2.6 4.2 4.9
1952 2.5 3.3 5.2
1953 2.5 3.1 4.8
1954 4.8 5.6 10.3
1955 3.7 4.3 8.8
1956 3.4 4.2 7.9
1957 3.6 4.3 8.3
1958 6.1 6.2 13.8
1959 4.6 5.3 11.5
1960 4.8 5.3 10.7
1961 5.7 6.5 12.8
1962 4.6 5.5 10.9
1963 4.7 5.8 10.5
1964 4.1 5.5 8.9
1965 3.6 5.0 7.4
1966 2.8 4.3 6.3
1967 2.7 4.6 6.0
1968 2.6 4.3 5.6
;
DATA SASSIGN8;SET;
LBLKMALE=LAG(BLKMALE);
LABEL WMALE=UNEMPLOYMENT RATE FOR WHITE MALES;
LABEL WFEMALE=UNEMPLOYMENT RATE FOR WHITE FEMALES;
LABEL BLKMALE=UNEMPLOYMENT RATE FOR BLACK MALES;
LABEL LBLKMALE=LAGGED UNEMPLOYMENT RATE BLACK MALES;
symbol1 color=black v=NONE f=centb i=join;
symbol2 color=black f=centb v='.' height=2 interpol=R;
symbol3 color=black f=centb v='.' height=2;
PROC GPLOT;
axis1 color=black
value=(h=1.5 f=swissb c=black)
label=(h=1.3 a=90 r=0 f=swissb c=black 'Unemployment');
axis2 color=black
value=(h=1.5 f=swissb c=black)
label=(h=1.3 f=swissb c=black 'Year');
PLOT WMALE*YEAR='M' WFEMALE*YEAR='F'/ overlay
vaxis=axis1 haxis=axis2 vminor=0 hminor=0;
TITLE 'Figure 1: White Male and White Female Unemployment Rates, 1948-68';
PROC GPLOT;
axis1 color=black
value=(h=1.5 f=swissb c=black)
label=(h=1.3 a=90 r=0 f=swissb c=black 'Unemployment');
axis2 color=black
value=(h=1.5 f=swissb c=black)
label=(h=1.3 f=swissb c=black 'Year');
PLOT WMALE*YEAR='M' BLKMALE*YEAR='B'/ overlay
vaxis=axis1 haxis=axis2 vminor=0 hminor=0;
TITLE 'Figure 2: White Male and Black Male Unemployment Rates, 1948-68';
PROC GPLOT;
axis1 color=black
value=(h=1.5 f=swissb c=black)
label=(h=1.3 a=90 r=0 f=swissb c=black 'Unemployment Rates');
axis2 color=black
value=(h=1.5 f=swissb c=black)
label=(h=1.3 f=swissb c=black 'Lagged Unemployment Rates');
PLOT BLKMALE*LBLKMALE=2 /
vaxis=axis1 haxis=axis2 vminor=0 hminor=0;
TITLE1 'Figure 3: First Differences for';
Title2 'Black Male Unemployment Rates, 1948-68';
PROC REG;
MODEL BLKMALE=LBLKMALE;
DATA TRAJECT;
Y1=5.8;
A=0.555148;
B=3.855764;
DO T=1 TO 21;
Y2=(A*Y1)+B;
OUTPUT;
Y1=Y2;
END;
PROC SORT;
BY T;
DATA SASSIGN8; SET SASSIGN8;
T=YEAR-1947;
DATA COMBINE;
MERGE TRAJECT SASSIGN8;
BY T;
PROC PRINT;
**************************************************;
* YOU NEED TO CLEAN UP THE PLOTS BELOW THIS POINT;
* CONVERT THE PROC PLOT TO PROC GPLOT STATEMENTS;
* AND MAKE EVERYTHING LOOK PRETTY.;
**************************************************;
PROC PLOT;
PLOT BLKMALE*YEAR='B' Y2*YEAR='+'/OVERLAY;
PROC REG;
MODEL WFEMALE=WMALE;
PROC REG;
MODEL BLKMALE=WMALE;
PROC PLOT;
PLOT WFEMALE*WMALE='1' BLKMALE*WMALE='2'/OVERLAY;
run;
quit;