{"id":1477,"date":"2025-01-04T00:03:36","date_gmt":"2025-01-04T00:03:36","guid":{"rendered":"https:\/\/www.allendowney.com\/blog\/?p=1477"},"modified":"2025-01-04T00:03:36","modified_gmt":"2025-01-04T00:03:36","slug":"confidence-in-the-press","status":"publish","type":"post","link":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/","title":{"rendered":"Confidence In the Press"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>This is the fifth in a series of excerpts from <em>Elements of Data Science<\/em>, now <a href=\"https:\/\/www.lulu.com\/shop\/allen-downey\/elements-of-data-science\/paperback\/product-9dyrwn.html\">available from Lulu.com<\/a> and online booksellers. It\u2019s based on Chapter 16, which is part of the political alignment case study. You can read the complete example <a href=\"https:\/\/allendowney.github.io\/PoliticalAlignmentCaseStudy\/confidence.html\">here<\/a>, or run the Jupyter notebook on <a href=\"https:\/\/colab.research.google.com\/github\/AllenDowney\/PoliticalAlignmentCaseStudy\/blob\/v1\/examples\/confidence.ipynb\">Colab<\/a>.<\/p>\n\n\n\n<p>Because this is a teaching example, it builds incrementally. If you just want to see the results, scroll to the end!<\/p>\n<\/blockquote>\n\n\n\n<p>Chapter 16 is a template for exploring relationships between political alignment (liberal or conservative) and other beliefs and attitudes. In this example, we\u2019ll use that template to look at the ways confidence in the press has changed over the last 50 years in the U.S.<\/p>\n\n\n\n<p>The dataset we&#8217;ll use is an excerpt of data from the General Social Survey. It contains three resamplings of the original data. We\u2019ll start with the first.<\/p>\n\n\n\n<pre id=\"codecell5\" class=\"wp-block-preformatted\">datafile = \"gss_pacs_resampled.hdf\"\ngss = pd.read_hdf(datafile, \"gss0\")\ngss.shape\n<\/pre>\n\n\n\n<pre id=\"codecell6\" class=\"wp-block-preformatted\">(72390, 207)<\/pre>\n\n\n\n<p>It contains one row for each respondent and one column per variable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Changes in Confidence<\/h2>\n\n\n\n<p>The General Social Survey includes several questions about a confidence in various institutions. Here are the names of the variables that contain the responses.<\/p>\n\n\n\n<pre id=\"codecell7\" class=\"wp-block-preformatted\">' '.join(column for column in gss.columns if 'con' in column)\n<\/pre>\n\n\n\n<pre id=\"codecell8\" class=\"wp-block-preformatted\">'conarmy conbus conclerg coneduc confed confinan coninc conjudge conlabor conlegis conmedic conpress conrinc consci contv'\n<\/pre>\n\n\n\n<p>Here\u2019s how this section of the survey is introduced.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>I am going to name some institutions in this country. As far as the people running these institutions are concerned, would you say you have a great deal of confidence, only some confidence, or hardly any confidence at all in them?<\/p>\n<\/blockquote>\n\n\n\n<p>The variable we\u2019ll explore is <code>conpress<\/code>, which is about \u201cthe press\u201d.<\/p>\n\n\n\n<pre id=\"codecell9\" class=\"wp-block-preformatted\">varname = \"conpress\"\ncolumn = gss[varname]\ncolumn.tail()\n<\/pre>\n\n\n\n<pre id=\"codecell10\" class=\"wp-block-preformatted\">72385    2.0\n72386    3.0\n72387    3.0\n72388    2.0\n72389    2.0\nName: conpress, dtype: float64\n<\/pre>\n\n\n\n<p>As we\u2019ll see, response to this question have changed substantiall over the last few decades.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Responses<\/h2>\n\n\n\n<p>Here\u2019s the distribution of responses:<\/p>\n\n\n\n<pre id=\"codecell11\" class=\"wp-block-preformatted\">column.value_counts(dropna=False).sort_index()\n<\/pre>\n\n\n\n<pre id=\"codecell12\" class=\"wp-block-preformatted\">1.0     6968\n2.0    24403\n3.0    16769\nNaN    24250\nName: conpress, dtype: int64\n<\/pre>\n\n\n\n<p>The special value <code>NaN<\/code> indicates that the respondent was not asked the question, declined to answer, or said they didn\u2019t know.<\/p>\n\n\n\n<p>The following cell shows the numerical values and the text of the responses they stand for.<\/p>\n\n\n\n<pre id=\"codecell13\" class=\"wp-block-preformatted\">responses = [1, 2, 3]\n\nlabels = [\n    \"A great deal\",\n    \"Only some\",\n    \"Hardly any\",\n]\n<\/pre>\n\n\n\n<p>Here\u2019s what the distribution looks like. <code>plt.xticks<\/code> puts labels on the<\/p>\n\n\n\n<p>-axis.<\/p>\n\n\n\n<pre id=\"codecell14\" class=\"wp-block-preformatted\">pmf = Pmf.from_seq(column)\npmf.bar(alpha=0.7)\n\ndecorate(ylabel=\"PMF\", title=\"Distribution of responses\")\nplt.xticks(responses, labels);\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"438\" height=\"254\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png\" alt=\"_images\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png\" class=\"wp-image-1488\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png 438w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6-300x174.png 300w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/figure>\n\n\n\n<p>About had of the respondents have \u201conly some\u201d confidence in the press \u2013 but we should not make too much of this result because it combines different numbers of respondents interviewed at different times.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Responses over time<\/h2>\n\n\n\n<p>If we make a cross tabulation of <code>year<\/code> and the variable of interest, we get the distribution of responses over time.<\/p>\n\n\n\n<pre id=\"codecell15\" class=\"wp-block-preformatted\">xtab = pd.crosstab(gss[\"year\"], column, normalize=\"index\") * 100\nxtab.head()\n<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>conpress<\/th><th>1.0<\/th><th>2.0<\/th><th>3.0<\/th><\/tr><tr><th>year<\/th><th><\/th><th><\/th><th><\/th><\/tr><\/thead><tbody><tr><th>1973<\/th><td>22.696477<\/td><td>62.398374<\/td><td>14.905149<\/td><\/tr><tr><th>1974<\/th><td>24.846835<\/td><td>55.752212<\/td><td>19.400953<\/td><\/tr><tr><th>1975<\/th><td>23.928077<\/td><td>58.160443<\/td><td>17.911480<\/td><\/tr><tr><th>1976<\/th><td>29.323308<\/td><td>53.588517<\/td><td>17.088175<\/td><\/tr><tr><th>1977<\/th><td>24.484365<\/td><td>59.148370<\/td><td>16.367265<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Now we can plot the results.<\/p>\n\n\n\n<pre id=\"codecell16\" class=\"wp-block-preformatted\">for response, label in zip(responses, labels):\n    xtab[response].plot(label=label)\n\ndecorate(xlabel=\"Year\", ylabel=\"Percent\", title=\"Confidence in the press\")\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"255\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/1ccb963b40a30d032cdec783f0da628e36b802486bacad5d0d9217c581e0a275.png\" alt=\"_images\/1ccb963b40a30d032cdec783f0da628e36b802486bacad5d0d9217c581e0a275.png\" class=\"wp-image-1480\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/1ccb963b40a30d032cdec783f0da628e36b802486bacad5d0d9217c581e0a275.png 442w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/1ccb963b40a30d032cdec783f0da628e36b802486bacad5d0d9217c581e0a275-300x173.png 300w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><\/figure>\n\n\n\n<p>The percentages of \u201cA great deal\u201d and \u201cOnly some\u201d have been declining since the 1970s. The percentage of \u201cHardly any\u201d has increased substantially.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Political alignment<\/h2>\n\n\n\n<p>To explore the relationship between these responses and political alignment, we\u2019ll recode political alignment into three groups:<\/p>\n\n\n\n<pre id=\"codecell17\" class=\"wp-block-preformatted\">d_polviews = {\n    1: \"Liberal\",\n    2: \"Liberal\",\n    3: \"Liberal\",\n    4: \"Moderate\",\n    5: \"Conservative\",\n    6: \"Conservative\",\n    7: \"Conservative\",\n}\n<\/pre>\n\n\n\n<p>Now we can use <code>replace<\/code> and store the result as a new column in the <code>DataFrame<\/code>.<\/p>\n\n\n\n<pre id=\"codecell18\" class=\"wp-block-preformatted\">gss[\"polviews3\"] = gss[\"polviews\"].replace(d_polviews)\n<\/pre>\n\n\n\n<p>With this scale, there are roughly the same number of people in each group.<\/p>\n\n\n\n<pre id=\"codecell19\" class=\"wp-block-preformatted\">pmf = Pmf.from_seq(gss[\"polviews3\"])\npmf.bar(color=\"C1\", alpha=0.7)\n\ndecorate(\n    xlabel=\"Political alignment\",\n    ylabel=\"PMF\",\n    title=\"Distribution of political alignment\",\n)\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"255\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/af209238e95c5c1c14543db06c71d0c98aa336c5bee1a163552a20b8eeb44fbe.png\" alt=\"_images\/af209238e95c5c1c14543db06c71d0c98aa336c5bee1a163552a20b8eeb44fbe.png\" class=\"wp-image-1483\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/af209238e95c5c1c14543db06c71d0c98aa336c5bee1a163552a20b8eeb44fbe.png 442w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/af209238e95c5c1c14543db06c71d0c98aa336c5bee1a163552a20b8eeb44fbe-300x173.png 300w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Group by political alignment<\/h2>\n\n\n\n<p>Now we can use <code>groupby<\/code> to group the respondents by political alignment.<\/p>\n\n\n\n<pre id=\"codecell20\" class=\"wp-block-preformatted\">by_polviews = gss.groupby(\"polviews3\")\n<\/pre>\n\n\n\n<p>Here\u2019s a dictionary that maps from each group to a color.<\/p>\n\n\n\n<pre id=\"codecell21\" class=\"wp-block-preformatted\">muted = sns.color_palette(\"muted\", 5)\ncolor_map = {\"Conservative\": muted[3], \"Moderate\": muted[4], \"Liberal\": muted[0]}\n<\/pre>\n\n\n\n<p>Now we can make a PMF of responses for each group.<\/p>\n\n\n\n<pre id=\"codecell22\" class=\"wp-block-preformatted\">for name, group in by_polviews:\n    plt.figure()\n    pmf = Pmf.from_seq(group[varname])\n    pmf.bar(label=name, color=color_map[name], alpha=0.7)\n\n    decorate(ylabel=\"PMF\", title=\"Distribution of responses\")\n    plt.xticks(responses, labels)\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"438\" height=\"254\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/4ba4c1231ab8c9458e69e622f31289dab6b1173ac7b1e91678fe140d8d3dec7b.png\" alt=\"_images\/4ba4c1231ab8c9458e69e622f31289dab6b1173ac7b1e91678fe140d8d3dec7b.png\" class=\"wp-image-1487\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/4ba4c1231ab8c9458e69e622f31289dab6b1173ac7b1e91678fe140d8d3dec7b.png 438w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/4ba4c1231ab8c9458e69e622f31289dab6b1173ac7b1e91678fe140d8d3dec7b-300x174.png 300w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"438\" height=\"254\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/ec0ce0935368ef84d8f055c1270e9705607f398028601094b01e686f9e9eebe0.png\" alt=\"_images\/ec0ce0935368ef84d8f055c1270e9705607f398028601094b01e686f9e9eebe0.png\" class=\"wp-image-1482\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/ec0ce0935368ef84d8f055c1270e9705607f398028601094b01e686f9e9eebe0.png 438w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/ec0ce0935368ef84d8f055c1270e9705607f398028601094b01e686f9e9eebe0-300x174.png 300w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"438\" height=\"254\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/aced56562db7764eda5e7d9f4d87f680fb71cac3f44983280ab873aa3ab48be8.png\" alt=\"_images\/aced56562db7764eda5e7d9f4d87f680fb71cac3f44983280ab873aa3ab48be8.png\" class=\"wp-image-1485\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/aced56562db7764eda5e7d9f4d87f680fb71cac3f44983280ab873aa3ab48be8.png 438w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/aced56562db7764eda5e7d9f4d87f680fb71cac3f44983280ab873aa3ab48be8-300x174.png 300w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/figure>\n\n\n\n<p>Looking at the \u201cHardly any\u201d response, it looks like conservatives have the least confidence in the press.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Recode<\/h2>\n\n\n\n<p>To quantify changes in these responses over time, one option is to put them on a numerical scale and compute the mean. Another option is to compute the percentage who choose a particular response or set of responses. Since the changes have been most notable in the \u201cHardly any\u201d response, that\u2019s what we\u2019ll track. We\u2019ll use <code>replace<\/code> to recode the values so \u201cHardly any\u201d is <code>1<\/code> and all other responses are <code>0<\/code>.<\/p>\n\n\n\n<pre id=\"codecell23\" class=\"wp-block-preformatted\">d_recode = {1: 0, 2: 0, 3: 1}\n\ngss[\"recoded\"] = column.replace(d_recode)\ngss[\"recoded\"].name = varname\n<\/pre>\n\n\n\n<p>We can use <code>value_counts<\/code> to confirm that it worked.<\/p>\n\n\n\n<pre id=\"codecell24\" class=\"wp-block-preformatted\">gss[\"recoded\"].value_counts(dropna=False)\n<\/pre>\n\n\n\n<pre id=\"codecell25\" class=\"wp-block-preformatted\">0.0    31371\nNaN    24250\n1.0    16769\nName: conpress, dtype: int64\n<\/pre>\n\n\n\n<p>Now if we compute the mean, we can interpret it as the fraction of respondents who report \u201chardly any\u201d confidence in the press. Multiplying by <code>100<\/code> makes it a percentage.<\/p>\n\n\n\n<pre id=\"codecell26\" class=\"wp-block-preformatted\">gss[\"recoded\"].mean() * 100\n<\/pre>\n\n\n\n<pre id=\"codecell27\" class=\"wp-block-preformatted\">34.833818030743664\n<\/pre>\n\n\n\n<p>Note that the <code>Series<\/code> method <code>mean<\/code> drops <code>NaN<\/code> values before computing the mean. The NumPy function <code>mean<\/code> does not.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Average by group<\/h2>\n\n\n\n<p>We can use <code>by_polviews<\/code> to compute the mean of the recoded variable in each group, and multiply by <code>100<\/code> to get a percentage.<\/p>\n\n\n\n<pre id=\"codecell28\" class=\"wp-block-preformatted\">means = by_polviews[\"recoded\"].mean() * 100\nmeans\n<\/pre>\n\n\n\n<pre id=\"codecell29\" class=\"wp-block-preformatted\">polviews3\nConservative    44.410101\nLiberal         27.293806\nModerate        34.113831\nName: conpress, dtype: float64\n<\/pre>\n\n\n\n<p>By default, the group names are in alphabetical order. To get the values in a particular order, we can use the group names as an index:<\/p>\n\n\n\n<pre id=\"codecell30\" class=\"wp-block-preformatted\">groups = [\"Conservative\", \"Moderate\", \"Liberal\"]\nmeans[groups]\n<\/pre>\n\n\n\n<pre id=\"codecell31\" class=\"wp-block-preformatted\">polviews3\nConservative    44.410101\nModerate        34.113831\nLiberal         27.293806\nName: conpress, dtype: float64\n<\/pre>\n\n\n\n<p>Now we can make a bar plot with color-coded bars:<\/p>\n\n\n\n<pre id=\"codecell32\" class=\"wp-block-preformatted\">title = \"Percent with hardly any confidence in the press\"\ncolors = color_map.values()\nmeans[groups].plot(kind=\"bar\", color=colors, alpha=0.7, label=\"\")\n\ndecorate(\n    xlabel=\"\",\n    ylabel=\"Percent\",\n    title=title,\n)\n\nplt.xticks(rotation=0);\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"196\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/9582dd9bf6d69f9295d546ba69db763928bf20cdf27d8dab7a08f64d33fb7f49.png\" alt=\"_images\/9582dd9bf6d69f9295d546ba69db763928bf20cdf27d8dab7a08f64d33fb7f49.png\" class=\"wp-image-1481\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/9582dd9bf6d69f9295d546ba69db763928bf20cdf27d8dab7a08f64d33fb7f49.png 442w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/9582dd9bf6d69f9295d546ba69db763928bf20cdf27d8dab7a08f64d33fb7f49-300x133.png 300w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><\/figure>\n\n\n\n<p>Conservatives have less confidence in the press than liberals, and moderates are somewhere in the middle.<\/p>\n\n\n\n<p>But again, these results are an average over the interval of the survey, so you should not interpret them as a current condition.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Time series<\/h2>\n\n\n\n<p>We can use <code>groupby<\/code> to group responses by year.<\/p>\n\n\n\n<pre id=\"codecell33\" class=\"wp-block-preformatted\">by_year = gss.groupby(\"year\")\n<\/pre>\n\n\n\n<p>From the result we can select the recoded variable and compute the percentage that responded \u201cHardly any\u201d.<\/p>\n\n\n\n<pre id=\"codecell34\" class=\"wp-block-preformatted\">time_series = by_year[\"recoded\"].mean() * 100\n<\/pre>\n\n\n\n<p>And we can plot the results with the data points themselves as circles and a local regression model as a line.<\/p>\n\n\n\n<pre id=\"codecell35\" class=\"wp-block-preformatted\">plot_series_lowess(time_series, \"C1\", label='')\n\ndecorate(\n    xlabel=\"Year\",\n    ylabel=\"Percent\",\n    title=title\n)\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"255\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/82515fa4a863c7a0e972d039c05e2ab431d278a1ec98601173f492d03b020d74.png\" alt=\"_images\/82515fa4a863c7a0e972d039c05e2ab431d278a1ec98601173f492d03b020d74.png\" class=\"wp-image-1484\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/82515fa4a863c7a0e972d039c05e2ab431d278a1ec98601173f492d03b020d74.png 442w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/82515fa4a863c7a0e972d039c05e2ab431d278a1ec98601173f492d03b020d74-300x173.png 300w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><\/figure>\n\n\n\n<p>The fraction of respondents with \u201cHardly any\u201d confidence in the press has increased consistently over the duration of the survey.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Time series by group<\/h2>\n\n\n\n<p>So far, we have grouped by <code>polviews3<\/code> and computed the mean of the variable of interest in each group. Then we grouped by <code>year<\/code> and computed the mean for each year. Now we\u2019ll use <code>pivot_table<\/code> to compute the mean in each group for each year.<\/p>\n\n\n\n<pre id=\"codecell36\" class=\"wp-block-preformatted\">table = gss.pivot_table(\n    values=\"recoded\", index=\"year\", columns=\"polviews3\", aggfunc=\"mean\"\n) * 100\n<\/pre>\n\n\n\n<pre id=\"codecell37\" class=\"wp-block-preformatted\">table.head()\n<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>polviews3<\/th><th>Conservative<\/th><th>Liberal<\/th><th>Moderate<\/th><\/tr><tr><th>year<\/th><th><\/th><th><\/th><th><\/th><\/tr><\/thead><tbody><tr><th>1974<\/th><td>22.482436<\/td><td>17.312073<\/td><td>16.604478<\/td><\/tr><tr><th>1975<\/th><td>22.335025<\/td><td>10.884354<\/td><td>17.481203<\/td><\/tr><tr><th>1976<\/th><td>19.495413<\/td><td>17.794486<\/td><td>14.901257<\/td><\/tr><tr><th>1977<\/th><td>22.398190<\/td><td>13.207547<\/td><td>14.650767<\/td><\/tr><tr><th>1978<\/th><td>27.176221<\/td><td>18.048780<\/td><td>16.819013<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The result is a table that has years running down the rows and political alignment running across the columns. Each entry in the table is the mean of the variable of interest for a given group in a given year.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Plotting the results<\/h2>\n\n\n\n<p>Now let\u2019s see the results.<\/p>\n\n\n\n<pre id=\"codecell38\" class=\"wp-block-preformatted\">for group in groups:\n    series = table[group]\n    plot_series_lowess(series, color_map[group])\n    \ndecorate(\n    xlabel=\"Year\",\n    ylabel=\"Percent\",\n    title=\"Percent with hardly any confidence in the press\",\n)\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"255\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/b206bc96158affd5c576feea8e214bc24069a26028e343a303b0d987b6581c99.png\" alt=\"_images\/b206bc96158affd5c576feea8e214bc24069a26028e343a303b0d987b6581c99.png\" class=\"wp-image-1486\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/b206bc96158affd5c576feea8e214bc24069a26028e343a303b0d987b6581c99.png 442w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/b206bc96158affd5c576feea8e214bc24069a26028e343a303b0d987b6581c99-300x173.png 300w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><\/figure>\n\n\n\n<p>Confidence in the press has decreased in all three groups, but among liberals it might have leveled off or even reversed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Resampling<\/h2>\n\n\n\n<p>The figures we\u2019ve generated so far in this notebook are based on a single resampling of the GSS data. Some of the features we see in these figures might be due to random sampling rather than actual changes in the world. By generating the same figures with different resampled datasets, we can get a sense of how much variation there is due to random sampling. To make that easier, the following function contains the code from the previous analysis all in one place.<\/p>\n\n\n\n<pre id=\"codecell39\" class=\"wp-block-preformatted\">def plot_by_polviews(gss, varname):\n    \"\"\"Plot mean response by polviews and year.\n\n    gss: DataFrame\n    varname: string column name\n    \"\"\"\n    gss[\"polviews3\"] = gss[\"polviews\"].replace(d_polviews)\n\n    column = gss[varname]\n    gss[\"recoded\"] = column.replace(d_recode)\n\n    table = gss.pivot_table(\n        values=\"recoded\", index=\"year\", columns=\"polviews3\", aggfunc=\"mean\"\n    ) * 100\n\n    for group in groups:\n        series = table[group]\n        plot_series_lowess(series, color_map[group])\n\n    decorate(\n        xlabel=\"Year\",\n        ylabel=\"Percent\",\n        title=title,\n    )\n<\/pre>\n\n\n\n<p>Now we can loop through the three resampled datasets and generate a figure for each one.<\/p>\n\n\n\n<pre id=\"codecell40\" class=\"wp-block-preformatted\">datafile = \"gss_pacs_resampled.hdf\"\n\nfor key in [\"gss0\", \"gss1\", \"gss2\"]:\n    df = pd.read_hdf(datafile, key)\n\n    plt.figure()\n    plot_by_polviews(df, varname)\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"255\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/b206bc96158affd5c576feea8e214bc24069a26028e343a303b0d987b6581c99.png\" alt=\"_images\/b206bc96158affd5c576feea8e214bc24069a26028e343a303b0d987b6581c99.png\" class=\"wp-image-1486\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/b206bc96158affd5c576feea8e214bc24069a26028e343a303b0d987b6581c99.png 442w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/b206bc96158affd5c576feea8e214bc24069a26028e343a303b0d987b6581c99-300x173.png 300w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"255\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/60b020b2033eee5acf7c98ef76f7fb2346cd4ec9f5c4aaa680f30cb77e362664.png\" alt=\"_images\/60b020b2033eee5acf7c98ef76f7fb2346cd4ec9f5c4aaa680f30cb77e362664.png\" class=\"wp-image-1479\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/60b020b2033eee5acf7c98ef76f7fb2346cd4ec9f5c4aaa680f30cb77e362664.png 442w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/60b020b2033eee5acf7c98ef76f7fb2346cd4ec9f5c4aaa680f30cb77e362664-300x173.png 300w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"255\" src=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/5e9b362b7385c42b2e13cb9bbf57b15aafb71cdd804e687f8eeaadb98f2b6f1f.png\" alt=\"_images\/5e9b362b7385c42b2e13cb9bbf57b15aafb71cdd804e687f8eeaadb98f2b6f1f.png\" class=\"wp-image-1478\" srcset=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/5e9b362b7385c42b2e13cb9bbf57b15aafb71cdd804e687f8eeaadb98f2b6f1f.png 442w, https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/5e9b362b7385c42b2e13cb9bbf57b15aafb71cdd804e687f8eeaadb98f2b6f1f-300x173.png 300w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><\/figure>\n\n\n\n<p>If you see an effect that is consistent in all three figures, it is less likely to be due to random sampling. If it varies from one resampling to the next, you should probably not take it too seriously.<\/p>\n\n\n\n<p>Based on these results, it seems likely that confidence in the press is continuing to decrease among conservatives and moderates, but not liberals \u2013 with the result that polarization on this issue has increased since the 1990s.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the fifth in a series of excerpts from Elements of Data Science, now available from Lulu.com and online booksellers. It\u2019s based on Chapter 16, which is part of the political alignment case study. You can read the complete example here, or run the Jupyter notebook on Colab. Because this is a teaching example, it builds incrementally. If you just want to see the results, scroll to the end! Chapter 16 is a template for exploring relationships between political&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-1477","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Confidence In the Press - Probably Overthinking It<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Confidence In the Press - Probably Overthinking It\" \/>\n<meta property=\"og:description\" content=\"This is the fifth in a series of excerpts from Elements of Data Science, now available from Lulu.com and online booksellers. It\u2019s based on Chapter 16, which is part of the political alignment case study. You can read the complete example here, or run the Jupyter notebook on Colab. Because this is a teaching example, it builds incrementally. If you just want to see the results, scroll to the end! Chapter 16 is a template for exploring relationships between political... Read More Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/\" \/>\n<meta property=\"og:site_name\" content=\"Probably Overthinking It\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-04T00:03:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png\" \/>\n<meta name=\"author\" content=\"AllenDowney\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@AllenDowney\" \/>\n<meta name=\"twitter:site\" content=\"@AllenDowney\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"AllenDowney\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/\"},\"author\":{\"name\":\"AllenDowney\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207\"},\"headline\":\"Confidence In the Press\",\"datePublished\":\"2025-01-04T00:03:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/\"},\"wordCount\":1102,\"publisher\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png\",\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/\",\"url\":\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/\",\"name\":\"Confidence In the Press - Probably Overthinking It\",\"isPartOf\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png\",\"datePublished\":\"2025-01-04T00:03:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#primaryimage\",\"url\":\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png\",\"contentUrl\":\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png\",\"width\":438,\"height\":254},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.allendowney.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Confidence In the Press\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#website\",\"url\":\"https:\/\/www.allendowney.com\/blog\/\",\"name\":\"Probably Overthinking It\",\"description\":\"Data science, Bayesian Statistics, and other ideas\",\"publisher\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.allendowney.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#organization\",\"name\":\"Probably Overthinking It\",\"url\":\"https:\/\/www.allendowney.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png\",\"contentUrl\":\"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png\",\"width\":714,\"height\":784,\"caption\":\"Probably Overthinking It\"},\"image\":{\"@id\":\"https:\/\/www.allendowney.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/AllenDowney\",\"https:\/\/www.linkedin.com\/in\/allendowney\/\",\"https:\/\/bsky.app\/profile\/allendowney.bsky.social\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207\",\"name\":\"AllenDowney\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/fb01b3a7f7190bea1bbf7f0852e686c2f8c03b099222df2ce4bc7926f15bcb43?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/fb01b3a7f7190bea1bbf7f0852e686c2f8c03b099222df2ce4bc7926f15bcb43?s=96&d=mm&r=g\",\"caption\":\"AllenDowney\"},\"url\":\"https:\/\/www.allendowney.com\/blog\/author\/allendowney_6dbrc4\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Confidence In the Press - Probably Overthinking It","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/","og_locale":"en_US","og_type":"article","og_title":"Confidence In the Press - Probably Overthinking It","og_description":"This is the fifth in a series of excerpts from Elements of Data Science, now available from Lulu.com and online booksellers. It\u2019s based on Chapter 16, which is part of the political alignment case study. You can read the complete example here, or run the Jupyter notebook on Colab. Because this is a teaching example, it builds incrementally. If you just want to see the results, scroll to the end! Chapter 16 is a template for exploring relationships between political... Read More Read More","og_url":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/","og_site_name":"Probably Overthinking It","article_published_time":"2025-01-04T00:03:36+00:00","og_image":[{"url":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png","type":"","width":"","height":""}],"author":"AllenDowney","twitter_card":"summary_large_image","twitter_creator":"@AllenDowney","twitter_site":"@AllenDowney","twitter_misc":{"Written by":"AllenDowney","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#article","isPartOf":{"@id":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/"},"author":{"name":"AllenDowney","@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207"},"headline":"Confidence In the Press","datePublished":"2025-01-04T00:03:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/"},"wordCount":1102,"publisher":{"@id":"https:\/\/www.allendowney.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#primaryimage"},"thumbnailUrl":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png","inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/","url":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/","name":"Confidence In the Press - Probably Overthinking It","isPartOf":{"@id":"https:\/\/www.allendowney.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#primaryimage"},"image":{"@id":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#primaryimage"},"thumbnailUrl":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png","datePublished":"2025-01-04T00:03:36+00:00","breadcrumb":{"@id":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#primaryimage","url":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png","contentUrl":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/01\/f652e115b3186a827e67d0882df2218fecf3f5466985f3da007a09e983e93aa6.png","width":438,"height":254},{"@type":"BreadcrumbList","@id":"https:\/\/www.allendowney.com\/blog\/2025\/01\/04\/confidence-in-the-press\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.allendowney.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Confidence In the Press"}]},{"@type":"WebSite","@id":"https:\/\/www.allendowney.com\/blog\/#website","url":"https:\/\/www.allendowney.com\/blog\/","name":"Probably Overthinking It","description":"Data science, Bayesian Statistics, and other ideas","publisher":{"@id":"https:\/\/www.allendowney.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.allendowney.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.allendowney.com\/blog\/#organization","name":"Probably Overthinking It","url":"https:\/\/www.allendowney.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png","contentUrl":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png","width":714,"height":784,"caption":"Probably Overthinking It"},"image":{"@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/AllenDowney","https:\/\/www.linkedin.com\/in\/allendowney\/","https:\/\/bsky.app\/profile\/allendowney.bsky.social"]},{"@type":"Person","@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207","name":"AllenDowney","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/fb01b3a7f7190bea1bbf7f0852e686c2f8c03b099222df2ce4bc7926f15bcb43?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fb01b3a7f7190bea1bbf7f0852e686c2f8c03b099222df2ce4bc7926f15bcb43?s=96&d=mm&r=g","caption":"AllenDowney"},"url":"https:\/\/www.allendowney.com\/blog\/author\/allendowney_6dbrc4\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1465,"url":"https:\/\/www.allendowney.com\/blog\/2024\/12\/20\/political-alignment-and-outlook\/","url_meta":{"origin":1477,"position":0},"title":"Political Alignment and Outlook","author":"AllenDowney","date":"December 20, 2024","format":false,"excerpt":"This is the fourth in a series of excerpts from Elements of Data Science, now available from Lulu.com and online booksellers. It's from Chapter 15, which is part of the political alignment case study. You can read the complete chapter here, or run the Jupyter notebook on Colab. In the\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2024\/12\/c66dd4e209513c6b52923f0279d558dc7cf98d7002a9608170da7c0372146851.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1213,"url":"https:\/\/www.allendowney.com\/blog\/2024\/02\/04\/political-alignment-affiliation-and-attitudes\/","url_meta":{"origin":1477,"position":1},"title":"Political Alignment, Affiliation, and Attitudes","author":"AllenDowney","date":"February 4, 2024","format":false,"excerpt":"Is there a growing gender gap in the U.S? Alignment A recent article in the Financial Times suggests that among young people there is a growing gender gap in political alignment on a spectrum from liberal to conservative. In last week's post, I tried to replicate this result using data\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2024\/02\/ideology_gap5.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2024\/02\/ideology_gap5.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2024\/02\/ideology_gap5.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2024\/02\/ideology_gap5.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2024\/02\/ideology_gap5.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2024\/02\/ideology_gap5.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":259,"url":"https:\/\/www.allendowney.com\/blog\/2019\/08\/01\/left-right-part-3\/","url_meta":{"origin":1477,"position":2},"title":"Left, right, part 3","author":"AllenDowney","date":"August 1, 2019","format":false,"excerpt":"In the first article in this series, I looked at data from the General Social Survey (GSS) to see how political alignment in the U.S. has changed, on the axis from conservative to liberal, over the last 50 years. In the second article, I suggested that self-reported political alignment could\u2026","rel":"","context":"In \"general social survey\"","block_context":{"text":"general social survey","link":"https:\/\/www.allendowney.com\/blog\/tag\/general-social-survey\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2019\/08\/image-1.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":344,"url":"https:\/\/www.allendowney.com\/blog\/2019\/12\/03\/political-alignment-and-beliefs-about-homosexuality\/","url_meta":{"origin":1477,"position":3},"title":"Political alignment and beliefs about homosexuality","author":"AllenDowney","date":"December 3, 2019","format":false,"excerpt":"In the United States, beliefs and attitudes about homosexuality have changed drastically over the last 50 years. In 1972, 74% of U.S. residents thought sexual relations between two adults of the same sex were \"always wrong\", according to results from the General Social Survey (GSS). In 2018, that fraction was\u2026","rel":"","context":"In \"general social survey\"","block_context":{"text":"general social survey","link":"https:\/\/www.allendowney.com\/blog\/tag\/general-social-survey\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2019\/12\/image-3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2019\/12\/image-3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2019\/12\/image-3.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":865,"url":"https:\/\/www.allendowney.com\/blog\/2023\/06\/25\/go-get-the-data\/","url_meta":{"origin":1477,"position":4},"title":"Go Get the Data","author":"AllenDowney","date":"June 25, 2023","format":false,"excerpt":"My mantra when I was working on Probably Overthinking It was \"Go Get the Data.\" If I wanted to use a result from prior work, I would get the data whenever possible and make my own visualization. Of course, that's more work than copying and pasting a figure, but there\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/02\/pinker452.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/02\/pinker452.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/02\/pinker452.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2023\/02\/pinker452.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":243,"url":"https:\/\/www.allendowney.com\/blog\/2019\/07\/26\/right-left-apart-together\/","url_meta":{"origin":1477,"position":5},"title":"Right, left, apart, together?","author":"AllenDowney","date":"July 26, 2019","format":false,"excerpt":"Is the United States getting more conservative? With the rise of the alt-right, Republican control of Congress, and the election of Donald Trump, it might seem so. Or is the country getting more liberal? With the 2015 Supreme Court decision supporting same-sex marriage, the incremental legalization of marijuana, and recent\u2026","rel":"","context":"In \"general social survey\"","block_context":{"text":"general social survey","link":"https:\/\/www.allendowney.com\/blog\/tag\/general-social-survey\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.allendowney.com\/blog\/wp-content\/uploads\/2019\/07\/image-4.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts\/1477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/comments?post=1477"}],"version-history":[{"count":1,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts\/1477\/revisions"}],"predecessor-version":[{"id":1489,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts\/1477\/revisions\/1489"}],"wp:attachment":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/media?parent=1477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/categories?post=1477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/tags?post=1477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}