Code:
import delim "https://raw.githubusercontent.com/synth-inference/synthdid/master/data/california_prop99.csv", clear
qui {
egen id = group(state) // makes a unique ID
xtset id year, y // We now have yearly panel data
drop state treated // irrelevant for our purposes
rename packs sale // I didn't like the original variable name
greshape wide sale, j(id) i( year) // Note that I use greshape, but feel free to use normal reshape
tsset year, y
loc stub sale
}
qui cvlasso `stub'3 sale1 sale2 sale4-sale39 if year < 1989, roll h(2) lglmnet
predict cf, lse noiCode:
mat l A
0 Response to Saving a Matrix from the Predict Command
Post a Comment