Hello,

I'm trying to make a graph to show that the parallel trend assumption is satisfied to run diff-in-diff analysis. The shock happened in 2015Q1. I want to see that FHA loans and non-FHA loans were the same trend during this time period. Here are my code and output:

generate quarter = .
replace quarter = 1 if (year == "2013Q4")
replace quarter = 2 if (year == "2014Q1")
replace quarter = 3 if (year == "2014Q2")
replace quarter = 4 if (year == "2014Q3")
replace quarter = 5 if (year == "2014Q4")
replace quarter = 6 if (year == "2015Q1")
replace quarter = 7 if (year == "2015Q2")
replace quarter = 8 if (year == "2015Q3")
replace quarter = 9 if (year == "2015Q4")
collapse (mean) upb, by (fha quarter)
reshape wide upb, i(quarter) j(fha)
graph twoway line upb0 upb1 quarter, sort

Array
Here's what the graph looks like
However, I'd like to make the graph looks better and easier to understand by
  • name y-axis as "average unpaid principal amount ($)"
  • rename quarter from 1, 2, 3, ..., 9 as "2013Q4", "2014Q1", and so on
  • I'd like to create a line at quarter 6th (2015Q1) to show when the shock happened.
  • label upb0 (blue line) = "non-FHA" and upb1 (red line) = "FHA"
I've looked up and I tried to do ytitle, title, subtitle, and legend command, but it wouldn't work. The error says "command ... is unrecognized" I'm not sure if this is because I use sort? or two-way graph?
Any advice is appreciated. Thank you so much in advance!