I am doing linear models in R. My factors include birth rates, death rates, infant mortality rates, life expectancies, and region. region has 7 levels, using numerical numbers to represent each region:
- East Asia & Pacific
- South Asia
- Europe & Central Asia
- North America
- Latin America
- Middle East & North Africa
- Sub-Saharan Africa
I ran a Lasso Regression in R to try to improve the generalized linear model. The Lasso Regression coefficients is as follows:
I will put the factors selected by Lasso Regression into the lm function in R:
Lasso.lm <- lm(log(GNIpercapita) ~ deathrate + infantdeaths + life.exp.avg +
life.exp.diff + region, data=econdev)
However, for regions, how do I add each region into the linear model lm? For example, regionEast Asia & Pacific
, I can't jut add as + regionEast Asia & Pacific
.