Poverty etc. simulators

Teaching non-poor people about poverty can be difficult. There is a poverty simulation you can run, but it requires a big room and lots of volunteers, so I’m looking for on-line games.

marketplace.org Asks you to see if you can live on $438 a week, the US government poverty level.

Simulator created by Urban Ministries of Durham

A site for created by Canadian television

A web page from Seattle listing a variety of simulation options which is one page in their whole web site on homelessness from the Seattle University School of Theology and Ministry’s Faith & Family Homelessness Project.

An interactive calculator published in the New York Times

Interactive tools from the National Alliance to End Homelessness

This tool from the Urban Institute looks at the supply side, the cost of building housing, and shows why it is difficult to build housing that is affordable for low income people.


This PDF file from Habitat for Humanity is the written materials needed to run an in-person housing simulation.


And this simulation about polygons shows how individual decisions can create segregation.


Exercising Judgment in Teaching Politically-Charged Topics

My department has run a number of workshops (organized by grad students) on “teaching about race.” They asked me to speak about what the rules are about what we can and cannot say in the classroom. I was pretty sure I knew the “rules” but asked our Provost for the official statement. Interestingly, there was none, but the question was referred to the Legal department. After a  delay, Legal Affairs sent back an email citing Wisconsin state statutes and linking to some policy statements. I’ve pasted the original correspondence below.* First a student and I translated the legalese into English bullet points. Then I wrote an essay about how to think about the authority and ethical responsibility in teaching controversial topics. This was recirculated this fall and as I’ve gotten positive feedback about this, I decided to post it here, with a few more edits, in case it is helpful. There’s always more to say, and legitimate disagreement about how to handle some things. Feel free to use the comments to expand on these points. Continue reading “Exercising Judgment in Teaching Politically-Charged Topics”

Stata: roll your own color palettes

I realize all the cool kids have switched to R, but if you still work with Stata, you may be interested in some routines I worked up to generate color and line pattern palettes and customize graphs fairly easily with macros and loops. This is useful to me because I am generating line graphs showing the trends for 17 different offense groups. Some preliminary tricks, then the code. UPDATED CODE to retrieve, calculate and print RGB values is included in a copy of this post on my academic blog.

Trick 1 that I have learned is to generate self-labeling lines by creating a variable that has the label only in the last value of the x-axis variable, year in my case. E.g. gen xvalue15=Label if xvalue==15. Or self-labeling scatterplots by having a label for all values.

Trick 2 is to use Stata macros to generate the lines of a plot. The general scheme is:

local plotlist ""
foreach val in `list of values' {
    local plotlist "`plotlist' (code_for_one_line )"
twoway `plotlist',

In this code, each line gets added to the macro plotlist. Pro tip: remember to reset the plot macro to ” ” (empty) (or use a new macro name each time) or you will get unpleasant results with repeated graphs.

Color Swatch Generator

Although Stata can generate colors using any set of RGB values, for a variety of reasons* I found it easiest to work with the built-in named colors. Named colors can be modified with the syntax “color*##. Numbers less than 1 lighten the color and numbers greater than 1 darken the color. The ado file full_palette  generates a swatch of the 66 named colors in Stata, with their RGB values (you can access this by typing help full_palette and installing the ado), and the built-in ado palette color  will show color samples and the RGB values for two colors (type help palette color to see the syntax of the command). But I wanted to see ranges of colors using the intensity values across several different named colors.**


stata 14.2 
local colorlist "orange orange_red red ebblue eltblue purple"
local intenlist ".5 .75 1 1.25 1.5 1.75 2"
local ncolor=wordcount("`colorlist'")
local ninten=wordcount("`intenlist'")
local ncases=`ncolor'*`ninten'
disp "ncolor `ncolor' ninten `ninten' ncases `ncases'"
set more off
set obs `ncases'
gen case=_n
gen ncases=_N
gen color=""
gen intenS=""
gen colorname=""
** fill in the strings with colors and intensities
local ii=1
forval color= 1/`ncolor' {
forval inten= 1/`ninten' {
     replace color=word("`colorlist'",`color') if case==`ii'
     replace intenS=word("`intenlist'",`inten') if case==`ii'
     replace colorname=color+"*"+intenS
     local ii=`ii'+1
*** the num variables are sequential
encode color, gen(colornum)
encode intenS, gen(intennum)
encode colorname, gen(col_int_num)
gen inten=real(intenS) // this is the actual numeric value of intensity

