I'm interested in saving a matrix generated by Mark Schaffer 's cvlasso from lassopack so that I may do other things with it. Here's my code
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 noi
As we can see, the predict command (when the noisy option is specified anyways) returns the predictors of interest. How might I save this matrix into another matrix, Matrix A for example, such that I can
Code:
mat l A
and it spits these betas back at me. I'm familiar with using matrices generated by I guess what we'd call "normal" estimation commands, but I've never had to do this with the predict command. Any ideas on how I'd do this?