We will illustrate some of the methods outlined during the lectures. Note that we will update the tasks or data as necessary for new methods introduced during upcoming lectures. In some cases, we may need to present an additional dataset to carry out some examples.
Generally, a number of example datasets can be found at Principles of Econometrics book website with their dataset definitions or from R datasets which are available in both R and Python.
Use the following datasets:
auto
mobile or via public transportation. The dataset can be loaded in both R
and Python
:#
#
dt1 <- read.csv(file = "http://www.principlesofeconometrics.com/poe5/data/csv/transport.csv", sep = ",", dec = ".", header = TRUE)
import pandas as pd
#
dt1 = pd.read_csv("http://www.principlesofeconometrics.com/poe5/data/csv/transport.csv")
Survive
based on their age, gender, economic status and other factors. The dataset can be loaded in both R
and Python
:#dt2 <- datasets::Titanic
#
#install.packages("titanic")
#dt2 <- titanic::titanic_train
dt2 <- read.csv(file = "https://raw.githubusercontent.com/paulhendricks/titanic/master/inst/data-raw/train.csv", sep = ",", dec = ".", header = TRUE)
#import statsmodels.api as sm
#
#dt2 = sm.datasets.get_rdataset("Titanic", "datasets")
#print(dt2.__doc__) #documentation about the data
#dt2 = dt2.data
import pandas as pd
#
dt2 = pd.read_csv("https://raw.githubusercontent.com/paulhendricks/titanic/master/inst/data-raw/train.csv")
coke
, or pepsi.dt3 <- read.csv(file = "http://www.principlesofeconometrics.com/poe5/data/csv/coke.csv", sep = ",", dec = ".", header = TRUE)
dt3 = pd.read_csv("http://www.principlesofeconometrics.com/poe5/data/csv/coke.csv")
default
on their credit card debt.dt4 <- ISLR::Default
import statsmodels.api as sm
#
dt4 = sm.datasets.get_rdataset("Default", "ISLR")
#print(dt4.__doc__) #documentation about the data
dt4 = dt4.data
inlf
.dt5 <- foreign::read.dta("http://fmwww.bc.edu/ec-p/data/wooldridge/mroz.dta")
dt5 <- data.frame(dt5)
import pandas as pd
#
dt5 = pd.read_stata("http://fmwww.bc.edu/ec-p/data/wooldridge/mroz.dta")
#print(dt5.head())
Below are the tasks that you should carry out for the datasets:
(2018-12-13)
(2018-12-21)