LASSO Regression using Panel Data

I have panel data for 3 countries, ranging over 3 years. The dataset is called CarProduction

Country    Year       cars       Fuel_price     PPP      Manufact      PublicTransport

USA        2015       500           5         10000          9                2
USA        2016       700           5.2       10500          8.75           2.2
USA        2017       780           5.4       11000          8.6            1.9
China      2015       150           9          4000          11               3
China      2016       200           8.6        4500          11.5             4
China      2017       340           9.4        6000          15.6             5
Italy      2015       200           9          4000          11               5
Italy      2016       300           8.6        4500          11.5           6.2
Italy      2017       440           9.4        6000          15.6           6.7

I know that the glmnet package can be used in R to run a LASSO regression.

Considering that I have panel data, how do I run LASSO regression on panel data?

I will be implementing OLS for comparison purposes. This is the regression I would ordinarily run, accounting for fixed effects:

ans - plm(cars ~ Fuel_price+PPP+Manufact+PublicTransport, data=CarProduction, model="within")

Topic glm r machine-learning

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.