I would like to run the same regression each year and then plot the coefficients with years on the x-axis and beta on the y-axis.
Here is an MWE. Any suggestions
Here is an MWE. Any suggestions
Code:
clear all
input year y x
2001 1 1
2001 2 0
2001 2 0
2002 1 1
2002 3 0
2002 2 1
2003 1 1
2003 3 0
2003 5 1
2004 6 0
2004 2 1
2004 1 1
2004 4 0
2004 1 0
2005 1 1
2005 2 1
2005 3 0
2005 1 0
end
levelsof year, local(levels)
foreach y in `levels' {
reg y x if year == `y'
}

Comment