Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Thank you, Chen Samulsion . I checked the five variables in your latest post against my copy of the ANES 1956-1960 panel file. All 77 category frequencies agree, with 1,514 observations in each table.


    Below is the complete code for the two surfaces I posted. The one-way tables are a useful check, but the surfaces require the respondent-level data: each height is the Democratic share of the actual two-party vote within a party-identification/religion group.

    The code uses the same respondents in both years: respondents interviewed in all three waves who reported an actual Democratic or Republican vote in both 1956 and 1960. I group 1958 party identification into five categories, keeping the independent leaners with the independents. For religion in 1960, I use Protestant codes 100-149 and Catholic code 200, with strength coded 1 (strong) or 5 (not very strong). Other categories, including strength code 3, are excluded here. These choices leave 673 respondents and 20 cells per year in my file.

    In addition to your five variables, the code needs V600841, V600842 and V600843 for panel membership, and V600569 for the weighted version. Please use the original respondent-level ANES file. Edit the default filename near the top if necessary, and run the entire block as a do-file from a writable working directory. It loads that file into memory and creates or replaces its outputs in a subfolder named converse_output. No community-contributed commands or separate plotting files are needed.

    I have attached the unweighted comparison first, followed by a version using V600569. The weighted version is a sensitivity check; I have not established that this variable reproduces Converse's original analytical weights. These remain reconstructions from the current data rather than exact reproductions of the historical figures. Four cells per year have fewer than ten respondents. No smoothing is applied: the triangular faces connect the observed cell heights, and the shaded sides are visual aids. All mesh edges are drawn, including hidden edges.

    The code exports both comparison figures, the individual panels, and the 40 underlying cell estimates. I hope this makes the calculation and the plotting steps easier to inspect and adapt.

    Code:
    * Reconstruct two ANES voting surfaces using official Stata commands only.
    * Run the complete block as a do-file, not one line at a time.
    * Supply the original ANES file as an argument, or edit the default below.
    * Outputs are written to converse_output under the current working directory.
    version 15.1
    args datafile
    if `"`datafile'"' == "" local datafile "anes_mergedfile_1956to1960.dta"
    set more off
    set linesize 120
    capture set processors 1
    set scheme s2color
    capture mkdir converse_output
    use `"`datafile'"', clear
    confirm numeric variable V580360 V600818 V600824 V560203 V600767 V600841 V600842 V600843 V600569
    
    * Actual two-party votes; nonvoters' preferences are not actual votes.
    gen byte dem1956 = (V560203==11) if inlist(V560203,11,12)
    gen byte dem1960 = (V600767==10) if inlist(V600767,10,20)
    gen byte panel = inlist(V600841,1,2) & inlist(V600842,1,2) & inlist(V600843,1,2)
    keep if panel & !missing(dem1956,dem1960)
    
    * Working classifications, not a claim about Converse's exact coding.
    recode V580360 (0=1) (1=2) (2/4=3) (5=4) (6=5) (else=.), gen(party)
    gen byte religion = .
    replace religion = 1 if inrange(V600818,100,149) & V600824==1
    replace religion = 2 if inrange(V600818,100,149) & V600824==5
    replace religion = 3 if V600818==200 & V600824==5
    replace religion = 4 if V600818==200 & V600824==1
    keep if !missing(party,religion)
    assert V600569>0 & V600569<.
    local paired_n = _N
    display "Common classified sample: `paired_n'"
    
    * Cell-specific denominators. Weighting is a sensitivity calculation.
    tempfile cells
    postfile results int year byte party religion long n n_dem double weight_sum pct_dem pct_dem_weighted using `cells', replace
    foreach year in 1956 1960 {
     forvalues p=1/5 {
      forvalues r=1/4 {
       quietly count if party==`p' & religion==`r'
       local n = r(N)
       assert `n'>0
       quietly count if party==`p' & religion==`r' & dem`year'==1
       local nd = r(N)
       local pct = 100*`nd'/`n'
       quietly summarize V600569 if party==`p' & religion==`r', meanonly
       local ws = r(sum)
       quietly summarize dem`year' [aw=V600569] if party==`p' & religion==`r', meanonly
       local wp = 100*r(mean)
       post results (`year') (`p') (`r') (`n') (`nd') (`ws') (`pct') (`wp')
      }
     }
    }
    postclose results
    use `cells', clear
    isid year party religion
    assert _N==40
    assert inrange(pct_dem,0,100) & inrange(pct_dem_weighted,0,100)
    bysort party religion (year): assert n[1]==n[2]
    quietly count if year==1956 & n<10
    local small_n = r(N)
    label define party5 1 "Strong Democrat" 2 "Weak Democrat" 3 "Independent (incl. leaners)" 4 "Weak Republican" 5 "Strong Republican", replace
    label define religion4 1 "Protestant strong" 2 "Protestant weak" 3 "Catholic weak" 4 "Catholic strong", replace
    label values party party5
    label values religion religion4
    sort year religion party
    save converse_output/cells.dta, replace
    export delimited using converse_output/cells.csv, nolabel replace
    
    * Project and draw the same observed heights for both years.
    foreach measure in unweighted weighted {
     foreach yr in 1956 1960 {
      use converse_output/cells.dta, clear
      keep if year==`yr'
      assert _N==20
      local zvar pct_dem
      if "`measure'"=="weighted" local zvar pct_dem_weighted
      forvalues r=1/4 {
       forvalues p=1/5 {
        quietly summarize `zvar' if religion==`r' & party==`p', meanonly
        local z_`p'_`r'=r(mean)
       }
      }
      * Fixed oblique projection: u=x+0.55*y; v=z/25+0.35*y.
      * Categorical cells joined by planar triangles; observed heights unchanged.
      * Draw back religion strips before front strips (fixed viewing direction).
      clear
      tempfile polygons
      postfile geo int face byte vertex double u v using `polygons', replace
      local f=0
      forvalues r=3(-1)1 {
       forvalues p=4(-1)1 {
        local p1=`p'+1
        local r1=`r'+1
        forvalues tri=1/2 {
         local ++f
         if `tri'==1 local pairs "`p' `r' `p1' `r' `p1' `r1' `p' `r'"
         if `tri'==2 local pairs "`p' `r' `p1' `r1' `p' `r1' `p' `r'"
         forvalues k=1/4 {
          local a=2*`k'-1
          local b=2*`k'
          local px: word `a' of `pairs'
          local ry: word `b' of `pairs'
          local u=(`px'-1)+.55*(`ry'-1)
          local v=`z_`px'_`ry''/25+.35*(`ry'-1)
          post geo (`f') (`k') (`u') (`v')
         }
         local shade`f' = 215-12*`r'
        }
       }
      }
      * Front and right curtains extend only to zero; they are not observations.
      forvalues p=1/4 {
       local p1=`p'+1
       local id=100+`p'
       post geo (`id') (1) (`p'-1) (0)
       post geo (`id') (2) (`p') (0)
       post geo (`id') (3) (`p') (`z_`p1'_1'/25)
       post geo (`id') (4) (`p'-1) (`z_`p'_1'/25)
       post geo (`id') (5) (`p'-1) (0)
      }
      forvalues r=1/3 {
       local r1=`r'+1
       local id=110+`r'
       local u1=4+.55*(`r'-1)
       local u2=4+.55*`r'
       local b1=.35*(`r'-1)
       local b2=.35*`r'
       post geo (`id') (1) (`u1') (`b1')
       post geo (`id') (2) (`u2') (`b2')
       post geo (`id') (3) (`u2') (`b2'+`z_5_`r1''/25)
       post geo (`id') (4) (`u1') (`b1'+`z_5_`r''/25)
       post geo (`id') (5) (`u1') (`b1')
      }
      postclose geo
      use `polygons', clear
      sort face vertex
      local plots
      * Back wall grid, then opaque triangles.
      forvalues z=0(25)100 {
       local v=`z'/25+1.05
       local plots `"`plots' (pci `v' 1.65 `v' 5.65, lcolor(gs13) lwidth(vthin))"'
      }
      * Left and rear reference walls, at identical 25-point intervals.
      forvalues z=0(25)100 {
       local v1=`z'/25
       local v2=`v1'+1.05
       local plots `"`plots' (pci `v1' 0 `v2' 1.65, lcolor(gs11) lwidth(thin))"'
      }
      forvalues p=0/4 {
       local u=`p'+1.65
       local plots `"`plots' (pci 1.05 `u' 5.05 `u', lcolor(gs11) lwidth(thin))"'
      }
      forvalues r=0/3 {
       local u=.55*`r'
       local b=.35*`r'
       local t=`b'+4
       local plots `"`plots' (pci `b' `u' `t' `u', lcolor(gs11) lwidth(thin))"'
      }
      forvalues j=1/`f' {
       local g=`shade`j''
       local plots `"`plots' (area v u if face==`j', nodropbase fcolor("`g' 218 230") fintensity(100) lcolor("`g' 218 230") lwidth(vthin))"'
      }
      foreach id of numlist 101/104 111/113 {
       local col "64 98 126"
       if `id'>110 local col "91 127 151"
       local plots `"`plots' (area v u if face==`id', nodropbase fcolor("`col'") fintensity(100) lcolor("`col'") lwidth(vthin))"'
      }
      * Curtain grid lines clipped to the actual edge heights.
      foreach edge in front right {
       local nseg=cond("`edge'"=="front",4,3)
       forvalues j=1/`nseg' {
        local k=`j'+1
        if "`edge'"=="front" {
         local u1=`j'-1
         local u2=`j'
         local b1=0
         local b2=0
         local h1=`z_`j'_1'/25
         local h2=`z_`k'_1'/25
        }
        else {
         local u1=4+.55*(`j'-1)
         local u2=4+.55*`j'
         local b1=.35*(`j'-1)
         local b2=.35*`j'
         local h1=`z_5_`j''/25
         local h2=`z_5_`k''/25
        }
        local t1=`b1'+`h1'
        local t2=`b2'+`h2'
        local plots `"`plots' (pci `b1' `u1' `t1' `u1' `b2' `u2' `t2' `u2', lcolor("203 218 227") lwidth(vthin))"'
        forvalues h=1/4 {
         if max(`h1',`h2')>=`h' {
          local a=0
          local b=1
          if `h1'<`h' local a=(`h'-`h1')/(`h2'-`h1')
          if `h2'<`h' local b=(`h'-`h1')/(`h2'-`h1')
          local ua=`u1'+`a'*(`u2'-`u1')
          local ub=`u1'+`b'*(`u2'-`u1')
          local va=`b1'+`a'*(`b2'-`b1')+`h'
          local vb=`b1'+`b'*(`b2'-`b1')+`h'
          local plots `"`plots' (pci `va' `ua' `vb' `ub', lcolor("203 218 227") lwidth(vthin))"'
         }
        }
       }
      }
      * Mesh edges at the observed grid (no diagonal triangle edges).
      forvalues r=1/4 {
       forvalues p=1/4 {
        local p1=`p'+1
        local u1=(`p'-1)+.55*(`r'-1)
        local u2=`p'+.55*(`r'-1)
        local v1=`z_`p'_`r''/25+.35*(`r'-1)
        local v2=`z_`p1'_`r''/25+.35*(`r'-1)
        local plots `"`plots' (pci `v1' `u1' `v2' `u2', lcolor("50 80 100") lwidth(thin))"'
       }
      }
      forvalues p=1/5 {
       forvalues r=1/3 {
        local r1=`r'+1
        local u1=(`p'-1)+.55*(`r'-1)
        local u2=(`p'-1)+.55*`r'
        local v1=`z_`p'_`r''/25+.35*(`r'-1)
        local v2=`z_`p'_`r1''/25+.35*`r'
        local plots `"`plots' (pci `v1' `u1' `v2' `u2', lcolor("50 80 100") lwidth(thin))"'
       }
      }
      local plots `"`plots' (pci 0 0 4 0 0 0 0 4 0 4 1.05 5.65, lcolor(gs6) lwidth(thin))"'
      local labels
      forvalues z=0(25)100 {
       local v=`z'/25
       local labels `"`labels' text(`v' -.18 "`z'%", place(w) size(small))"'
      }
      local labels `"`labels' text(-.25 0 "Strong" "Democrat", size(small)) text(-.25 1 "Weak" "Democrat", size(small)) text(-.25 2 "Independent", size(small)) text(-.25 3 "Weak" "Republican", size(small)) text(-.25 4 "Strong" "Republican", size(small))"'
      local labels `"`labels' text(-.65 2 "Party identification (1958)", size(medsmall)) text(5.55 0 "Democratic share of two-party vote", place(e) size(medsmall))"'
      forvalues r=1/4 {
       local u=4+.55*(`r'-1)+.13
       local v=.35*(`r'-1)
       if `r'==1 local lab "Prot. strong"
       if `r'==2 local lab "Prot. weak"
       if `r'==3 local lab "Cath. weak"
       if `r'==4 local lab "Cath. strong"
       local labels `"`labels' text(`v' `u' "`lab'", place(e) size(small))"'
      }
      twoway `plots', `labels' legend(off) ///
       title("`yr' presidential vote", size(medium)) ///
       subtitle("Current ANES panel data | `measure' | common sample N = `paired_n'", size(small)) ///
       note("Religion and strength measured in 1960. Independent includes partisan leaners." ///
            "`small_n' cells per year have n < 10. Weighted estimates use V600569 as a sensitivity check." ///
            "Observed cell heights; no smoothing. All mesh edges shown, including hidden edges.", size(vsmall)) ///
       xscale(off range(-.65 7.25)) yscale(off range(-.85 5.85)) ///
       xlabel(none) ylabel(none) xtitle("") ytitle("") ///
       graphregion(color(white)) plotregion(margin(zero)) ///
       xsize(12) ysize(9) aspectratio(.77) name(anes`yr', replace)
      graph save converse_output/converse_`yr'_`measure'.gph, replace
      graph export converse_output/converse_`yr'_`measure'.png, width(2400) replace
     }
     graph combine anes1956 anes1960, cols(2) graphregion(color(white)) xsize(16) ysize(7) ///
      title("Converse-style reconstruction from current ANES data", size(medium))
     graph save converse_output/converse_comparison_`measure'.gph, replace
     graph export converse_output/converse_comparison_`measure'.png, width(3200) replace
    }
    display "SURFACE_EXPORT_COMPLETE"

    Comment


    • #17
      Output figures follow;
      Click image for larger version

Name:	converse_comparison_unweighted.png
Views:	1
Size:	431.8 KB
ID:	1788160

      Click image for larger version

Name:	converse_comparison_weighted.png
Views:	1
Size:	421.0 KB
ID:	1788161

      Last edited by Choonjoo Lee; 16 Nov 2026, 04:10.

      Comment


      • #18
        Thank you, Choonjoo Lee. I get output figures exactly as they are in #11 & #17. I should learn your codes line by line. You always manage to do things in Stata that I couldn't even imagine—things that I suspect not only couldn't be done with Stata alone, but couldn't be done with any other software either. One further question: do you think these graphs are a meaningful way to display the data mentioned above (a three-way table)? And what advantages do they offer over the tables or graphs commonly used today? I should say that I had never noticed Tufte cited this figure before; when I saw that Tufte's book cited it, and then found the original in Philip E. Converse's book, I found them quite stunning.

        Comment


        • #19
          Thank you, Chen. I do think these figures are meaningful, particularly when the question concerns the overall pattern of a relationship and how that pattern differs between occasions.
          Click image for larger version

Name:	three_views.png
Views:	1
Size:	919.1 KB
ID:	1788165

          Here the height is the Democratic share of the two-party vote within each party-identification/religion group. The surface brings the two directions of comparison into one view: how voting varies across party identification, and how that pattern differs across religious groups. In our reconstruction, the relatively high Catholic portion of the 1960 surface is immediately noticeable. That visual impression suggests questions about the relationship among the variables; it does not by itself establish a statistically significant interaction or a causal explanation.

          To make the comparison concrete, I have attached three views of exactly the same unweighted cell percentages: the surfaces, cell heatmaps, and line profiles. My reading is that they serve complementary purposes. The surface gives a memorable overview of the joint pattern. The heatmap makes every cell visible and allows the percentages and denominators to be read together. The line profiles make differences between groups easier to compare on a common vertical scale. A table remains useful for looking up exact values.

          The difference plot adds another view: it shows the change from 1956 to 1960 directly, in percentage points. For example, among independents classified as strong Catholics, the observed Democratic share rises from 9/33 (27.3%) to 26/33 (78.8%), a change of 51.5 percentage points. These are the same respondents in both years, using the fixed classifications described in #16. This is a net change in the group share, not the proportion of individuals who switched parties.

          There are qualifications. The religious categories do not form a continuous numerical scale, so the connecting faces should be read as visual guides, not as estimates of intermediate religious positions. Their ordering matters. Also, equally prominent parts of a surface can rest on very different numbers of observations. Four cells per year have fewer than ten respondents; the heatmaps show all denominators and flag these cells. The comparisons here are descriptive, with no uncertainty intervals shown.

          I would therefore use this kind of surface when the overall shape of the relationship is part of the message, accompanied by a view that makes the individual cells easier to inspect. Its usefulness can extend to other cross-classified percentages or means, especially with meaningful axis ordering and a fixed scale across occasions. The attraction for me is the way it helps us see and ask questions about the data. All the additional plots here also use official Stata commands.

          Comment

          Working...
          X