local plot ""
summ col_int_num
local nplots=r(max)
forval point=1/`nplots' {
    qui summ col_int_num if col_int_num==`point'
    local labelnum=r(mean)
    local colorname: label col_int_num `labelnum'
    qui summ colornum if col_int_num==`point'
    local colnum=r(mean)
    local color: label colornum `colnum'
    qui summ intennum if col_int_num==`point'
    local intnum=r(mean)
    local inten: label intennum `intnum'
    local plot "`plot' (scatter inten colornum if col_int_num==`point', mcolor(`colorname') msize(huge) mlab(colorname) mlabc(`colorname') mlabsize(tiny) mlabpos(6))"
*disp "`plot'" 
local xmax=`ncolor'+1 
twoway `plot' , legend(off) ylab(.25 (.25) 2) xlab(0 (1) `xmax', val) xtitle(color) ytitle(intensity)
graph export sample_color_swatch.png, replace

Color Line Generator

color_lines_sample My application has too many values to use just color (or so I judged) so I also used line type. Thus the code to generate sample lines.

stata 14.2
* insert colors, intensities, patterns in the lists as desired

local colorlist "orange_red ebblue"
local intenlist ".5  1 1.75 "
local lplist "solid dash shortdash"
local ncolor=wordcount("`colorlist'")
local ninten=wordcount("`intenlist'")
local nlp = wordcount("`lplist'")
local ncases=`ncolor'*`ninten'*`nlp'
set obs `ncases'
gen case=_n
gen Ncases=_N
gen hue=""
gen inten=""
gen linepat=""
set more off
set scheme s1color  // white background
*** fill in the color values, text variables
local xx=1
forval col=1/`ncolor' {
     forval int=1/`ninten' {
       forval lpat=1/`nlp' { 
          replace hue=word("`colorlist'", `col') if case==`xx' 
          replace inten=word("`intenlist'", `int') if case==`xx'
          replace linepat=word("`lplist'", `lpat') if case==`xx' 
       local xx=`xx'+1 
** CREATE 16 values for the X axis ****** 
Duplicate observations
expand 2, gen(copy1)
expand 2, gen(copy2)
expand 2, gen(copy3)
expand 2, gen(copy4)
gen xvalue=copy1 + 2*copy2 + 4*copy3 + 8*copy4

* generate text from other text
gen color=hue+"*"+inten
gen definition=hue+"*"+inten+" "+linepat
gen def15=definition if xvalue==15
* create numeric variables with the strings as values
encode color, gen(colornum)
encode linepat, gen(lpnum)
qui sum colornum
local ncol=r(max)
forval colnum=1/`ncol' { 
    local col`colnum' = `colnum' 
forval lpnum=1/`nlp' { 
     local lp`lpnum'=`lpnum' 

local plotlist ""
disp "ncases `ncases'"
forval case=1/`ncases' { 

    qui summ colornum if case==`case' 
    local cn=r(mean) 
    local color: label colornum `cn' 

    qui summ lpnum if case==`case' 
    local ln=r(mean) 
    local lpat: label lpnum `ln' 

    local plotlist "`plotlist' (connected case xvalue if case==`case', msym(i) mlab(def15) lc(`color') mlabc(`color'') lp(`lpat'))" 
twoway `plotlist', legend(off) xlab(0 (2) 22)
graph export color_lines_sample.png, replace

Offense line palette

This is the problem that started me on this path. I have 17 offenses for which I want to graph imprisonment over  time. Letting Stata choose the colors generates an unreadable hash. And brewscheme won’t help because I want to assign particular markers/colors to particular offenses, not create a general order of colors. After working on this problem a while, I realized the graph could be more meaningful if similar offenses had related colors. Generating a variable-specific palette is easy using the skills developed above.


Step 1: Create a spreadsheet with the variable names and labels plus columns for variable groups, color name (hue), intensity, line type, and the order in which I wanted the graphs to appear in my sample. This last is to put the colors that might be difficult to distinguish next to each other in the sample. In my spreadsheet, I put different possible color schemes in different tabs. Here is one sample.

OffLab offdetail group hue intensity line order
Drugs 12 drugdwi navy 2 solid 10
DWI 20 drugdwi navy 2 dash 11
Escape_etc 21 misc ebblue 0.5 solid 16
Family 22 misc ebblue 0.5 shortdash 17
Larceny 8 property ebblue 1.5 dash 12
MVTheft 9 property ebblue 1.5 solid 13
Fraud 10 property ebblue 1 shortdash 14
OthProp 11 property ebblue 1 solid 15
Robbery 4 robbur purple 1 solid 9
Burglary 7 robbur purple 1 dash 8
Murder 1 violent orange_red 1.75 solid 7
NegMansl 2 violent orange_red 1.75 shortdash 6
Rape 3 violent orange_red 1.75 dash 5
Assault 5 violent orange_red 1 dash 4
OthViolent 6 violent orange_red 1 solid 3
Weapon 23 violent orange_red 0.5 solid 2
PubOrd 13 violent orange_red 0.5 dash 1

The do file reads the spreadsheet (with a local parameter that selects the tab) and generates a sample plot.

stata 14.2
local group set1
import excel "offense_colors_lines.xlsx", sheet("`group'") firstrow allstring clear
gen color=hue+"*"+intensity
encode color, gen(colornum)
encode line, gen(linenum)
destring offdetail, replace
destring order, replace

** I save this as a Stata file so I can merge it into the data file for production runs

save "offense_lines_2017-6-1`group'.dta", replace

levelsof offdetail, local(offlist) clean
foreach off in `offlist' {
    qui summ colornum if offdetail==`off'
    local cnum=r(mean)
    local col`off': label colornum `cnum'
    qui summ linenum if offdetail==`off'
    local lnum=r(mean)
    local line`off': label linenum `lnum'

expand 2, gen(copy1)
expand 2, gen(copy2)
expand 2, gen(copy3)
expand 2, gen(copy4)
gen xvalue=copy1 + 2*copy2 + 4* copy3 + 8*copy4
gen OffLab15=OffLab if xvalue==15

local plotlist ""
forval xx=1/17 {
   qui summ offdetail if order==`xx'
   local off=r(mean)
   local plotlist "`plotlist' (connected order xvalue if offdetail==`off', ml(OffLab15) ms(i) lc(`col`off'') mlabc(`col`off'') lp(`line`off''))"
disp "`plotlist'" 
twoway `plotlist', legend(off) xlab(0 (3) 20)
graph export "offense_lines_2017-6-1`group'.png", replace

Using this scheme in my production graphs involves this code:

use [data file]

merge m:1 offdetail using offense_lines_2017-6-1set1.dta

levelsof offdetail, local(offlist) clean
foreach off in `offlist' {
     qui summ colornum if offdetail==`off'
     local cnum=r(mean)
     local col`off': label colornum `cnum'
     qui summ linenum if offdetail==`off'
     local lnum=r(mean)
     local line`off': label linenum `lnum'

These local macros can then be used in the production graphs with the same code logic as was used to generate the samples.


* I originally tried to use the RGB values from specific palettes I found on line, but passing RGB values in a macro the way I do with my offense colors did not work. I think the problem is a subtle Stata bug/behavior about parsing quotes within quotes within quotes in macros referring to macros and/or the parsing of a list of numbers separated only by spaces. When I used the most straightforward syntax, Stata eliminated the spaces between the numbers (a very odd behavior!), and when I added the Stata special double quotes `” and “‘ , that problem was solved but the resulting code generated an error. However, if you use ado files you can find on line to create and save new colors with names, those new colors should work fine with this routine. You create a new color by creating a file named color-COLORNAME.style in your personal ado path (I put it in a style folder that had previously been created but anywhere works); the content of this file must be

set rgb "255 255 255"

where you replace the 255’s with the RGB codes for the color you want to name. If you examine the color-NAME.style files in your system files (which you can find by typing “findfile color-red.style” in a Stata session  and reading the resulting path) you will see that you can also include comments labels and other commands that don’t get in the way of this core command, but this is the one you need.

** I spent some time studying the code for the ado files palette.ado and full_palette.ado trying to figure out how the RGB values were generated  from the color and intensity values so I could put them in my palette as well, but finally gave up. Both ado files read the RGB code for the base color from the color .style file, but I could not find the code in palette.ado that computes the derived RGB when there is an intensity factor. It must not look the way I’m expecting it to look.

By experimentation with putting values into palette color, I learned that an intensity greater than 1 consistently divides the RGB values by that number (e.g. ebblue is RGB 0 139 188 and ebblue*2 is 0 70 94). Lower RGB values are darker with black being 0 0 0). An intensity less than 1 increases the values of all three RGB values and pulls it toward white, which has RGB 255 255 255. So for example, red is 255 0 0 , red*5 is 255 128 128, red*.2 is 255 204 204, ebblue is 0 139 188, ebblue*.5 is 128 197 222, teal is 110 142 132, teal*.5 is 183 199 194, teal*.2 is 226 232 230. If the color is pure and fully saturated, the intensity factor adds (1-int)*255 to the other colors. I am sure I could empirically work out the formula for intensities less than 1 for the more complex cases if I spend more time on it, but it is not immediately obvious to me.  If you know the formula and put it in the comments, I would be grateful. I’m not sure it matters except to my curiosity. EDIT:  The correct general formula for intensity<1 is:  orig_RGBnum + (1-intensity)(255-orig_RGBnum) for each of the three original RGB numbers. I still have not found the actual code that implements these formulas in the palette.ado file.

Participating While Privileged

I’ve been asked to participate in a session at a conference for academics and activists that is supposed to help set the tone for how academics ought to behave when interacting with community people. It turns out that I am considered to be good at this. This is the kind of accolade that is very dangerous. The minute you think you know what you are doing and are confident of your ability to mix well across lines of culture and privilege, you will mess it up. It is like bragging about how humble you are.

Since I seem to have been anointed, at least temporarily, as having some expertise in this area, I thought I’d write down some of my thoughts, partly in preparation for the session. We agreed I’d begin by giving my own background, but that feels like too long a detour, so I moved it to the bottom of this blog post. Bullet points because it is too much trouble to turn it into an essay. Continue reading “Participating While Privileged”

Religious Observance Policy Limitations

My campus’s religious observance policy is pretty good, although vague around the edges. First, we are urged to avoid scheduling mandatory exercises on days when “significant numbers of student would be impacted.” In practice, this means try to avoid Yom Kippur and Rosh Hashana; the updated version of the policy also mentions Eid al-Adha although, candidly even avoidance of Jewish holidays for exams is hit or miss and there is very little public attention to Eid on this campus.

Second, and this is the part I want to both praise and comment on, we are to provide a non-punitive alternative for any student who says they have a religious conflict with a particular date. There are reasonable constraints on this: the student has to tell the instructor the relevant date(s) within the first three weeks of class (not the night before an exam), and there can be “reasonable limits” on the total number of days requested. The policy explicitly says that “students’ sincerely held religious beliefs shall be reasonably accommodated with respect to scheduling all examinations and other academic requirements” and that “A student’s claim of religious conflict, which may include travel time, should be accepted at face value” because “there is no practical, dignified, and legal means to assess the validity of individual claims.”  Pretty good.

So where are the problems? Continue reading “Religious Observance Policy Limitations”

open letter to students of color

NOTE: I did not write this letter. I am posting it here as a model for what support looks like and because some people will find it helpful to have it in a place they can link to. For those of you not at Wisconsin, the context is that campus police entered an Afro-American Studies class and removed a student charged with putting up anti-racist spray-painted graffiti around campus, then took him downtown and filed criminal charges against him, thereby publicizing his name. This was in the context of a wave of hate and bias incidents on the campus; students in these cases faced campus misconduct charges, not criminal charges. Tony Robinson was a young biracial man shot last year by a police officer in a Madison neighborhood near campus.

18 April 2016

An Open Letter to the Students of Color of the University of Wisconsin-Madison

            From The Faculty and Staff of the Department of Afro-American Studies

The faculty and staff of the Department of Afro-American Studies is thinking about you and keeping you in our hearts at this time of extreme stress and tension.  Your anger is justified, your fear understandable.  The disruption of Professor Almiron’s class, and the arrest of your fellow student, King Shabazz, while important in itself, is only the most recent in a series of events that has been steadily escalating in recent months and weeks.  What so many of you are experiencing isn’t a sign of individual weakness.  It’s a version of post-traumatic stress syndrome, a mental health crisis as serious as those following campus shootings or natural disasters. We admire the way many of you are holding up but we understand what a strain this represents.

In recognition of that fact, we call on faculty across the campus to respond to the crisis in a spirit of care and generosity as we near the end of the semester.  Further, we ask the administration to affirm that call, as well as to offer public assurances that these events will not interfere with King’s plans to graduate at the end of the semester.  Further, we ask that emergency mental health support be made available to all students affected by recent events.

The most important part of our message to you is simple: do your best to keep your eyes on the prize, and know that we’re there to support you as you walk a difficult path.  We know you’re feeling torn between the demands of your studies and your desire to take an active role in responding to what’s happening.  Let some of the burden be shifted to our shoulders. Continue reading “open letter to students of color”

Cities you did not build, wells you did not dig

Sunday’s sermon text was

Then when the Lord your God brings you to the land he promised your ancestors Abraham, Isaac, and Jacob to give you—a land with large, fine cities you did not build, houses filled with choice things you did not accumulate, hewn out cisterns you did not dig, and vineyards and olive groves you did not plant—and you eat your fill, be careful not to forget the Lord who brought you out of Egypt, that place of slavery. (Deuteronomy 6: 10-12 New English Bible)

These lines echo today. They are typically interpreted by feel-good Christians spiritually, as reminding us that we are provided with good things not of our own making. And maybe as reminding us that we are dependent on others, not just ourselves. But these passages are explicitly and unambiguously about conquest and the displacement of the previous occupants of a territory. This can be readily seen in the parallel passage in Joshua:

You crossed the Jordan and came to Jericho. The leaders of Jericho, as well as the Amorites, Perizzites, Canaanites, Hittites, Girgashites, Hivites, and Jebusites, fought with you, but I handed them over to you. I sent terror ahead of you to drive out before you the two Amorite kings. I gave you the victory; it was not by your swords or bows. I gave you a land in which you had not worked hard; you took up residence in cities you did not build and you are eating the produce of vineyards and olive groves you did not plant. (Joshua 24:11-13 New English Bible)

The Biblical writers know this history and make no apology for it. They believe that a one-sided war god backed them against their enemies and gave them the land over the dead bodies of their enemies. They remember their own victimization and their time of slavery and rejoice that it has ended, but they simply have no compunction about killing other groups and taking their land, and they are sure that is what their god wants them to do. (See more references below if you have any doubt that this is a persistent theme.)

The launching point of the sermon was a tour the pastor and other church members took to be educated about immigration issues in Arizona. This stressed the overlain history of the area: indigenous inhabitants partially conquered and partially assimilated by Spanish; the Mexican people who are the amalgamation of indigenous and Spanish who moved around in Mexico; the Anglo-Americans who conquered Northern Mexico and finished conquering the indigenous and now have the audacity to complain about “foreigners” in the area. Our pastor also spoke of touring old Jaffa in Israel-Palestine today with Palestinians who can point to the exact houses that were occupied by their parents and are now occupied by Jews who forcibly removed them. There are plenty of other examples. White South Africans still occupy areas from which they forcibly removed Black South Africans in the 1940s and 1950s. European settlers on the Atlantic coast of North American were able to gain a foothold because they occupied villages that had been built and farmlands that had been cleared by indigenous Americans who had recently died of a plague. All European Americans live on land that was taken from indigenous Americans in a multi-hundred year war of conquest.

Some White American Christians believe in the war god who favored [White] America in its genocide and conquest just as the war god of the Old Testament favored Israel. In fact, the sense of American exceptionalism and American divine right to rule cannot be understood outside this religious context, this understanding of America as the new Israel and Americans as the new chosen people.

Biblically literate atheists point to these passages and these interpretations as a reason to reject Christianity and the Biblical tradition wholesale, and it is hard to blame them.

What is a progressive White American Christian to make of this? How can we reject the one-sided war god and make sense of our position if we believe in a god that is God for everyone? We must sit with the understanding that we are living in houses we have not built and drawing water from wells we did not dig. We are living atop the graves of others, and we are only here because our ancestors brutally displaced other people from their homes. This is plain historical fact. Either we believe only in the one-sided war god, or we believe that somehow there must be some just accounting for the sins of our ancestors. To continue to benefit from the consequences of past injustice is to perpetuate the injustice. And yet, we are not volunteering (I am not volunteering) to relocate myself to my ancestral homeland in Europe, and moreover (and perhaps ironically), Europe considers me to be a foreigner. It seems to me the only way forward is to sit humbly with the burden of history, to try to make justice or at least to get out of the way when others try to make justice.


* Passages which are explicit about killing and displacing others: Deuteronomy 2:33-34, 3:6, 7:2, 13:15, 20:13-14; Numbers 21:3, 31:17-18; Joshua 6:21-27, 8:22-25, 10:10-40, 11:8-15, 21-23; Judges 1:4, 1:17, 3:29, 7:19-25, 8:15-21, 9:45, 20:43-48, 21:10-12; 1 Samuel 4:10, 7:7-11, 11:11, 14:31, 14:48, 15:3, 7-8, 27:8-11; 2 Samuel 8:5, 8:13, 18:6-7; 1 Kings 20:29-30; 2 Kings 14:5-7.