Option 1. Trend Analysis

Prompt: Conduct a trend analysis of some variable of interest. Graph it and try different functional forms. Look for subgroup variation across time, too. Extra credit if you consider other variables as a means of explaining the trend. Explain all of your results.

Question

Do people who have kids have a more favorable view towards the harshness of criminal courts? Do people who have more kids have an even more favorable view?

Variables

Dependent Variable

Courts dealing with criminals: courts

In general, do you think the courts in this area deal too harshly or not harshly enough with criminals?

Possible responses:

1 Too harsh
2 Not harsh enough
3 About right
8 Don’t know
9 No answer
0 Not applicable

Explanatory Variables

1. Number of children: childs

How many children have you ever had? Please count all that were born alive at any time (including any you had from a previous marriage).

2. Highest year of school completed: educ

CODE HIGHEST DEGREE EARNED.

3. Respondent’s Sex: sex

Possible responses:

1 Male
2 Female

4. Think of self as liberal or conservative: polviews

A. We hear a lot of talk these days about liberals and conservatives. I’m going to show you a seven-point scale on which the political views that people might hold are arranged from extremely liberal–point 1–to extremely conservative–point 7. Where would you place yourself on this scale?

Possible responses:

1 Extremely liberal
2 Liberal
3 Slightly liberal
4 Moderate
5 Slghtly conservative
6 Conservative
7 Extremely conservative
8 Don’t know
9 No answer
0 Not applicable

Descriptive Analysis

# need to remove any missing values
courts_childs_nomiss <- na.omit(courts_childs) # That removed 57061 - 42111 = 14950 observations
# Now I can get average responses by year
courts_childs_nomiss_recodes <- courts_childs_nomiss %>%
  mutate(courts_ordinal = ifelse(courts == 3, 2,
                                 ifelse(courts == 2, 1, 
                                        ifelse(courts == 1, 3, courts))))
courts_childs_means <- aggregate(courts_childs_nomiss_recodes[, c(-3, -5)],
                                 list(year = courts_childs_nomiss_recodes$year,
                                      sex = courts_childs_nomiss_recodes$sex),
                                 mean)
year sex courts childs educ polviews courts_ordinal
1974 1 2.028481 2.246835 11.65506 4.094937 1.237342
1975 1 2.035836 2.003413 11.79352 4.010239 1.179181
1976 1 2.076547 1.903909 11.99511 4.008143 1.174267
1977 1 2.046326 1.931310 11.91214 4.041533 1.170926
1978 1 2.040678 1.877966 12.39661 4.083051 1.116949
1980 1 2.065436 1.817114 12.22483 4.149329 1.151007
year sex courts childs educ polviews courts_ordinal
49 2002 2 2.096923 1.963077 13.33846 4.175385 1.318461
50 2004 2 2.100775 1.990698 13.50698 4.156589 1.398450
51 2006 2 2.119714 1.994795 13.41900 4.113207 1.375407
52 2008 2 2.094439 2.036726 13.46905 4.096537 1.390346
53 2010 2 2.048371 1.927937 13.52122 4.027641 1.436328
54 2012 2 2.070270 2.010811 13.65514 4.027027 1.491892

The courts and polviews variables included options of non responses, but the summary function shows that these responses were not included in the provided data. I recoded those variables to ordinal ones so that higher values in the courts variable indicate greater harshness sentiments toward criminal courts so that each value actually increases in harshness sentiment. Recoding the variable this way makes it an ordinal variable measuring a sentiment of harshness toward courts. I also omitted any missing values, which were about 26% of the observations.

To set up the data for a time trend analysis, I took the mean of the responses for views on the harshness of criminal courts, political ideology, the number of children birthed, and education years for each year in the dataset.

Inferential Analysis

Time on Court Harshness Sentiment

  Males Only Females Only
(Intercept) -18.543***
(2.209)
-14.540***
(2.308)
year 0.010***
(0.001)
0.008***
(0.001)
R-squared 0.76 0.65
adj. R-squared 0.75 0.64
sigma 0.06 0.07
F 80.38 46.61
p 0.00 0.00
N 27 27

The OLS summaries above show coefficients for the same bivariate time trend model but with different subsets of data by respondent sex. The model is a slightly better fit to the Males Only model according to the R-squared statistic while the slope estimates for each additional year are practically identical. However the intercept is smaller for the Males Only model, suggesting that there is some heterogeneity from respondent sex.

The plot above shows a scatterplot of the average view of criminal courts as too harsh over years, color-coded by respondent sex. The lines overlaid are bivariate fitted lines estimating the effect of additional years on court harshness sentiment. The fitted lines are also color-coded by sex. The bivariate fits suggest that respondent sex may affect the slope of the fitted lines whereby males seem to have viewed the courts as more harsh over time at a faster rate than did females.

  No Interaction With Interaction
(Intercept) 2.201***
(0.558)
2.478***
(0.502)
poly(year, 2)1 0.857***
(0.154)
2.605***
(0.495)
poly(year, 2)2 0.391***
(0.054)
0.331***
(0.050)
childs -0.155**
(0.050)
22.231***
(6.085)
educ -0.054
(0.039)
-0.041
(0.035)
polviews 0.008
(0.084)
-0.091
(0.080)
childs x year
-0.011***
(0.003)
R-squared 0.89 0.92
adj. R-squared 0.88 0.91
sigma 0.04 0.04
F 80.42 86.77
p 0.00 0.00
N 54 54

The OLS summary output above show the coefficient estimates comparing the restricted and unrestricted model, where the unrestricted model included an interaction effect from average number of children and year. Both year and year-squared were significant at the 1% level with positive coefficients in a multivariate model that accounted for average number of children, average education years, and average political view. The adjusted R-squared statistic was quite high and shows that the model accounted for 88% of the data variation in the restricted model and 91% of it in the unrestricted model.

The average number of children was also a significant predictor of the average harshness view of courts, but the slope estimates are substantially different between the two models. The estimate in the restricted model shows that each additional child was associated with an average decrease of 0.16 on the harshness view of courts (p<0.01). However the estimate in the unrestricted model shows that it was associated with an average increase of 22.23 in the harshness view of courts. This is problematic because harshness was only measured at a ceiling of 3. This impractical estimate value may be due to the year variable ranging from 1972 to 2012.

Finally, the interaction term for average number of children and years was significant at the 0.1% level and has a negative direction. This suggests that greater average children had a moderating effect on the positive relationship between year and average views of courts as too harsh toward criminals.

F-Test

Model 1: courts_ordinal ~ poly(year, 2) + childs + educ + polviews
Model 2: courts_ordinal ~ poly(year, 2) + childs + educ + polviews + year:childs
Analysis of Variance Table
Res.Df RSS Df Sum of Sq F Pr(>F)
48 0.08284 NA NA NA NA
47 0.06431 1 0.01852 13.54 0.0006014

The ANOVA results show that the unrestricted model is significantly different from the restricted model at the 0.001 level (i.e. the coefficients in the unrestricted model are significantly different from zero). The unrestricted model is therefore a better fit to the data.