Statistical Modeling
Dr. Courtney Brown
Assignment #5
For this assignment, you will be working with dummy variables to explore conditional relationships. As with all assignments in this course, remember that this is an assignment of scientific writing, so explain your results clearly so that anyone can understand your findings. Be sure to read the assigned article by Gerald Wright, "Linear Models for Evaluating Conditional Relationships." You are to use the program below to create and use both intercept and slope dummy variables. Be sure to use the noint term in the model statement of Proc Reg so that you avoid a "not full rank" problem with SAS. The program below creates race intercept dummy variables based on race and slope dummy variables based on race and partyid. This combination for the slope dummy variables is not particulary useful since very few African Americans are Republican (or were in 1980). Thus, you are to create new dummy variables that make sense. If you still want to use race intercept dummy variables, then you should change the slope dummy variables so that they are based on some variable other than partyid. But you could also create intercept dummy variables based on gender, or something else entirely that has nothing to do with race, and then the partyid slope dummy variables would be a good idea. You decide what to do. The bottom line is that you need to have intercept dummy variables, and then you need to create slope dummy variables that are based on the combination of those intercept dummy variables and some other variable. Finally, you are to conduct a test to see if the parameter estimates for the intercept dummy variables are equal, and another test to see if the parameter estimates for the slope dummy variables are equal. All of this is done with SAS. Be sure to INTERPRET YOUR RESULTS with a few pages of text.
For the dependent variable (use only one), use either feelings for President Jimmy Carter or feelings for challenger Ronald Reagan using the variables carfeel3 or reafeel3. These variables are for feeling thermometers asked of the survey respondents in September of 1980. Try to find an interesting set of independent variables that explains one of these two dependent variables.
You will be working with multiple regression using the same SAS data set as you used in a previous assignment. If needed, you should first, download the survey data set for the Reagan vs. Carter election in 1980. (Right-mouse click this link and choose "Save Target As.") This data set is called a "panel study" because there were four waves of interviews that took place throughout 1980 to capture the sense of the campaign during (1) the entry into the primary season, (2) the post-primary season, (3) the main campaign in September, and (4) after the vote in November. After you download the data set, you will need to extract it since it is "zipped." Use Windows Explorer to do this by right-mouse clicking the zipped file and choosing "Extract." Put the extracted data set on your USB drive. Now you can run the SAS code below. Cut and paste everything below this line into your SAS editor. Then run the program. You will find that you can see the variable lables in the output for Proc Means.
Here is some help in interpreting the variable values.
Feeling thermometers: 0 to 100, with 50 being neutral.
Liberal/conservative scales: 1=extreme liberal, 7=extreme conservative.
Inter1-Inter3: respondent's interest in the campaign/low to high.
P1 through P4: This refers to the panel wave, January, July, Sept. & Nov.
Expectation to vote: 5 will vote, 1 no.
Education: years of education
Income: not in thousands of dollars, but a scale, low to high.
Frequency of church attendance: low to high
R : This refers to the respondent.
Generally all of the variables go from to low to high. Thus, if you see a variable
and you do not know the coding scheme, assume that a small number means less
and a larger number means more. The other codes are in the variable labels.
Most of the variables for this data set originated as a panel study supplied by the Interuniversity Consortium for Social and Political Research (ICPSR). Emory University is a member of the ICPSR. I have added some contextual variables to the survey data set by extracting these contextual data from a separate ICPSR data set.
libname windata 'e:\';
GOPTIONS lfactor=10 hsize=6 in vsize=6 in horigin=1 in vorigin=1 in;
options nocenter ls=120;
**********************************************************;
* 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 2005, 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 panel80;SET windata.panel80;
if ((vote eq 1) or (vote eq 2));
if (age le 43) then generation = 'youth';
if (age gt 43) then generation = 'older';
if (partyid le 2) then party = 'Dem.';
if ((partyid ge 3) and (partyid le 5)) then party = 'Ind.';
if (partyid ge 6) then party = 'Rep.';
gender=sex;
if ((race eq 1) or (race eq 2)); * This gets rid of the "other" category
in race;
if (race eq 1) then white=1;else white=0; * This creates the intercept dummy
variable for whites;
if (race eq 2) then black=1;else black=0; * This creates the intercept dummy
variable for African Americans;
wpartyid=white*partyid; * This is one way of creating the whites only slope
dummy variable for partyid;
bpartyid=black*partyid; * This is one way of creating the blacks only slope
dummy variable for partyid;
proc format;
value VoteFmt 1 ='Reagan'
2 ='Carter'
3 ='Clark'
4 ='Anderson';
value GenderFmt 1 ='Male'
2 ='Female';
proc print;var white black wpartyid bpartyid partyid;
proc means;
proc contents;
proc reg;
model carfeel3 = white black wpartyid bpartyid gender age / stb tol noint;
test white=black;
test wpartyid=bpartyid;
title 'Carter Feelings';
run;
quit;