if (FALSE) {
library(hdm)
data(AJR); y = AJR$GDP; d = AJR$Exprop; z = AJR$logMort
x = model.matrix(~ -1 + (Latitude + Latitude2 + Africa +
Asia + Namer + Samer)^2, data=AJR)
AJR.Xselect = rlassoIV(GDP ~ Exprop + (Latitude + Latitude2 + Africa + Asia + Namer + Samer)^2 |
logMort + (Latitude + Latitude2 + Africa + Asia + Namer + Samer)^2,
data=AJR, select.X=TRUE, select.Z=FALSE)
coef(AJR.Xselect) # Default behavior
coef(AJR.Xselect, selection.matrix = TRUE) # print selection matrix
}
Run the code above in your browser using DataLab