Title: | Panel Data Econometrics with R |
---|---|
Description: | Data sets for the Panel Data Econometrics with R <doi:10.1002/9781119504641> book. |
Authors: | Yves Croissant [aut, cre] , Giovanni Millo [aut] |
Maintainer: | Yves Croissant <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0-2 |
Built: | 2024-11-22 04:52:28 UTC |
Source: | https://github.com/cran/pder |
a pseudo-panel of 1518 resumes from 2014
number of observations : 6072
number of individual observations : 4
country : United States
package : binomial
JEL codes: E24, E32, J14, J22, J23, J64
Chapter : 08
data(CallBacks)
data(CallBacks)
A dataframe containing:
the job index
unemployment duration in month
a dummy for interim experience
a dummy for call backs
a dummy for age 57-58
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Farber, Henry S.; Silverman, Dan and Till von Wachter (2016) “Determinants of Callbacks to Job Applications: An Audit Study”, American Economic Review, 106(5), 314-318, doi:10.1257/aer.p20161010 .
a pseudo-panel of 240 individuals
number of observations : 7168
number of individual observations : 30
country : United States and Spain
package : ordinalpanelexpe
JEL codes: C92, D23
Chapter : 08
data(CoordFailure)
data(CoordFailure)
A dataframe containing:
the firm index
the individual index
the period
either Cleveland or Barcelona
the bonus for the first block of 10 rounds
the bonus for the second block of 10 rounds
the bonus for the third block of 10 rounds
the level of effort of the employee
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Brandts, Jordi and David J. Cooper (2006) “A Change Would Do You Good... An Experimental Study on How to Overcome Coordination Failure in Organizations”, American Economic Review, 96(3), 669-693, doi:10.1257/aer.96.3.669 .
5-yearly observations of 211 countries from 1950 to 2000
number of observations : 2321
number of time-series : 11
country : world
package : panel
JEL codes: D72, O47
Chapter : 02, 07
data(DemocracyIncome)
data(DemocracyIncome)
A dataframe containing:
country
the starting year of the 5-years period
democracy index
the log of the gdp per capita
a dummy variable to select the subset used in the original article
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Daron Acemoglu, Simon Johnson, James A. Robinson and Pierre Yared (2008) “Income and Democracy”, American Economic Review, 98(3), 808-842, doi:10.1257/aer.98.3.808 .
#### Example 7-1 ## ------------------------------------------------------------------------ ## Not run: data("DemocracyIncome", package = "pder") ## ------------------------------------------------------------------------ data("DemocracyIncome", package="pder") set.seed(1) di2000 <- subset(DemocracyIncome, year == 2000, select = c("democracy", "income", "country")) di2000 <- na.omit(di2000) di2000$country <- as.character(di2000$country) di2000$country[- c(2,5, 23, 16, 17, 22, 71, 125, 37, 43, 44, 79, 98, 105, 50, 120, 81, 129, 57, 58,99)] <- NA if(requireNamespace("ggplot2")){ library("ggplot2") ggplot(di2000, aes(income, democracy, label = country)) + geom_point(size = 0.4) + geom_text(aes(y= democracy + sample(0.03 * c(-1, 1), nrow(di2000), replace = TRUE)), size = 2) + theme(legend.text = element_text(size = 6), legend.title= element_text(size = 8), axis.title = element_text(size = 8), axis.text = element_text(size = 6)) } ## ------------------------------------------------------------------------ library("plm") pdim(DemocracyIncome) head(DemocracyIncome, 4) #### Example 7-2 ## ------------------------------------------------------------------------ mco <- plm(democracy ~ lag(democracy) + lag(income) + year - 1, DemocracyIncome, index = c("country", "year"), model = "pooling", subset = sample == 1) ## ------------------------------------------------------------------------ mco <- plm(democracy ~ lag(democracy) + lag(income), DemocracyIncome, index = c("country", "year"), model = "within", effect = "time", subset = sample == 1) coef(summary(mco)) #### Example 7-3 ## ------------------------------------------------------------------------ within <- update(mco, effect = "twoways") coef(summary(within)) #### Example 7-4 ## ------------------------------------------------------------------------ ahsiao <- plm(diff(democracy) ~ lag(diff(democracy)) + lag(diff(income)) + year - 1 | lag(democracy, 2) + lag(income, 2) + year - 1, DemocracyIncome, index = c("country", "year"), model = "pooling", subset = sample == 1) coef(summary(ahsiao))[1:2, ] #### Example 7-5 ## ------------------------------------------------------------------------ diff1 <- pgmm(democracy ~ lag(democracy) + lag(income) | lag(democracy, 2:99)| lag(income, 2), DemocracyIncome, index=c("country", "year"), model="onestep", effect="twoways", subset = sample == 1) coef(summary(diff1)) ## ------------------------------------------------------------------------ diff2 <- update(diff1, model = "twosteps") coef(summary(diff2)) #### Example 7-7 ## ------------------------------------------------------------------------ sys2 <- pgmm(democracy ~ lag(democracy) + lag(income) | lag(democracy, 2:99)| lag(income, 2), DemocracyIncome, index = c("country", "year"), model = "twosteps", effect = "twoways", transformation = "ld") coef(summary(sys2)) #### Example 7-8 ## ------------------------------------------------------------------------ sqrt(diag(vcov(diff2)))[1:2] sqrt(diag(vcovHC(diff2)))[1:2] #### Example 7-10 ## ------------------------------------------------------------------------ mtest(diff2, order = 2) #### Example 7-9 ## ------------------------------------------------------------------------ sargan(diff2) sargan(sys2) ## End(Not run)
#### Example 7-1 ## ------------------------------------------------------------------------ ## Not run: data("DemocracyIncome", package = "pder") ## ------------------------------------------------------------------------ data("DemocracyIncome", package="pder") set.seed(1) di2000 <- subset(DemocracyIncome, year == 2000, select = c("democracy", "income", "country")) di2000 <- na.omit(di2000) di2000$country <- as.character(di2000$country) di2000$country[- c(2,5, 23, 16, 17, 22, 71, 125, 37, 43, 44, 79, 98, 105, 50, 120, 81, 129, 57, 58,99)] <- NA if(requireNamespace("ggplot2")){ library("ggplot2") ggplot(di2000, aes(income, democracy, label = country)) + geom_point(size = 0.4) + geom_text(aes(y= democracy + sample(0.03 * c(-1, 1), nrow(di2000), replace = TRUE)), size = 2) + theme(legend.text = element_text(size = 6), legend.title= element_text(size = 8), axis.title = element_text(size = 8), axis.text = element_text(size = 6)) } ## ------------------------------------------------------------------------ library("plm") pdim(DemocracyIncome) head(DemocracyIncome, 4) #### Example 7-2 ## ------------------------------------------------------------------------ mco <- plm(democracy ~ lag(democracy) + lag(income) + year - 1, DemocracyIncome, index = c("country", "year"), model = "pooling", subset = sample == 1) ## ------------------------------------------------------------------------ mco <- plm(democracy ~ lag(democracy) + lag(income), DemocracyIncome, index = c("country", "year"), model = "within", effect = "time", subset = sample == 1) coef(summary(mco)) #### Example 7-3 ## ------------------------------------------------------------------------ within <- update(mco, effect = "twoways") coef(summary(within)) #### Example 7-4 ## ------------------------------------------------------------------------ ahsiao <- plm(diff(democracy) ~ lag(diff(democracy)) + lag(diff(income)) + year - 1 | lag(democracy, 2) + lag(income, 2) + year - 1, DemocracyIncome, index = c("country", "year"), model = "pooling", subset = sample == 1) coef(summary(ahsiao))[1:2, ] #### Example 7-5 ## ------------------------------------------------------------------------ diff1 <- pgmm(democracy ~ lag(democracy) + lag(income) | lag(democracy, 2:99)| lag(income, 2), DemocracyIncome, index=c("country", "year"), model="onestep", effect="twoways", subset = sample == 1) coef(summary(diff1)) ## ------------------------------------------------------------------------ diff2 <- update(diff1, model = "twosteps") coef(summary(diff2)) #### Example 7-7 ## ------------------------------------------------------------------------ sys2 <- pgmm(democracy ~ lag(democracy) + lag(income) | lag(democracy, 2:99)| lag(income, 2), DemocracyIncome, index = c("country", "year"), model = "twosteps", effect = "twoways", transformation = "ld") coef(summary(sys2)) #### Example 7-8 ## ------------------------------------------------------------------------ sqrt(diag(vcov(diff2)))[1:2] sqrt(diag(vcovHC(diff2)))[1:2] #### Example 7-10 ## ------------------------------------------------------------------------ mtest(diff2, order = 2) #### Example 7-9 ## ------------------------------------------------------------------------ sargan(diff2) sargan(sys2) ## End(Not run)
25-yearly observations of 25 countries from 1850 to 2000
number of observations : 175
number of time-series : 7
country : world
package : panel
JEL codes: D72, O47
Chapter : 02, 07
data(DemocracyIncome25)
data(DemocracyIncome25)
A dataframe containing:
country
the starting year of the 5-years period
democracy index
the log of the gdp per capita
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Daron Acemoglu, Simon Johnson, James A. Robinson and Pierre Yared (2008) “Income and Democracy”, American Economic Review, 98(3), 808-842, doi:10.1257/aer.98.3.808 .
#### Example 2-7 ## ------------------------------------------------------------------------ library("plm") data("DemocracyIncome25", package = "pder") DI <- pdata.frame(DemocracyIncome25) summary(lag(DI$income)) ercomp(democracy ~ lag(income), DI) models <- c("within", "random", "pooling", "between") sapply(models, function(x) coef(plm(democracy ~ lag(income), DI, model = x))["lag(income)"]) #### Example 7-6 ## ------------------------------------------------------------------------ data("DemocracyIncome25", package = "pder") pdim(DemocracyIncome25) ## ------------------------------------------------------------------------ diff25 <- pgmm(democracy ~ lag(democracy) + lag(income) | lag(democracy, 2:99) + lag(income, 2:99), DemocracyIncome25, model = "twosteps") ## ------------------------------------------------------------------------ diff25lim <- pgmm(democracy ~ lag(democracy) + lag(income) | lag(democracy, 2:4)+ lag(income, 2:4), DemocracyIncome25, index=c("country", "year"), model="twosteps", effect="twoways", subset = sample == 1) diff25coll <- pgmm(democracy ~ lag(democracy) + lag(income) | lag(democracy, 2:99)+ lag(income, 2:99), DemocracyIncome25, index=c("country", "year"), model="twosteps", effect="twoways", subset = sample == 1, collapse = TRUE) sapply(list(diff25, diff25lim, diff25coll), function(x) coef(x)[1:2]) #### Example 7-9 ## ------------------------------------------------------------------------ sapply(list(diff25, diff25lim, diff25coll), function(x) sargan(x)[["p.value"]])
#### Example 2-7 ## ------------------------------------------------------------------------ library("plm") data("DemocracyIncome25", package = "pder") DI <- pdata.frame(DemocracyIncome25) summary(lag(DI$income)) ercomp(democracy ~ lag(income), DI) models <- c("within", "random", "pooling", "between") sapply(models, function(x) coef(plm(democracy ~ lag(income), DI, model = x))["lag(income)"]) #### Example 7-6 ## ------------------------------------------------------------------------ data("DemocracyIncome25", package = "pder") pdim(DemocracyIncome25) ## ------------------------------------------------------------------------ diff25 <- pgmm(democracy ~ lag(democracy) + lag(income) | lag(democracy, 2:99) + lag(income, 2:99), DemocracyIncome25, model = "twosteps") ## ------------------------------------------------------------------------ diff25lim <- pgmm(democracy ~ lag(democracy) + lag(income) | lag(democracy, 2:4)+ lag(income, 2:4), DemocracyIncome25, index=c("country", "year"), model="twosteps", effect="twoways", subset = sample == 1) diff25coll <- pgmm(democracy ~ lag(democracy) + lag(income) | lag(democracy, 2:99)+ lag(income, 2:99), DemocracyIncome25, index=c("country", "year"), model="twosteps", effect="twoways", subset = sample == 1, collapse = TRUE) sapply(list(diff25, diff25lim, diff25coll), function(x) coef(x)[1:2]) #### Example 7-9 ## ------------------------------------------------------------------------ sapply(list(diff25, diff25lim, diff25coll), function(x) sargan(x)[["p.value"]])
yearly observations of 50 states from 1977 to 1990
number of observations : 700
number of time-series : 14
country : United States
package : panel
JEL codes: I18, O31
Chapter : 09
data(Dialysis)
data(Dialysis)
A dataframe containing:
the state id
the year of observation
the number of equipment divided by the number of the equipment in the given state for the most recent period
a linear trend
a dummy variable for the presence of a certificate of need regulation for the given state and the given period
Journal of Applied Econometrics Data Archive : http://qed.econ.queensu.ca/jae/
Steven B. Caudill, Jon M. Ford and David L. Kaserman (1995) “Certificate of Need Regulation and the Diffusion of Innovations : a Random Coefficient Model”, Journal of Applied Econometrics, 10, 73–78., doi:10.1002/jae.3950100107 .
#### Example 9-1 ## ------------------------------------------------------------------------ library("plm") ## ------------------------------------------------------------------------ data("Dialysis", package = "pder") rndcoef <- pvcm(log(diffusion / (1 - diffusion)) ~ trend + trend:regulation, Dialysis, model="random") summary(rndcoef) ## ------------------------------------------------------------------------ cbind(coef(rndcoef), stdev = sqrt(diag(rndcoef$Delta)))
#### Example 9-1 ## ------------------------------------------------------------------------ library("plm") ## ------------------------------------------------------------------------ data("Dialysis", package = "pder") rndcoef <- pvcm(log(diffusion / (1 - diffusion)) ~ trend + trend:regulation, Dialysis, model="random") summary(rndcoef) ## ------------------------------------------------------------------------ cbind(coef(rndcoef), stdev = sqrt(diag(rndcoef$Delta)))
a pseudo-panel of 32 individuals from 2006
number of observations : 1039
number of individual observations : 4-80
country : United States
package : limdeppanel
JEL codes: C93, D64, D82, H41, L31, Z12
Chapter : 08
data(Donors)
data(Donors)
A dataframe containing:
the id of the sollicitor
the sex of the sollicitor
does the sollicitor belongs to a minority ?
beauty rating for the sollicitor
assertive rating for the sollicitor
social rating for the sollicitor
efficacy rating for the sollicitor
performance rating for the sollicitor
confidence rating for the sollicitor
age of the individual
sex of the individual
does the individual belongs to a minority
the treatment, one of "vcm", "sgift" and "lgift"
has the individual refused the gift ?
the amount of the donation
has the individual been visited during the previous campaign ?
the treatment during the previous campaign, one of "none", "vcm", and "lottery"
has the individual made a donation during the previous campaign ?
the amount of the donation during the previous campaign
the sex of the sollicitor during the previous campaign
did the sollicitor of the previous campaign belong to a minority ?
beauty rating for the sollicitor of the previous campaign
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Landry, Craig E.; Lange, Andreas; List, John A.; Price, Michael K. and Nicholas G. Rupp (2010) “Is a Donor in Hand Better Than Two in the Bush ? Evidence From a Natural Field Experiment”, American Economic Review, 100(3), 958–983, doi:10.1257/aer.100.3.958 .
#### Example 8-5 ## ------------------------------------------------------------------------ ## Not run: data("Donors", package = "pder") library("plm") T3.1 <- plm(donation ~ treatment + prcontr, Donors, index = "id") T3.2 <- plm(donation ~ treatment * prcontr - prcontr, Donors, index = "id") T5.A <- pldv(donation ~ treatment + prcontr, Donors, index = "id", model = "random", method = "bfgs") T5.B <- pldv(donation ~ treatment * prcontr - prcontr, Donors, index = "id", model = "random", method = "bfgs") ## End(Not run)
#### Example 8-5 ## ------------------------------------------------------------------------ ## Not run: data("Donors", package = "pder") library("plm") T3.1 <- plm(donation ~ treatment + prcontr, Donors, index = "id") T3.2 <- plm(donation ~ treatment * prcontr - prcontr, Donors, index = "id") T5.A <- pldv(donation ~ treatment + prcontr, Donors, index = "id", model = "random", method = "bfgs") T5.B <- pldv(donation ~ treatment * prcontr - prcontr, Donors, index = "id", model = "random", method = "bfgs") ## End(Not run)
Spatial weights matrix for the EvapoTransp data frame
data(etw)
data(etw)
A 86x86 matrix with elements different from zero if area i and j are neighbours. Weights are row standardized.
Giovanni Millo
a pseudo-panel of 86 areas from 2008
number of observations : 430
number of individual observations : 5
country : France
package : panel
Chapter : 10
data(EvapoTransp)
data(EvapoTransp)
A dataframe containing:
observation site
measuring period
evapotranspiration
precipitation
mean soil moisture deficit
potential evapotranspiration
infiltration rate
biomass
biomass in early growing season
biomass in main growth period
peak biomass
peak biomass after clipping
biomass in autumn
plant cover
soft-leaved forbs
tall grass
species diversity
mat-forming graminoids
dwarf shrubs
abundance of legumes
kindly provided by the authors
Obojes, N.; Bahn, M.; Tasser, E.; Walde, J.; Inauen, N.; Hiltbrunner, E.; Saccone, P.; Lochet, J.; Clément, J. and S. Lavorel (2015) “Vegetation Effects on the Water Balance of Mountain Grasslands Depend on Climatic Conditions”, Ecohydrology, 8(4), 552-569, doi:10.1002/eco.1524 .
#### Example 10-14 ## ------------------------------------------------------------------------ ## Not run: data("EvapoTransp", package = "pder") data("etw", package = "pder") if (requireNamespace("splm")){ library("splm") evapo <- et ~ prec + meansmd + potet + infil + biomass + plantcover + softforbs + tallgrass + diversity + matgram + dwarfshrubs + legumes semsr.evapo <- spreml(evapo, data=EvapoTransp, w=etw, lag=FALSE, errors="semsr") summary(semsr.evapo) } ## ------------------------------------------------------------------------ library("plm") if (requireNamespace("lmtest")){ coeftest(plm(evapo, EvapoTransp, model="pooling")) } ## ------------------------------------------------------------------------ if (requireNamespace("lmtest") & requireNamespace("splm")){ coeftest(spreml(evapo, EvapoTransp, w=etw, errors="sem")) } #### Example 10-17 ## ------------------------------------------------------------------------ if (requireNamespace("lmtest")){ saremsrre.evapo <- spreml(evapo, data = EvapoTransp, w = etw, lag = TRUE, errors = "semsr") summary(saremsrre.evapo)$ARCoefTable round(summary(saremsrre.evapo)$ErrCompTable, 6) } ## End(Not run)
#### Example 10-14 ## ------------------------------------------------------------------------ ## Not run: data("EvapoTransp", package = "pder") data("etw", package = "pder") if (requireNamespace("splm")){ library("splm") evapo <- et ~ prec + meansmd + potet + infil + biomass + plantcover + softforbs + tallgrass + diversity + matgram + dwarfshrubs + legumes semsr.evapo <- spreml(evapo, data=EvapoTransp, w=etw, lag=FALSE, errors="semsr") summary(semsr.evapo) } ## ------------------------------------------------------------------------ library("plm") if (requireNamespace("lmtest")){ coeftest(plm(evapo, EvapoTransp, model="pooling")) } ## ------------------------------------------------------------------------ if (requireNamespace("lmtest") & requireNamespace("splm")){ coeftest(spreml(evapo, EvapoTransp, w=etw, errors="sem")) } #### Example 10-17 ## ------------------------------------------------------------------------ if (requireNamespace("lmtest")){ saremsrre.evapo <- spreml(evapo, data = EvapoTransp, w = etw, lag = TRUE, errors = "semsr") summary(saremsrre.evapo)$ARCoefTable round(summary(saremsrre.evapo)$ErrCompTable, 6) } ## End(Not run)
5-yearly observations of 78 countries from 1960 to 1995
number of observations : 546
number of time-series : 7
country : world
package : panel
JEL codes: G20, O16, O47, C23, C33, O15
Chapter : 07
data(FinanceGrowth)
data(FinanceGrowth)
A dataframe containing:
country name
period
growth rate * 100
log private credit / GDP
log liquid liabilities / GDP
log bank credit/total credit
log initial gdp per capita (PPP)
mean years of secondary schooling
log government spending / GDP
log(1 black market premium)
log(1 + inflation rate)
log (imports + exports)/GDP
http://www.cgdev.org/content/publications/detail/14256
Levine, Ross; Loayza, Norman and Thorsten Beck (2000) “Financial Intermediation and Growth: Causality and Causes”, Journal of Monetary Economics, 46, 31-77, doi:10.1016/S0304-3932(00)00017-9 .
Roodman, David (2009) “A Note on the Theme of Two Many Instruments”, Oxford Bulletin of Economics An Statistics, 71(1), 135–158, doi:10.1111/j.1468-0084.2008.00542.x .
yearly observations of 31 countries from 1963 to 1986
number of observations : 744
number of time-series : 24
country : developing countries
package : panelivreg
JEL codes: O19, C51, F17
Chapter : 02, 06
data(ForeignTrade)
data(ForeignTrade)
A dataframe containing:
country name
year
nominal exports deflated by the unit value of exports per capita
nominal imports deflated by the unit value of exports per capita
official foreing reserves (in US dollars) divided by nominal imports (in US dollars)
real GNP per capita
trend real GNP per capita calculated by fitting linear trend yit*=y0iexp(gi t), where y0i is the initial value of real gnp per capita for country i and gi is the ith country's average growth rate over 1964-1986
real genp for USA per capita
unit value of imports (in US dollars), 1980 = 100
unit value of exports (in US dollars), 1980 = 100
domestic CPI, 1980 = 100
US producer's price index, 1980 = 100
exchange rate (price of US dollars in local currency), 1980 = 1
domestic consumption per capita,
domestic fixed gross investment per capita
domestic disposable income per capita
population
official foreing reserves (in US dollars)
domestic money supply per capita
trend dummy, 1964 = 1
log of us producer price index divided by domestic cpi
log of nominal imports divided by export prices
log of imports price divided by domestic cpi
log of exports price divided by domestic cpi
Journal of Applied Econometrics Data Archive : http://qed.econ.queensu.ca/jae/
Kinal, T. and K. Lahiri (1993) “On the Estimation of Simultaneous-equations Error-components Models with An Application to a Model of Developing Country Foreign Trade”, Journal of Applied Economics, 8, 81-92, doi:10.1002/jae.3950080107 .
#### Example 2-4 ## ------------------------------------------------------------------------ library("plm") data("ForeignTrade", package = "pder") FT <- pdata.frame(ForeignTrade) summary(FT$gnp) ercomp(imports ~ gnp, FT) models <- c("within", "random", "pooling", "between") sapply(models, function(x) coef(plm(imports ~ gnp, FT, model = x))["gnp"]) #### Example 6-2 ## ------------------------------------------------------------------------ data("ForeignTrade", package = "pder") w1 <- plm(imports~pmcpi + gnp + lag(imports) + lag(resimp) | lag(consump) + lag(cpi) + lag(income) + lag(gnp) + pm + lag(invest) + lag(money) + gnpw + pw + lag(reserves) + lag(exports) + trend + pgnp + lag(px), ForeignTrade, model = "within") r1 <- update(w1, model = "random", random.method = "nerlove", random.dfcor = c(1, 1), inst.method = "baltagi") ## ------------------------------------------------------------------------ phtest(r1, w1) ## ------------------------------------------------------------------------ r1b <- plm(imports ~ pmcpi + gnp + lag(imports) + lag(resimp) | lag(consump) + lag(cpi) + lag(income) + lag(px) + lag(reserves) + lag(exports) | lag(gnp) + pm + lag(invest) + lag(money) + gnpw + pw + trend + pgnp, ForeignTrade, model = "random", inst.method = "baltagi", random.method = "nerlove", random.dfcor = c(1, 1)) phtest(w1, r1b) ## ------------------------------------------------------------------------ rbind(within = coef(w1), ec2sls = coef(r1b)[-1]) ## ------------------------------------------------------------------------ elast <- sapply(list(w1, r1, r1b), function(x) c(coef(x)["pmcpi"], coef(x)["pmcpi"] / (1 - coef(x)["lag(imports)"]))) dimnames(elast) <- list(c("ST", "LT"), c("w1", "r1", "r1b")) elast ## ------------------------------------------------------------------------ rbind(within = coef(summary(w1))[, 2], ec2sls = coef(summary(r1b))[-1, 2]) #### Example 6-4 ## ------------------------------------------------------------------------ eqimp <- imports ~ pmcpi + gnp + lag(imports) + lag(resimp) | lag(consump) + lag(cpi) + lag(income) + lag(px) + lag(reserves) + lag(exports) | lag(gnp) + pm + lag(invest) + lag(money) + gnpw + pw + trend + pgnp eqexp <- exports ~ pxpw + gnpw + lag(exports) | lag(gnp) + pw + lag(consump) + pm + lag(px) + lag(cpi) | lag(money) + gnpw + pgnp + pop + lag(invest) + lag(income) + lag(reserves) + exrate r12 <- plm(list(import.demand = eqimp, export.demand = eqexp), data = ForeignTrade, index = 31, model = "random", inst.method = "baltagi", random.method = "nerlove", random.dfcor = c(1, 1)) summary(r12) ## ------------------------------------------------------------------------ rbind(ec2sls = coef(summary(r1b))[-1, 2], ec3sls = coef(summary(r12), "import.demand")[-1, 2])
#### Example 2-4 ## ------------------------------------------------------------------------ library("plm") data("ForeignTrade", package = "pder") FT <- pdata.frame(ForeignTrade) summary(FT$gnp) ercomp(imports ~ gnp, FT) models <- c("within", "random", "pooling", "between") sapply(models, function(x) coef(plm(imports ~ gnp, FT, model = x))["gnp"]) #### Example 6-2 ## ------------------------------------------------------------------------ data("ForeignTrade", package = "pder") w1 <- plm(imports~pmcpi + gnp + lag(imports) + lag(resimp) | lag(consump) + lag(cpi) + lag(income) + lag(gnp) + pm + lag(invest) + lag(money) + gnpw + pw + lag(reserves) + lag(exports) + trend + pgnp + lag(px), ForeignTrade, model = "within") r1 <- update(w1, model = "random", random.method = "nerlove", random.dfcor = c(1, 1), inst.method = "baltagi") ## ------------------------------------------------------------------------ phtest(r1, w1) ## ------------------------------------------------------------------------ r1b <- plm(imports ~ pmcpi + gnp + lag(imports) + lag(resimp) | lag(consump) + lag(cpi) + lag(income) + lag(px) + lag(reserves) + lag(exports) | lag(gnp) + pm + lag(invest) + lag(money) + gnpw + pw + trend + pgnp, ForeignTrade, model = "random", inst.method = "baltagi", random.method = "nerlove", random.dfcor = c(1, 1)) phtest(w1, r1b) ## ------------------------------------------------------------------------ rbind(within = coef(w1), ec2sls = coef(r1b)[-1]) ## ------------------------------------------------------------------------ elast <- sapply(list(w1, r1, r1b), function(x) c(coef(x)["pmcpi"], coef(x)["pmcpi"] / (1 - coef(x)["lag(imports)"]))) dimnames(elast) <- list(c("ST", "LT"), c("w1", "r1", "r1b")) elast ## ------------------------------------------------------------------------ rbind(within = coef(summary(w1))[, 2], ec2sls = coef(summary(r1b))[-1, 2]) #### Example 6-4 ## ------------------------------------------------------------------------ eqimp <- imports ~ pmcpi + gnp + lag(imports) + lag(resimp) | lag(consump) + lag(cpi) + lag(income) + lag(px) + lag(reserves) + lag(exports) | lag(gnp) + pm + lag(invest) + lag(money) + gnpw + pw + trend + pgnp eqexp <- exports ~ pxpw + gnpw + lag(exports) | lag(gnp) + pw + lag(consump) + pm + lag(px) + lag(cpi) | lag(money) + gnpw + pgnp + pop + lag(invest) + lag(income) + lag(reserves) + exrate r12 <- plm(list(import.demand = eqimp, export.demand = eqexp), data = ForeignTrade, index = 31, model = "random", inst.method = "baltagi", random.method = "nerlove", random.dfcor = c(1, 1)) summary(r12) ## ------------------------------------------------------------------------ rbind(ec2sls = coef(summary(r1b))[-1, 2], ec3sls = coef(summary(r12), "import.demand")[-1, 2])
yearly observations of 216 articles from 1970 to 2001
number of observations : 4880
number of time-series : 32
country : United States
package : countpanel
JEL codes: D02, D83, I23, O30
Chapter : 08
data(GiantsShoulders)
data(GiantsShoulders)
A dataframe containing:
the pair article index
the article index
material of the article is deposit on a Biological Ressource Center
publication year of the article
year of the deposit in brc of the material related to the article
the year index
the number of citations
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Furman, Jeffrey L. and Scott Stern (2011) “Climbing Atop the Shoulders of Giants: the Impact of Institutions on Cumulative Research”, American Economic Review, 101(5), 1933-1963, doi:10.1257/aer.101.5.1933 .
#### Example 8-6 ## ------------------------------------------------------------------------ ## Not run: data("GiantsShoulders", package = "pder") head(GiantsShoulders) ## ------------------------------------------------------------------------ if (requireNamespace("dplyr")){ library("dplyr") GiantsShoulders <- mutate(GiantsShoulders, age = year - pubyear) cityear <- summarise(group_by(GiantsShoulders, brc, age), cit = mean(citations, na.rm = TRUE)) GiantsShoulders <- mutate(GiantsShoulders, window = as.numeric( (brc == "yes") & abs(brcyear - year) <= 1), post_brc = as.numeric( (brc == "yes") & year - brcyear > 1), age = year - pubyear) GiantsShoulders$age[GiantsShoulders$age == 31] <- 0 #GiantsShoulders$year[GiantsShoulders$year #GiantsShoulders$year[GiantsShoulders$year GiantsShoulders$year[GiantsShoulders$year < 1975] <- 1970 GiantsShoulders$year[GiantsShoulders$year >= 1975 & GiantsShoulders$year < 1980] <- 1975 if (requireNamespace("pglm")){ library("pglm") t3c1 <- lm(log(1 + citations) ~ brc + window + post_brc + factor(age), data = GiantsShoulders) t3c2 <- update(t3c1, . ~ .+ factor(pair) + factor(year)) t3c3 <- pglm(citations ~ brc + window + post_brc + factor(age) + factor(year), data = GiantsShoulders, index = "pair", effect = "individual", model = "within", family = negbin) t3c4 <- pglm(citations ~ window + post_brc + factor(age) + factor(year), data = GiantsShoulders, index = "article", effect = "individual", model = "within", family = negbin) ## screenreg(list(t3c2, t3c3, t3c4), ## custom.model.names = c("ols: age/year/pair-FE", ## "NB:age/year/pair-FE", "NB: age/year/article-FE"), ## omit.coef="(factor)|(Intercept)", digits = 3) } } ## End(Not run)
#### Example 8-6 ## ------------------------------------------------------------------------ ## Not run: data("GiantsShoulders", package = "pder") head(GiantsShoulders) ## ------------------------------------------------------------------------ if (requireNamespace("dplyr")){ library("dplyr") GiantsShoulders <- mutate(GiantsShoulders, age = year - pubyear) cityear <- summarise(group_by(GiantsShoulders, brc, age), cit = mean(citations, na.rm = TRUE)) GiantsShoulders <- mutate(GiantsShoulders, window = as.numeric( (brc == "yes") & abs(brcyear - year) <= 1), post_brc = as.numeric( (brc == "yes") & year - brcyear > 1), age = year - pubyear) GiantsShoulders$age[GiantsShoulders$age == 31] <- 0 #GiantsShoulders$year[GiantsShoulders$year #GiantsShoulders$year[GiantsShoulders$year GiantsShoulders$year[GiantsShoulders$year < 1975] <- 1970 GiantsShoulders$year[GiantsShoulders$year >= 1975 & GiantsShoulders$year < 1980] <- 1975 if (requireNamespace("pglm")){ library("pglm") t3c1 <- lm(log(1 + citations) ~ brc + window + post_brc + factor(age), data = GiantsShoulders) t3c2 <- update(t3c1, . ~ .+ factor(pair) + factor(year)) t3c3 <- pglm(citations ~ brc + window + post_brc + factor(age) + factor(year), data = GiantsShoulders, index = "pair", effect = "individual", model = "within", family = negbin) t3c4 <- pglm(citations ~ window + post_brc + factor(age) + factor(year), data = GiantsShoulders, index = "article", effect = "individual", model = "within", family = negbin) ## screenreg(list(t3c2, t3c3, t3c4), ## custom.model.names = c("ols: age/year/pair-FE", ## "NB:age/year/pair-FE", "NB: age/year/article-FE"), ## omit.coef="(factor)|(Intercept)", digits = 3) } } ## End(Not run)
yearly observations of 49 regions from 1976 to 2003
number of observations : 1421
number of time-series : 29
country : United States
package : hedprice
JEL codes: C51, R31
Chapter : 09, 10
data(HousePricesUS)
data(HousePricesUS)
A dataframe containing:
state index
year
state name
state number plate index
region index
region name
real house price index, 1980=100
real per-capita income
total population
real interest rate on borrowing
Journal of Applied Econometrics Data Archive : http://qed.econ.queensu.ca/jae/
Holly, S.; Pesaran, M.G. and T. Yamagata (2010) “A Spatio-temporal Model of House Prices in the USA”, Journal of Econometrics, 158(1), 160–173, doi:10.1016/j.jeconom.2010.03.040 .
Millo, Giovanni (2015) “Narrow Replication of 'spatio-temporal Model of House Prices in the Usa', Using R”, Journal of Applied Econometrics, 30(4), 703–704, doi:10.1002/jae.2424 .
#### Example 4-11 ## ------------------------------------------------------------------------ ## Not run: data("HousePricesUS", package = "pder") library("plm") php <- pdata.frame(HousePricesUS) ## ------------------------------------------------------------------------ cbind("rho" = pcdtest(diff(log(php$price)), test = "rho")$statistic, "|rho|" = pcdtest(diff(log(php$price)), test = "absrho")$statistic) ## ------------------------------------------------------------------------ regions.names <- c("New Engl", "Mideast", "Southeast", "Great Lks", "Plains", "Southwest", "Rocky Mnt", "Far West") corr.table.hp <- cortab(diff(log(php$price)), grouping = php$region, groupnames = regions.names) colnames(corr.table.hp) <- substr(rownames(corr.table.hp), 1, 5) round(corr.table.hp, 2) ## ------------------------------------------------------------------------ pcdtest(diff(log(price)) ~ diff(lag(log(price))) + diff(lag(log(price), 2)), data = php) #### Example 9-2 ## ------------------------------------------------------------------------ data("HousePricesUS", package = "pder") swmod <- pvcm(log(price) ~ log(income), data = HousePricesUS, model= "random") mgmod <- pmg(log(price) ~ log(income), data = HousePricesUS, model = "mg") coefs <- cbind(coef(swmod), coef(mgmod)) dimnames(coefs)[[2]] <- c("Swamy", "MG") coefs #### Example 9-3 ## ------------------------------------------------------------------------ if (requireNamespace("texreg")){ library("texreg") data("RDSpillovers", package = "pder") fm.rds <- lny ~ lnl + lnk + lnrd mg.rds <- pmg(fm.rds, RDSpillovers, trend = TRUE) dmg.rds <- update(mg.rds, . ~ lag(lny) + .) screenreg(list('Static MG' = mg.rds, 'Dynamic MG'= dmg.rds), digits = 3) if (requireNamespace("msm")){ library("msm") b.lr <- coef(dmg.rds)["lnrd"]/(1 - coef(dmg.rds)["lag(lny)"]) SEb.lr <- deltamethod(~ x5 / (1 - x2), mean = coef(dmg.rds), cov = vcov(dmg.rds)) z.lr <- b.lr / SEb.lr pval.lr <- 2 * pnorm(abs(z.lr), lower.tail = FALSE) lr.lnrd <- matrix(c(b.lr, SEb.lr, z.lr, pval.lr), nrow=1) dimnames(lr.lnrd) <- list("lnrd (long run)", c("Est.", "SE", "z", "p.val")) round(lr.lnrd, 3) } } #### Example 9-4 ## ------------------------------------------------------------------------ housep.np <- pvcm(log(price) ~ log(income), data = HousePricesUS, model = "within") housep.pool <- plm(log(price) ~ log(income), data = HousePricesUS, model = "pooling") housep.within <- plm(log(price) ~ log(income), data = HousePricesUS, model = "within") d <- data.frame(x = c(coef(housep.np)[[1]], coef(housep.np)[[2]]), coef = rep(c("intercept", "log(income)"), each = nrow(coef(housep.np)))) if (requireNamespace("ggplot2")){ library("ggplot2") ggplot(d, aes(x)) + geom_histogram(col = "black", fill = "white", bins = 8) + facet_wrap(~ coef, scales = "free") + xlab("") + ylab("") } ## ------------------------------------------------------------------------ summary(housep.np) ## ------------------------------------------------------------------------ pooltest(housep.pool, housep.np) pooltest(housep.within, housep.np) #### Example 9-5 ## ------------------------------------------------------------------------ library("texreg") cmgmod <- pmg(log(price) ~ log(income), data = HousePricesUS, model = "cmg") screenreg(list(mg = mgmod, ccemg = cmgmod), digits = 3) #### Example 9-6 ## ------------------------------------------------------------------------ ccemgmod <- pcce(log(price) ~ log(income), data=HousePricesUS, model="mg") summary(ccemgmod) ## ------------------------------------------------------------------------ ccepmod <- pcce(log(price) ~ log(income), data=HousePricesUS, model="p") summary(ccepmod) #### Example 9-8 ## ------------------------------------------------------------------------ data("HousePricesUS", package = "pder") price <- pdata.frame(HousePricesUS)$price purtest(log(price), test = "levinlin", lags = 2, exo = "trend") purtest(log(price), test = "madwu", lags = 2, exo = "trend") purtest(log(price), test = "ips", lags = 2, exo = "trend") #### Example 9-9 ## ------------------------------------------------------------------------ tab5a <- matrix(NA, ncol = 4, nrow = 2) tab5b <- matrix(NA, ncol = 4, nrow = 2) for(i in 1:4) { mymod <- pmg(diff(log(income)) ~ lag(log(income)) + lag(diff(log(income)), 1:i), data = HousePricesUS, model = "mg", trend = TRUE) tab5a[1, i] <- pcdtest(mymod, test = "rho")$statistic tab5b[1, i] <- pcdtest(mymod, test = "cd")$statistic } for(i in 1:4) { mymod <- pmg(diff(log(price)) ~ lag(log(price)) + lag(diff(log(price)), 1:i), data=HousePricesUS, model="mg", trend = TRUE) tab5a[2, i] <- pcdtest(mymod, test = "rho")$statistic tab5b[2, i] <- pcdtest(mymod, test = "cd")$statistic } tab5a <- round(tab5a, 3) tab5b <- round(tab5b, 2) dimnames(tab5a) <- list(c("income", "price"), paste("ADF(", 1:4, ")", sep="")) dimnames(tab5b) <- dimnames(tab5a) tab5a tab5b ## ------------------------------------------------------------------------ php <- pdata.frame(HousePricesUS) cipstest(log(php$price), type = "drift") cipstest(diff(log(php$price)), type = "none") ## ------------------------------------------------------------------------ cipstest(resid(ccemgmod), type="none") cipstest(resid(ccepmod), type="none") #### Example 10-2 ## ------------------------------------------------------------------------ data("usaw49", package="pder") library("plm") php <- pdata.frame(HousePricesUS) pcdtest(php$price, w = usaw49) ## ------------------------------------------------------------------------ if (requireNamespace("splm")){ library("splm") rwtest(php$price, w = usaw49, replications = 999) } ## ------------------------------------------------------------------------ mgmod <- pmg(log(price) ~ log(income), data = HousePricesUS) ccemgmod <- pmg(log(price) ~ log(income), data = HousePricesUS, model = "cmg") pcdtest(resid(ccemgmod), w = usaw49) rwtest(resid(mgmod), w = usaw49, replications = 999) ## End(Not run)
#### Example 4-11 ## ------------------------------------------------------------------------ ## Not run: data("HousePricesUS", package = "pder") library("plm") php <- pdata.frame(HousePricesUS) ## ------------------------------------------------------------------------ cbind("rho" = pcdtest(diff(log(php$price)), test = "rho")$statistic, "|rho|" = pcdtest(diff(log(php$price)), test = "absrho")$statistic) ## ------------------------------------------------------------------------ regions.names <- c("New Engl", "Mideast", "Southeast", "Great Lks", "Plains", "Southwest", "Rocky Mnt", "Far West") corr.table.hp <- cortab(diff(log(php$price)), grouping = php$region, groupnames = regions.names) colnames(corr.table.hp) <- substr(rownames(corr.table.hp), 1, 5) round(corr.table.hp, 2) ## ------------------------------------------------------------------------ pcdtest(diff(log(price)) ~ diff(lag(log(price))) + diff(lag(log(price), 2)), data = php) #### Example 9-2 ## ------------------------------------------------------------------------ data("HousePricesUS", package = "pder") swmod <- pvcm(log(price) ~ log(income), data = HousePricesUS, model= "random") mgmod <- pmg(log(price) ~ log(income), data = HousePricesUS, model = "mg") coefs <- cbind(coef(swmod), coef(mgmod)) dimnames(coefs)[[2]] <- c("Swamy", "MG") coefs #### Example 9-3 ## ------------------------------------------------------------------------ if (requireNamespace("texreg")){ library("texreg") data("RDSpillovers", package = "pder") fm.rds <- lny ~ lnl + lnk + lnrd mg.rds <- pmg(fm.rds, RDSpillovers, trend = TRUE) dmg.rds <- update(mg.rds, . ~ lag(lny) + .) screenreg(list('Static MG' = mg.rds, 'Dynamic MG'= dmg.rds), digits = 3) if (requireNamespace("msm")){ library("msm") b.lr <- coef(dmg.rds)["lnrd"]/(1 - coef(dmg.rds)["lag(lny)"]) SEb.lr <- deltamethod(~ x5 / (1 - x2), mean = coef(dmg.rds), cov = vcov(dmg.rds)) z.lr <- b.lr / SEb.lr pval.lr <- 2 * pnorm(abs(z.lr), lower.tail = FALSE) lr.lnrd <- matrix(c(b.lr, SEb.lr, z.lr, pval.lr), nrow=1) dimnames(lr.lnrd) <- list("lnrd (long run)", c("Est.", "SE", "z", "p.val")) round(lr.lnrd, 3) } } #### Example 9-4 ## ------------------------------------------------------------------------ housep.np <- pvcm(log(price) ~ log(income), data = HousePricesUS, model = "within") housep.pool <- plm(log(price) ~ log(income), data = HousePricesUS, model = "pooling") housep.within <- plm(log(price) ~ log(income), data = HousePricesUS, model = "within") d <- data.frame(x = c(coef(housep.np)[[1]], coef(housep.np)[[2]]), coef = rep(c("intercept", "log(income)"), each = nrow(coef(housep.np)))) if (requireNamespace("ggplot2")){ library("ggplot2") ggplot(d, aes(x)) + geom_histogram(col = "black", fill = "white", bins = 8) + facet_wrap(~ coef, scales = "free") + xlab("") + ylab("") } ## ------------------------------------------------------------------------ summary(housep.np) ## ------------------------------------------------------------------------ pooltest(housep.pool, housep.np) pooltest(housep.within, housep.np) #### Example 9-5 ## ------------------------------------------------------------------------ library("texreg") cmgmod <- pmg(log(price) ~ log(income), data = HousePricesUS, model = "cmg") screenreg(list(mg = mgmod, ccemg = cmgmod), digits = 3) #### Example 9-6 ## ------------------------------------------------------------------------ ccemgmod <- pcce(log(price) ~ log(income), data=HousePricesUS, model="mg") summary(ccemgmod) ## ------------------------------------------------------------------------ ccepmod <- pcce(log(price) ~ log(income), data=HousePricesUS, model="p") summary(ccepmod) #### Example 9-8 ## ------------------------------------------------------------------------ data("HousePricesUS", package = "pder") price <- pdata.frame(HousePricesUS)$price purtest(log(price), test = "levinlin", lags = 2, exo = "trend") purtest(log(price), test = "madwu", lags = 2, exo = "trend") purtest(log(price), test = "ips", lags = 2, exo = "trend") #### Example 9-9 ## ------------------------------------------------------------------------ tab5a <- matrix(NA, ncol = 4, nrow = 2) tab5b <- matrix(NA, ncol = 4, nrow = 2) for(i in 1:4) { mymod <- pmg(diff(log(income)) ~ lag(log(income)) + lag(diff(log(income)), 1:i), data = HousePricesUS, model = "mg", trend = TRUE) tab5a[1, i] <- pcdtest(mymod, test = "rho")$statistic tab5b[1, i] <- pcdtest(mymod, test = "cd")$statistic } for(i in 1:4) { mymod <- pmg(diff(log(price)) ~ lag(log(price)) + lag(diff(log(price)), 1:i), data=HousePricesUS, model="mg", trend = TRUE) tab5a[2, i] <- pcdtest(mymod, test = "rho")$statistic tab5b[2, i] <- pcdtest(mymod, test = "cd")$statistic } tab5a <- round(tab5a, 3) tab5b <- round(tab5b, 2) dimnames(tab5a) <- list(c("income", "price"), paste("ADF(", 1:4, ")", sep="")) dimnames(tab5b) <- dimnames(tab5a) tab5a tab5b ## ------------------------------------------------------------------------ php <- pdata.frame(HousePricesUS) cipstest(log(php$price), type = "drift") cipstest(diff(log(php$price)), type = "none") ## ------------------------------------------------------------------------ cipstest(resid(ccemgmod), type="none") cipstest(resid(ccepmod), type="none") #### Example 10-2 ## ------------------------------------------------------------------------ data("usaw49", package="pder") library("plm") php <- pdata.frame(HousePricesUS) pcdtest(php$price, w = usaw49) ## ------------------------------------------------------------------------ if (requireNamespace("splm")){ library("splm") rwtest(php$price, w = usaw49, replications = 999) } ## ------------------------------------------------------------------------ mgmod <- pmg(log(price) ~ log(income), data = HousePricesUS) ccemgmod <- pmg(log(price) ~ log(income), data = HousePricesUS, model = "cmg") pcdtest(resid(ccemgmod), w = usaw49) rwtest(resid(mgmod), w = usaw49, replications = 999) ## End(Not run)
yearly observations of 317 households from 2000 to 2006
number of observations : 2219
number of time-series : 7
country : Indonesia
package : limdeppanel
JEL codes: F22, J43, O13, O15, Q11, Q12, R23
Chapter : 08
data(IncomeMigrationH)
data(IncomeMigrationH)
A dataframe containing:
household index
the year
a dummy indicating whether a household has any migrant departing in year t+1
rice price shock
rain shock
landholdings (ha)
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Bazzi, Samuel (2017) “Wealth Heterogeneity and the Income Elasticity of Migration”, American Economic Journal, Applied Economics, 9(2), 219–255, doi:10.1257/app.20150548 .
3-yearly observations of 44674 villages from 2005 to 2008
number of observations : 89348
number of time-series : 2
country : Indonesia
package : panellimdep
JEL codes: F22, J43, O13, O15, Q11, Q12, R23
Chapter : 08
data(IncomeMigrationV)
data(IncomeMigrationV)
A dataframe containing:
village index
the year
share of the emigrants in the total population
the district of the village
rice price shock
rain shock
Pareto parameter of the landholdings distribution
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Bazzi, Samuel (2017) “Wealth Heterogeneity and the Income Elasticity of Migration”, American Economic Journal, Applied Economics, 9(2), 219–255, doi:10.1257/app.20150548 .
C13 : Estimation: General
TexasElectr
: Production of electricity in Texas
Tileries
: Production of tileries in Egypt
C23 : Single Equation Models; Single Variables: Panel Data Models; Spatio-temporal Models
FinanceGrowth
: Financial institutions and growth
IneqGrowth
: Inequality and growth
TexasElectr
: Production of electricity in Texas
Tileries
: Production of tileries in Egypt
C33 : Multiple or Simultaneous Equation Models: Panel Data Models; Spatio-temporal Models
FinanceGrowth
: Financial institutions and growth
IneqGrowth
: Inequality and growth
C51 : Model Construction and Estimation
ForeignTrade
: Foreign Trade of Developing countries
HousePricesUS
: House Prices data
RDPerfComp
: R and D performing companies
RDSpillovers
: Research and development spillovers data
TexasElectr
: Production of electricity in Texas
Tileries
: Production of tileries in Egypt
TradeEU
: Trade in the European Union
C78 : Bargaining Theory; Matching Theory
LateBudgets
: Late Budgets
C90 : Design of Experiments: General
Seniors
: Intergenerationals experiments
C92 : Design of Experiments: Laboratory, Group Behavior
CoordFailure
: How to overcome organization failure in organization
C93 : Field Experiments
Donors
: Dynamics of charitable giving
D02 : Institutions: Design, Formation, Operations, and Impact
GiantsShoulders
: Impact of institutions on cumulative research
D23 : Organizational Behavior; Transaction Costs; Property Rights
CoordFailure
: How to overcome organization failure in organization
D24 : Production; Cost; Capital; Capital, Total Factor, and Multifactor Productivity; Capacity
RDPerfComp
: R and D performing companies
RDSpillovers
: Research and development spillovers data
TexasElectr
: Production of electricity in Texas
Tileries
: Production of tileries in Egypt
TurkishBanks
: Turkish Banks
D64 : Altruism; Philanthropy; Intergenerational Transfers
Donors
: Dynamics of charitable giving
D72 : Political Processes: Rent-seeking, Lobbying, Elections, Legislatures, and Voting Behavior
DemocracyIncome
: The relation between democraty and income
DemocracyIncome25
: The relation between democraty and income
LandReform
: Politics and land reforms in India
LateBudgets
: Late Budgets
Mafia
: Mafia and Public Spending
Reelection
: Deficits and reelection
RegIneq
: Interregional redistribution and inequalities
ScrambleAfrica
: The long-run effects of the scramble for Africa
D74 : Conflict; Conflict Resolution; Alliances; Revolutions
ScrambleAfrica
: The long-run effects of the scramble for Africa
D82 : Asymmetric and Private Information; Mechanism Design
Donors
: Dynamics of charitable giving
D83 : Search; Learning; Information and Knowledge; Communication; Belief; Unawareness
GiantsShoulders
: Impact of institutions on cumulative research
E24 : Employment; Unemployment; Wages; Intergenerational Income Distribution; Aggregate Human Capital; Aggregate Labor Productivity
CallBacks
: Callbacks to job applications
E32 : Business Fluctuations; Cycles
CallBacks
: Callbacks to job applications
E62 : Fiscal Policy
Mafia
: Mafia and Public Spending
Reelection
: Deficits and reelection
F12 : Models of Trade with Imperfect Competition and Scale Economies; Fragmentation
TradeFDI
: Trade and Foreign Direct Investment in Germany and the United States
F14 : Empirical Studies of Trade
F17 : Trade: Forecasting and Simulation
ForeignTrade
: Foreign Trade of Developing countries
F21 : International Investment; Long-term Capital Movements
TradeFDI
: Trade and Foreign Direct Investment in Germany and the United States
F22 : International Migration
IncomeMigrationH
: Income and Migration, household data
IncomeMigrationV
: Income and Migration, village data
F23 : Multinational Firms; International Business
TradeFDI
: Trade and Foreign Direct Investment in Germany and the United States
F32 : Current Account Adjustment; Short-term Capital Movements
TwinCrises
: Costs of currency and banking crises
F51 : International Conflicts; Negotiations; Sanctions
ScrambleAfrica
: The long-run effects of the scramble for Africa
G15 : International Financial Markets
TwinCrises
: Costs of currency and banking crises
G20 : Financial Institutions and Services: General
FinanceGrowth
: Financial institutions and growth
G21 : Banks; Depository Institutions; Micro Finance Institutions; Mortgages
TurkishBanks
: Turkish Banks
TwinCrises
: Costs of currency and banking crises
H23 : Taxation and Subsidies: Externalities; Redistributive Effects; Environmental Taxes and Subsidies
RegIneq
: Interregional redistribution and inequalities
H41 : Public Goods
Donors
: Dynamics of charitable giving
H61 : National Budget; Budget Systems
LateBudgets
: Late Budgets
H62 : National Deficit; Surplus
Reelection
: Deficits and reelection
H71 : State and Local Taxation, Subsidies, and Revenue
H72 : State and Local Budget and Expenditures
LateBudgets
: Late Budgets
H73 : State and Local Government; Intergovernmental Relations: Interjurisdictional Differentials and Their Effects
RegIneq
: Interregional redistribution and inequalities
H77 : Intergovernmental Relations; Federalism; Secession
RegIneq
: Interregional redistribution and inequalities
I18 : Health: Government Policy; Regulation; Public Health
Dialysis
: Diffusion of haemodialysis technology
I23 : Higher Education; Research Institutions
GiantsShoulders
: Impact of institutions on cumulative research
J14 : Economics of the Elderly; Economics of the Handicapped; Non-labor Market Discrimination
J15 : Economics of Minorities, Races, Indigenous Peoples, and Immigrants; Non-labor Discrimination
ScrambleAfrica
: The long-run effects of the scramble for Africa
J22 : Time Allocation and Labor Supply
CallBacks
: Callbacks to job applications
J23 : Labor Demand
CallBacks
: Callbacks to job applications
J26 : Retirement; Retirement Policies
Seniors
: Intergenerationals experiments
J31 : Wage Level and Structure; Wage Differentials
TexasElectr
: Production of electricity in Texas
Tileries
: Production of tileries in Egypt
J43 : Agricultural Labor Markets
IncomeMigrationH
: Income and Migration, household data
IncomeMigrationV
: Income and Migration, village data
J64 : Unemployment: Models, Duration, Incidence, and Job Search
CallBacks
: Callbacks to job applications
K42 : Illegal Behavior and the Enforcement of Law
L31 : Nonprofit Institutions; NGOs; Social Entrepreneurship
Donors
: Dynamics of charitable giving
L33 : Comparison of Public and Private Enterprises and Nonprofit Institutions; Privatization; Contracting Out
TurkishBanks
: Turkish Banks
L82 : Entertainment; Media
MagazinePrices
: Magazine prices
M12 : Personnel Management; Executives; Executive Compensation
Seniors
: Intergenerationals experiments
M51 : Personnel Economics: Firm Employment Decisions; Promotions
Seniors
: Intergenerationals experiments
O13 : Economic Development: Agriculture; Natural Resources; Energy; Environment; Other Primary Products
IncomeMigrationH
: Income and Migration, household data
IncomeMigrationV
: Income and Migration, village data
LandReform
: Politics and land reforms in India
O15 : Economic Development: Human Resources; Human Development; Income Distribution; Migration
FinanceGrowth
: Financial institutions and growth
IncomeMigrationH
: Income and Migration, household data
IncomeMigrationV
: Income and Migration, village data
IneqGrowth
: Inequality and growth
ScrambleAfrica
: The long-run effects of the scramble for Africa
O16 : Economic Development: Financial Markets; Saving and Capital Investment; Corporate Finance and Governance
FinanceGrowth
: Financial institutions and growth
IneqGrowth
: Inequality and growth
TwinCrises
: Costs of currency and banking crises
O17 : Formal and Informal Sectors; Shadow Economy; Institutional Arrangements
LandReform
: Politics and land reforms in India
ScrambleAfrica
: The long-run effects of the scramble for Africa
O19 : International Linkages to Development; Role of International Organizations
ForeignTrade
: Foreign Trade of Developing countries
TwinCrises
: Costs of currency and banking crises
O30 : Innovation; Research and Development; Technological Change; Intellectual Property Rights: General
GiantsShoulders
: Impact of institutions on cumulative research
O31 : Innovation and Invention: Processes and Incentives
Dialysis
: Diffusion of haemodialysis technology
O32 : Management of Technological Innovation and R&D
RDSpillovers
: Research and development spillovers data
O33 : Technological Change: Choices and Consequences; Diffusion Processes
RDSpillovers
: Research and development spillovers data
O41 : One, Two, and Multisector Growth Models
Solow
: Growth model
O47 : Empirical Studies of Economic Growth; Aggregate Productivity; Cross-Country Output Convergence
DemocracyIncome
: The relation between democraty and income
DemocracyIncome25
: The relation between democraty and income
FinanceGrowth
: Financial institutions and growth
IneqGrowth
: Inequality and growth
Reelection
: Deficits and reelection
Solow
: Growth model
TwinCrises
: Costs of currency and banking crises
Q11 : Agriculture: Aggregate Supply and Demand Analysis; Prices
IncomeMigrationH
: Income and Migration, household data
IncomeMigrationV
: Income and Migration, village data
Q12 : Micro Analysis of Farm Firms, Farm Households, and Farm Input Markets
IncomeMigrationH
: Income and Migration, household data
IncomeMigrationV
: Income and Migration, village data
Q15 : Land Ownership and Tenure; Land Reform; Land Use; Irrigation; Agriculture and Environment
LandReform
: Politics and land reforms in India
R12 : Size and Spatial Distributions of Regional Economic Activity
RegIneq
: Interregional redistribution and inequalities
R23 : Urban, Rural, Regional, Real Estate, and Transportation Economics: Regional Migration; Regional Labor Markets; Population; Neighborhood Characteristics
IncomeMigrationH
: Income and Migration, household data
IncomeMigrationV
: Income and Migration, village data
RegIneq
: Interregional redistribution and inequalities
R31 : Housing Supply and Markets
HousePricesUS
: House Prices data
R41 : Transportation: Demand, Supply, and Congestion; Travel Time; Safety and Accidents; Transportation Noise
SeatBelt
: Seat belt usage and traffic fatalities
Z12 : Cultural Economics: Religion
Donors
: Dynamics of charitable giving
Z13 : Economic Sociology; Economic Anthropology; Language; Social and Economic Stratification
ScrambleAfrica
: The long-run effects of the scramble for Africa
5-yearly observations of 266 world from 1961 to 1995
number of observations : 1862
number of time-series : 7
country : country
package : panel
JEL codes: O47, O15, C23, C33, O16
Chapter : 07
data(IneqGrowth)
data(IneqGrowth)
A dataframe containing:
country name
the period
growth rate
years of secondary schooling among women, lagged
years of secondary schooling among men, lagged
price level of investment, lagged
log initial gdp per capita
gini index
http://www.cgdev.org/content/publications/detail/14256
Forbes, Kristin J. (2000) “A Reassessment of the Relationship Between Inequality and Growth”, American Economic Review, 90(4), 869-887, doi:10.1257/aer.90.4.869 .
Roodman, David (2009) “A Note on the Theme of Two Many Instruments”, Oxford Bulletin of Economics An Statistics, 71(1), 135–158, doi:10.1111/j.1468-0084.2008.00542.x .
yearly observations of 89 villages from 1974 to 2003
number of observations : 2670
number of time-series : 30
country : India
package : panellimdep
JEL codes: D72, O13, O17, Q15
Chapter : 08
data(LandReform)
data(LandReform)
A dataframe containing:
village id number
Year
District
ratio of patta land registered to operational land
ratio of pattadar households to total households (hh)
ratio of barga land registered to operational land
ratio of bargadar registered hh to total hh
election year dummy
preelection year dummy
to complete
interpolated landless hh, gi
interpolated mg hh, gi
interpolated sm hh, gi
interpolated md hh, gi
ratio of land below 5 acres cultivable NOT extrapolated
ratio of land above 12.5 acres cultivable
interpolated ratio of illiterate non big hh
interpolated ratio of low caste hh
Left Front share in GP, == 0 for 1974
Assembly average vote difference LF-INC, district
Inflation in last 5 years in CPI for Agricultural Labourers
Year variation in Employment in Small Scale Industrial Units registered with Dir
INC seats / Total seats in Lok Sabha
Ratio of LF seats in parliament
Interaction between Inflation and ratleft lagged
Interaction between INC seats and ratleft lagged
Interaction between LF seats and ratleft lagged
Left Front share in GP, ==share of assembly seats for 1974
to complete
to complete
to complete
Gran Panchayat
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Bardhan, Pranab and Dilip Mookherjee (2010) “Determinants of Redistributive Politics: An Empirical Analysis of Land Reform in West Bengal, India”, American Economic Review, 100(4), 1572–1600, doi:10.1257/aer.100.4.1572 .
yearly observations of 48 States from 1978 to 2007
number of observations : 1440
number of time-series : 30
country : United States
package : limdeppanel
JEL codes: C78, D72, H61, H72
Chapter : 08
data(LateBudgets)
data(LateBudgets)
A dataframe containing:
the state
the year
late budget ?
number of days late for the budget
unemployment variation
split branch
split legislature
election year
end of year balances in the general fund and stabilization fund
democrat governor ?
lameduck
number of years since the incumbent governor took office
new governor ?
the polulation
percentage of population aged 5-17
percentage of population aged 65 or older
does the state law does not allow a budget deficit to be carried over to the next fiscal year ?
is a super majority required to pass each budget ?
full time legislature ?
shutdown provision ?
percentage of blacks
percentage of graduates
census response rate
five year dummies, one of '93-97', '98-02', '03-07'
is there a deadline ? one of 'none', 'soft' and 'hard'
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Andersen, Asger Lau; Lassen, David Dreyer and Lasse Holboll Westh Nielsen (2012) “Late Budgets”, American Economic Journal, Economic Policy, 4(4), 1-40, doi:10.1257/pol.4.4.1 .
#### Example 8-4 ## ------------------------------------------------------------------------ data("LateBudgets", package = "pder") library("plm") LateBudgets$dayslatepos <- pmax(LateBudgets$dayslate, 0) LateBudgets$divgov <- with(LateBudgets, factor(splitbranch == "yes" | splitleg == "yes", labels = c("no", "yes"))) LateBudgets$unemprise <- pmax(LateBudgets$unempdiff, 0) LateBudgets$unempfall <- - pmin(LateBudgets$unempdiff, 0) form <- dayslatepos ~ unemprise + unempfall + divgov + elecyear + pop + fulltimeleg + shutdown + censusresp + endbalance + kids + elderly + demgov + lameduck + newgov + govexp + nocarry + supmaj + black + graduate ## ------------------------------------------------------------------------ FEtobit <- pldv(form, LateBudgets) summary(FEtobit)
#### Example 8-4 ## ------------------------------------------------------------------------ data("LateBudgets", package = "pder") library("plm") LateBudgets$dayslatepos <- pmax(LateBudgets$dayslate, 0) LateBudgets$divgov <- with(LateBudgets, factor(splitbranch == "yes" | splitleg == "yes", labels = c("no", "yes"))) LateBudgets$unemprise <- pmax(LateBudgets$unempdiff, 0) LateBudgets$unempfall <- - pmin(LateBudgets$unempdiff, 0) form <- dayslatepos ~ unemprise + unempfall + divgov + elecyear + pop + fulltimeleg + shutdown + censusresp + endbalance + kids + elderly + demgov + lameduck + newgov + govexp + nocarry + supmaj + black + graduate ## ------------------------------------------------------------------------ FEtobit <- pldv(form, LateBudgets) summary(FEtobit)
yearly observations of 95 provinces from 1986 to 1999
number of observations : 1330
number of time-series : 14
country : Italy
package : panelivreg
JEL codes: D72, E62, H71, K42
Chapter : 06
data(Mafia)
data(Mafia)
A dataframe containing:
the province (95)
the region (19)
the year
the population
percentage growth of real per-capita value added
annual variation of the per-capita public investment in infrastructure divided by lagged real per-capita value added
number of municipalities placed under the administration of external commissioners
same as cd, provided that the official deccree is publisehd in the first semester of the year
same as cd, provided that the average number of days betwen the dismissal of the city concil and the year end is less than 180
change in the log of per-capita employment
change in the log of per-capita hours of wage supplement provided by the unemployment insurance scheme
first difference of the number of people reported by the police forces to the judicial authority because of mafia-type association
first difference of the number of people reported by the police forces to the judicial authority because of extorsion
first difference of the number of people reported by the police forces to the judicial authority because of corruption
first difference of the number of crimes reported by the police forces to the judicial authority because of corruption
first difference of the number of people reported by the police forces to the judicial authority because of murder related to mafia activity
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Acconcia, Antonio; Corsetti, Giancarlo and Saviero Simonelli (2014) “Mafia and Public Spending: Evidence on the Fiscal Multimplier Form a Quasi-experiment”, American Economic Review, 104(7), 2189-2209, doi:10.1257/aer.104.7.2185 .
yearly observations of 38 magazines from 1940 to 1980
number of observations : 1262
number of time-series : 41
country : United States
package : binomialpanel
JEL codes: L82
Chapter : 08
data(MagazinePrices)
data(MagazinePrices)
A dataframe containing:
the year
the magazine name
the price of the magazine in january
has the price changed between january of the current year and january of the following year ?
number of years since the previous price change
gdp deflator index
cummulative change in inflation since the previous price change
single copy sales of magazines for magazine industry
cumulative change in magazine industry sales since previous price change
is the observation included in the econometric analysis ?
group index numbers used for the conditional logit estimation
Journal of Applied Econometrics Data Archive : http://qed.econ.queensu.ca/jae/
Willis, Jonathan L. (2006) “Magazine Prices Revisited”, Journal of Applied Econometrics, 21(3), 337-344, doi:10.1002/jae.836 .
Cecchetti, Stephen G. (1986) “The Frequency of Price Adjustment, a Study of Newsstand Prices of Magazines”, Journal of Econometrics, 31, 255-274, doi:10.1016/0304-4076(86)90061-8 .
#### Example 8-3 ## ------------------------------------------------------------------------ data("MagazinePrices", package = "pder") logitS <- glm(change ~ length + cuminf + cumsales, data = MagazinePrices, subset = included == 1, family = binomial(link = 'logit')) logitD <- glm(change ~ length + cuminf + cumsales + magazine, data = MagazinePrices, subset = included == 1, family = binomial(link = 'logit')) if (requireNamespace("survival")){ library("survival") logitC <- clogit(change ~ length + cuminf + cumsales + strata(id), data = MagazinePrices, subset = included == 1) if (requireNamespace("texreg")){ library("texreg") screenreg(list(logit = logitS, "FE logit" = logitD, "cond. logit" = logitC), omit.coef = "magazine") } }
#### Example 8-3 ## ------------------------------------------------------------------------ data("MagazinePrices", package = "pder") logitS <- glm(change ~ length + cuminf + cumsales, data = MagazinePrices, subset = included == 1, family = binomial(link = 'logit')) logitD <- glm(change ~ length + cuminf + cumsales + magazine, data = MagazinePrices, subset = included == 1, family = binomial(link = 'logit')) if (requireNamespace("survival")){ library("survival") logitC <- clogit(change ~ length + cuminf + cumsales + strata(id), data = MagazinePrices, subset = included == 1) if (requireNamespace("texreg")){ library("texreg") screenreg(list(logit = logitS, "FE logit" = logitD, "cond. logit" = logitC), omit.coef = "magazine") } }
yearly observations of 509 firms from 1982 to 1989
number of observations : 4072
number of time-series : 8
country : United States
package : panel
JEL codes: C51, D24
Chapter : 07
data(RDPerfComp)
data(RDPerfComp)
A dataframe containing:
firm identifier
year
production in logs
labor in logs
capital in logs
author's website https://www.nuffield.ox.ac.uk/users/bond/index.html
Blundell, Richard and Stephen Bond (2000) “GMM Estimation with Persistent Panel Data: An Application to Production Functions”, Econometric Reviews, 19(3), 321-340, doi:10.1080/07474930008800475 .
a cross-section of 119 industries from 1980 to 2005
country : world
package : panel
JEL codes: C51, D24, O32, O33
Chapter : 04, 05, 09
data(RDSpillovers)
data(RDSpillovers)
A dataframe containing:
country-industry index
year
country
manufacturing sector as SIC 15-37, excluding SIC 23
log output
log of labour input
log of physical capital stock
log of RD capital stock
author's web site https://sites.google.com/site/medevecon/home
Eberhardt, M.; Helmers, C. and H. Strauss (2013) “Do Spillovers Matter in Estimating Private Returns to R and D?”, The Review of Economics and Statistics, 95(2), 436–448, doi:10.1162/REST_a_00272 .
#### Example 4-10 ## ------------------------------------------------------------------------ ## Not run: data("RDSpillovers", package = "pder") library("plm") fm.rds <- lny ~ lnl + lnk + lnrd ## ------------------------------------------------------------------------ pcdtest(fm.rds, RDSpillovers) ## ------------------------------------------------------------------------ rds.2fe <- plm(fm.rds, RDSpillovers, model = "within", effect = "twoways") pcdtest(rds.2fe) ## ------------------------------------------------------------------------ cbind("rho" = pcdtest(rds.2fe, test = "rho")$statistic, "|rho|"= pcdtest(rds.2fe, test = "absrho")$statistic) #### Example 5-10 ## ------------------------------------------------------------------------ data("RDSpillovers", package = "pder") pehs <- pdata.frame(RDSpillovers, index = c("id", "year")) ehsfm <- lny ~ lnl + lnk + lnrd phtest(ehsfm, pehs, method = "aux") ## ------------------------------------------------------------------------ phtest(ehsfm, pehs, method = "aux", vcov = vcovHC) #### Example 5-15 ## ------------------------------------------------------------------------ fm <- lny ~ lnl + lnk + lnrd ## ------------------------------------------------------------------------ if (requireNamespace("lmtest")){ library("lmtest") gglsmodehs <- pggls(fm, RDSpillovers, model = "pooling") coeftest(gglsmodehs) feglsmodehs <- pggls(fm, RDSpillovers, model = "within") coeftest(feglsmodehs) phtest(gglsmodehs, feglsmodehs) fdglsmodehs <- pggls(fm, RDSpillovers, model = "fd") fee <- resid(feglsmodehs) dbfee <- data.frame(fee=fee, id=attr(fee, "index")[[1]]) coeftest(plm(fee~lag(fee)+lag(fee,2), dbfee, model = "p", index="id")) fde <- resid(fdglsmodehs) dbfde <- data.frame(fde=fde, id=attr(fde, "index")[[1]]) coeftest(plm(fde~lag(fde)+lag(fde,2), dbfde, model = "p", index="id")) coeftest(fdglsmodehs) } #### Example 9-7 ## ------------------------------------------------------------------------ ccep.rds <- pcce(fm.rds, RDSpillovers, model="p") if (requireNamespace("lmtest")){ library("lmtest") ccep.tab <- cbind(coeftest(ccep.rds)[, 1:2], coeftest(ccep.rds, vcov = vcovNW)[, 2], coeftest(ccep.rds, vcov = vcovHC)[, 2]) dimnames(ccep.tab)[[2]][2:4] <- c("Nonparam.", "vcovNW", "vcovHC") round(ccep.tab, 3) } ## ------------------------------------------------------------------------ autoreg <- function(rho = 0.1, T = 100){ e <- rnorm(T+1) for (t in 2:(T+1)) e[t] <- e[t]+rho*e[t-1] e } set.seed(20) f <- data.frame(time = rep(0:40, 2), rho = rep(c(0.2, 1), each = 41), y = c(autoreg(rho = 0.2, T = 40), autoreg(rho = 1, T = 40))) if (requireNamespace("ggplot2")){ library("ggplot2") ggplot(f, aes(time, y)) + geom_line() + facet_wrap(~ rho) + xlab("") + ylab("") autoreg <- function(rho = 0.1, T = 100){ e <- rnorm(T) for (t in 2:(T)) e[t] <- e[t] + rho *e[t-1] e } tstat <- function(rho = 0.1, T = 100){ y <- autoreg(rho, T) x <- autoreg(rho, T) z <- lm(y ~ x) coef(z)[2] / sqrt(diag(vcov(z))[2]) } result <- c() R <- 1000 for (i in 1:R) result <- c(result, tstat(rho = 0.2, T = 40)) quantile(result, c(0.025, 0.975)) prop.table(table(abs(result) > 2)) result <- c() R <- 1000 for (i in 1:R) result <- c(result, tstat(rho = 1, T = 40)) quantile(result, c(0.025, 0.975)) prop.table(table(abs(result) > 2)) R <- 1000 T <- 100 result <- c() for (i in 1:R){ y <- autoreg(rho=1, T=100) Dy <- y[2:T] - y[1:(T-1)] Ly <- y[1:(T-1)] z <- lm(Dy ~ Ly) result <- c(result, coef(z)[2] / sqrt(diag(vcov(z))[2])) } ggplot(data.frame(x = result), aes(x = x)) + geom_histogram(fill = "white", col = "black", bins = 20, aes(y = ..density..)) + stat_function(fun = dnorm) + xlab("") + ylab("") prop.table(table(result < -1.64)) } ## End(Not run)
#### Example 4-10 ## ------------------------------------------------------------------------ ## Not run: data("RDSpillovers", package = "pder") library("plm") fm.rds <- lny ~ lnl + lnk + lnrd ## ------------------------------------------------------------------------ pcdtest(fm.rds, RDSpillovers) ## ------------------------------------------------------------------------ rds.2fe <- plm(fm.rds, RDSpillovers, model = "within", effect = "twoways") pcdtest(rds.2fe) ## ------------------------------------------------------------------------ cbind("rho" = pcdtest(rds.2fe, test = "rho")$statistic, "|rho|"= pcdtest(rds.2fe, test = "absrho")$statistic) #### Example 5-10 ## ------------------------------------------------------------------------ data("RDSpillovers", package = "pder") pehs <- pdata.frame(RDSpillovers, index = c("id", "year")) ehsfm <- lny ~ lnl + lnk + lnrd phtest(ehsfm, pehs, method = "aux") ## ------------------------------------------------------------------------ phtest(ehsfm, pehs, method = "aux", vcov = vcovHC) #### Example 5-15 ## ------------------------------------------------------------------------ fm <- lny ~ lnl + lnk + lnrd ## ------------------------------------------------------------------------ if (requireNamespace("lmtest")){ library("lmtest") gglsmodehs <- pggls(fm, RDSpillovers, model = "pooling") coeftest(gglsmodehs) feglsmodehs <- pggls(fm, RDSpillovers, model = "within") coeftest(feglsmodehs) phtest(gglsmodehs, feglsmodehs) fdglsmodehs <- pggls(fm, RDSpillovers, model = "fd") fee <- resid(feglsmodehs) dbfee <- data.frame(fee=fee, id=attr(fee, "index")[[1]]) coeftest(plm(fee~lag(fee)+lag(fee,2), dbfee, model = "p", index="id")) fde <- resid(fdglsmodehs) dbfde <- data.frame(fde=fde, id=attr(fde, "index")[[1]]) coeftest(plm(fde~lag(fde)+lag(fde,2), dbfde, model = "p", index="id")) coeftest(fdglsmodehs) } #### Example 9-7 ## ------------------------------------------------------------------------ ccep.rds <- pcce(fm.rds, RDSpillovers, model="p") if (requireNamespace("lmtest")){ library("lmtest") ccep.tab <- cbind(coeftest(ccep.rds)[, 1:2], coeftest(ccep.rds, vcov = vcovNW)[, 2], coeftest(ccep.rds, vcov = vcovHC)[, 2]) dimnames(ccep.tab)[[2]][2:4] <- c("Nonparam.", "vcovNW", "vcovHC") round(ccep.tab, 3) } ## ------------------------------------------------------------------------ autoreg <- function(rho = 0.1, T = 100){ e <- rnorm(T+1) for (t in 2:(T+1)) e[t] <- e[t]+rho*e[t-1] e } set.seed(20) f <- data.frame(time = rep(0:40, 2), rho = rep(c(0.2, 1), each = 41), y = c(autoreg(rho = 0.2, T = 40), autoreg(rho = 1, T = 40))) if (requireNamespace("ggplot2")){ library("ggplot2") ggplot(f, aes(time, y)) + geom_line() + facet_wrap(~ rho) + xlab("") + ylab("") autoreg <- function(rho = 0.1, T = 100){ e <- rnorm(T) for (t in 2:(T)) e[t] <- e[t] + rho *e[t-1] e } tstat <- function(rho = 0.1, T = 100){ y <- autoreg(rho, T) x <- autoreg(rho, T) z <- lm(y ~ x) coef(z)[2] / sqrt(diag(vcov(z))[2]) } result <- c() R <- 1000 for (i in 1:R) result <- c(result, tstat(rho = 0.2, T = 40)) quantile(result, c(0.025, 0.975)) prop.table(table(abs(result) > 2)) result <- c() R <- 1000 for (i in 1:R) result <- c(result, tstat(rho = 1, T = 40)) quantile(result, c(0.025, 0.975)) prop.table(table(abs(result) > 2)) R <- 1000 T <- 100 result <- c() for (i in 1:R){ y <- autoreg(rho=1, T=100) Dy <- y[2:T] - y[1:(T-1)] Ly <- y[1:(T-1)] z <- lm(Dy ~ Ly) result <- c(result, coef(z)[2] / sqrt(diag(vcov(z))[2])) } ggplot(data.frame(x = result), aes(x = x)) + geom_histogram(fill = "white", col = "black", bins = 20, aes(y = ..density..)) + stat_function(fun = dnorm) + xlab("") + ylab("") prop.table(table(result < -1.64)) } ## End(Not run)
yearly observations of 75 countries from 1960 to 2003
number of observations : 439
number of time-series : 16
country : world
package : panelbinomial
JEL codes: D72, E62, H62, O47
Chapter : 08
data(Reelection)
data(Reelection)
A dataframe containing:
the country
the year
TRUE
if the observation belongs to the narrow data set
one if the incumbent was reelected and zero otherwise
the change in the ratio of the government surplus to gdp in the two years preeceding the election year, relative to the two previous years
the change in the government surplus ratio to gdpin the election year, compared to the previous year
the average growth rate of real per capita gdp during the leader's current term
one for developped countries, 0 otherwise
one for a new democratic country, 0 otherwise
one for majoritarian electoral system, 0 otherwise
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Adi Brender and Allan Drazen (2008) “How Do Budget Deficits and Economic Growth Affect Reelection Prospects? Evidence From a Large Panel of Countries”, American Economic Review, 98(5), 2203-2220, doi:10.1257/aer.98.5.2203 .
#### Example 8-1 ## ------------------------------------------------------------------------ ## Not run: library("plm") data("Reelection", package = "pder") ## ------------------------------------------------------------------------ elect.l <- glm(reelect ~ ddefterm + ddefey + gdppc + dev + nd + maj, data = Reelection, family = "binomial", subset = narrow) l2 <- update(elect.l, family = binomial) l3 <- update(elect.l, family = binomial()) l4 <- update(elect.l, family = binomial(link = 'logit')) ## ------------------------------------------------------------------------ elect.p <- update(elect.l, family = binomial(link = 'probit')) ## ------------------------------------------------------------------------ if (requireNamespace("pglm")){ library("pglm") elect.pl <- pglm(reelect ~ ddefterm + ddefey + gdppc + dev + nd + maj, Reelection, family = binomial(link = 'logit'), subset = narrow) elect.pp <- pglm(reelect ~ ddefterm + ddefey + gdppc + dev + nd + maj, Reelection, family = binomial(link = 'probit'), subset = narrow) } ## End(Not run)
#### Example 8-1 ## ------------------------------------------------------------------------ ## Not run: library("plm") data("Reelection", package = "pder") ## ------------------------------------------------------------------------ elect.l <- glm(reelect ~ ddefterm + ddefey + gdppc + dev + nd + maj, data = Reelection, family = "binomial", subset = narrow) l2 <- update(elect.l, family = binomial) l3 <- update(elect.l, family = binomial()) l4 <- update(elect.l, family = binomial(link = 'logit')) ## ------------------------------------------------------------------------ elect.p <- update(elect.l, family = binomial(link = 'probit')) ## ------------------------------------------------------------------------ if (requireNamespace("pglm")){ library("pglm") elect.pl <- pglm(reelect ~ ddefterm + ddefey + gdppc + dev + nd + maj, Reelection, family = binomial(link = 'logit'), subset = narrow) elect.pp <- pglm(reelect ~ ddefterm + ddefey + gdppc + dev + nd + maj, Reelection, family = binomial(link = 'probit'), subset = narrow) } ## End(Not run)
yearly observations of 17 countries from 1982 to 1999
number of observations : 102
number of time-series : 6
country : oecd
package : panel
JEL codes: D72, H23, H71, H73, H77, R12, R23
Chapter : 07
data(RegIneq)
data(RegIneq)
A dataframe containing:
the country
the period
coefficient of variatio of regional gdp per capita
real gross domestic product per capita
total population
gini coefficient of regional population size
share of urban living population
total government social expenditures as share of gdp
unemployment rate
sub-national expenditures as share of total government expenditures
grants received by national and sub-national governments from other levels of government as share of total government revenues
sub-national non autonomous revenues as share of total government revenues
Review of Economic Studies' web site https://academic.oup.com/restud
Anke S. Kessler and Nico A. Hansen and Christian Lessmann (2011) “Interregional Redistribution and Mobility in Federations: a Positive Approach”, Review of Economic Studies, 78(4), 1345-1378, doi:10.1093/restud/rdr003 .
a pseudo-panel of 49 countries
number of observations : 1212
number of individual observations : 2-112
country : Africa
package : countpanel
JEL codes: D72, D74, F51, J15, O15, O17, Z13
Chapter : 08
data(ScrambleAfrica)
data(ScrambleAfrica)
A dataframe containing:
country code
ethnic group name
number of conflicts
dummy for partitioned ethnic area
spillover index, the fraction of adjacent groups in the same country that are partitioned
the region
population according to the first post-independance census
land area
lakes dummy
rivers dummy
dummy if a capital city falls in the homeland of an ethnic group
distance of the centroid of the area from the national border
distance of the centroid of the area from the capital
distance of the centroid of the area from the sea coast
dummy for areas that are by the sea coast
mean elevation
index of land suitability for agriculture
diamond mine indicator
malaria stability index
oil field indicator
island dummy
dummy for areas with major city in 1400
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Michalopoulos, Stelios and Elias Papaioannou (2016) “The Long-run Effects of the Scramble for Africa”, American Economic Review, 106(7), 1802–1848, doi:10.1257/aer.20131311 .
yearly observations of 51 states from 1983 to 1997
number of observations : 765
number of time-series : 15
country : United States
package : panel
JEL codes: R41, K42
Chapter : 06
data(SeatBelt)
data(SeatBelt)
A dataframe containing:
the state code
the year
the number of traffic fatalities of drivers and passengers (of any seating position) of a motor vehicule in transport
the number of traffic fatalities of pedestrians and bicyclists
rate of seat belt usage
median income in current US dollars
unemployment rate
mean age
the percentage of african-americans in the state population
the percentage of people of hispanic origin in the state population
traffic density urban ; registered vehicules per unit length of urban roads in miles
traffic density rural ; registered vehicules per unit length of urban roads in miles
number of violent crimes (homicide, rape and robbery) per capita
number of preperty rimes (burglary, larceny and auto theft) per capita
vehicule miles traveled on rural roads
vehicule miles traveled on urban roads
fuel tax (in curent cents)
65 miles per hour speed limit (55 mph is the base category)
70 miles per hour or above speed limit (55 mph is the base caegory)
a dummy variable that is equal to 1 for a minimum for a minimum legal drinking age of 21 years (18 years is the base category)
a dummy variable that is equal to 1 foe a maximum of 0.08 blood alcohol content (0.1 is the base category)
a dummy equal to 1 for the periods in which the state had a secondary-enforcement mandatory seat belt law, or a primary-enforcement law that preceded by a secondary-enforcement law (no seat belt law is the base category)
a dummy variable eqal to 1 for the periods in which the state had a primary-enforcement mandatory seat belt law that was not preceded by a secondary-enforcement law (no seat belt is the base category)
a dummy variable equal to 1 for the periods in which the state had a primary-enforcement mandatory seat belt law that was preceded by a secondary enforcement law (no seat belt law is the base category
author's website https://leinav.people.stanford.edu
Cohen, Alma and Liran Einav (2003) “The Effects of Mandatory Seat Belt Laws on Driving Behavior and Traffic Fatalities”, The Review of Economics and Statistics, 85(4), 828-843, doi:10.2139/ssrn.293582 .
#### Example 6-1 ## ------------------------------------------------------------------------ ## Not run: library("plm") ## ------------------------------------------------------------------------ y ~ x1 + x2 + x3 | x1 + x3 + z y ~ x1 + x2 + x3 | . - x2 + z ## ------------------------------------------------------------------------ data("SeatBelt", package = "pder") SeatBelt$occfat <- with(SeatBelt, log(farsocc / (vmtrural + vmturban))) ols <- plm(occfat ~ log(usage) + log(percapin) + log(unemp) + log(meanage) + log(precentb) + log(precenth)+ log(densrur) + log(densurb) + log(viopcap) + log(proppcap) + log(vmtrural) + log(vmturban) + log(fueltax) + lim65 + lim70p + mlda21 + bac08, SeatBelt, effect = "time") fe <- update(ols, effect = "twoways") ivfe <- update(fe, . ~ . | . - log(usage) + ds + dp +dsp) rbind(ols = coef(summary(ols))[1,], fe = coef(summary(fe))[1, ], w2sls = coef(summary(ivfe))[1, ]) ## ------------------------------------------------------------------------ SeatBelt$noccfat <- with(SeatBelt, log(farsnocc / (vmtrural + vmturban))) nivfe <- update(ivfe, noccfat ~ . | .) coef(summary(nivfe))[1, ] ## End(Not run)
#### Example 6-1 ## ------------------------------------------------------------------------ ## Not run: library("plm") ## ------------------------------------------------------------------------ y ~ x1 + x2 + x3 | x1 + x3 + z y ~ x1 + x2 + x3 | . - x2 + z ## ------------------------------------------------------------------------ data("SeatBelt", package = "pder") SeatBelt$occfat <- with(SeatBelt, log(farsocc / (vmtrural + vmturban))) ols <- plm(occfat ~ log(usage) + log(percapin) + log(unemp) + log(meanage) + log(precentb) + log(precenth)+ log(densrur) + log(densurb) + log(viopcap) + log(proppcap) + log(vmtrural) + log(vmturban) + log(fueltax) + lim65 + lim70p + mlda21 + bac08, SeatBelt, effect = "time") fe <- update(ols, effect = "twoways") ivfe <- update(fe, . ~ . | . - log(usage) + ds + dp +dsp) rbind(ols = coef(summary(ols))[1,], fe = coef(summary(fe))[1, ], w2sls = coef(summary(ivfe))[1, ]) ## ------------------------------------------------------------------------ SeatBelt$noccfat <- with(SeatBelt, log(farsnocc / (vmtrural + vmturban))) nivfe <- update(ivfe, noccfat ~ . | .) coef(summary(nivfe))[1, ] ## End(Not run)
a pseudo-panel of 159 Individuals
number of observations : 2703
number of individual observations : 17
country : France
package : panellimdep
JEL codes: C90, J14, J26, M12, M51
Chapter : 08
data(Seniors)
data(Seniors)
A dataframe containing:
individual number of each subject
from 1 to 17
from 1 to 12
1 if working subject, 0 otherwise
1 if the firm is X, 0 if the firm is Y
1 if the treatment with no information on the generation of the group is played first in the Public Good game, 0 otherwise
1 if male subject, 0 if female subject
1 if the subject is a manager, 0 otherwise
1 if the subject is a student, 0 otherwise
1 if retiree, 0 otherwise
1 if the subject is a senior, 0 otherwise
1 if the subject reports s/he is a senior, 0 if junior
1 if the subject is a working senior, 0 otherwise
1 if the subject is a working junior, 0 otherwise
1 if information is given on the generation composition of the group, 0 otherwise
number of seniors in the group, excluding the subject
1 if the group is homogenous in terms of declared generation, 0 otherwise
1 if the group is homogenous in terms of declared generation and this is common information, 0 otherwise
amount of the contribution to the public good (from 0 to 20)
amount of the public good (from 0 to 60)
amount of the public good in the previous period (from 0 to 60)
amount of the public good, excluding the subject's contribution (from 0 to 40)
amount of the public good in the previous period, excluding the subject's contribution (from 0 to 40)
payoff in the public good game
desired number of seniors co-participants in the Selection treatment (from 0 to 2)
amount invested in the risky lotery
payoff in the investment game
1 if letters are A M F U R I P , 0 if they are OATFNED
individual number of the co-participant in the Task game
1 if the co-participant in the Task game reports s/he is a senior, 0 otherwise
1 if the co-participant in the Task game is a senior
1 if the subject has chosen the tournament, 0 otherwise
1 if the co-participant has chosen the tournament, 0 otherwise
1 if both participants have chosen the tournament, 0 otherwise
number of words the subject believes s/he will create
number of words the subject believes the seniors will create on average
number of words the subject believes the juniors will create on average
number of words the subject believes the seniors will create on average when matched with a senior
number of words the subject believes the juniors will create on average when matched with a junior
1 if the subject believes s/he can create more words than the generation of his/her co-participant, 0 otherwise
number of words actually created
number of words actually created by the co-participant
payoff in the Task game
1 if the subject has been informed that s/he was interacting with seniors in the Public Good game, 0 otherwise
Amount of the pot in the previous period * the subject is a senior
1 if the group mixes the two generations, 0 otherwise
American Economic Association Data Archive : https://www.aeaweb.org/aer/
Charness, Gary and Marie-Claire Villeval (2009) “Cooperation and Competition in Intergenerational Experiments in the Field and the Laboratory”, American Economic Review, 99(3), 956–978, doi:10.1257/aer.99.3.956 .
yearly observations of 97 countries from 1960 to 1985
number of observations : 576
number of time-series : 6
country : world
package : panel
JEL codes: O47, O41
Chapter : 07
data(Solow)
data(Solow)
A dataframe containing:
country id
year
log of gdp per capita
log of the saving rate, approximated by the investement rate
log of population growth + 0.05 (which is an approximation of the sum of the rate of labor-augmenting technological progress and of the rate of depreciation of physical capital)
author's website https://www.nuffield.ox.ac.uk/users/bond/index.html
Caselli, Francesco; Esquivel, Gerardo and Fernando Lefort (1996) “Reopening the Convergence Debate: a New Look at Cross-country Growth Empirics”, Journal of Economic Growth, 1, 363-389, doi:10.1007/BF00141044 .
Bond, Stephen; Hoeffler, Anke and Johnatan Temple (2001) “GMM Estimation of Empirical Growth Model”, CEPR Discussion Paper, 3048, 1-33.
yearly observations of 10 firms from 1966 to 1983
number of observations : 180
number of time-series : 18
country : Texas
package : productionpanel
JEL codes: D24, C13, C51, C23, J31
Chapter : 02, 03
data(TexasElectr)
data(TexasElectr)
A dataframe containing:
the firm identifier
the year, from 1966 to 1983
output
price of fuel
price of labor
price of capital
expense in fuel
expense in labor
expense in capital
Journal of Applied Econometrics Data Archive : http://qed.econ.queensu.ca/jae/
Kumbhakar SC (1996) “Estimation of Cost Efficiency with Heteroscedasticity: An Application to Electric Utilities”, Journal of the Royal Statistical Society, Series D, 45, 319–335.
Horrace and Schmidt (1996) “Confidence Statements for Efficiency Estimates From Stochastic Frontier Models”, Journal of Productity Analysis, 7, 257–282, doi:10.1007/BF00157044 .
Horrace and Schmidt (2012) “Multiple Comparisons with the Best, with Economic Applications”, Journal of Applied Econometrics, 15(1), 1–26, doi:10.1002/(SICI)1099-1255(200001/02)15:1<1::AID-JAE551>3.0.CO;2-Y .
#### Example 2-6 ## ------------------------------------------------------------------------ data("TexasElectr", package = "pder") library("plm") TexasElectr$cost <- with(TexasElectr, explab + expfuel + expcap) TE <- pdata.frame(TexasElectr) summary(log(TE$output)) ercomp(log(cost) ~ log(output), TE) models <- c("within", "random", "pooling", "between") sapply(models, function(x) coef(plm(log(cost) ~ log(output), TE, model = x))["log(output)"]) #### Example 3-2 ## ------------------------------------------------------------------------ data("TexasElectr", package = "pder") if (requireNamespace("dplyr")){ library("dplyr") TexasElectr <- mutate(TexasElectr, pf = log(pfuel / mean(pfuel)), pl = log(plab / mean(plab)) - pf, pk = log(pcap / mean(pcap)) - pf) ## ------------------------------------------------------------------------ TexasElectr <- mutate(TexasElectr, q = log(output / mean(output))) ## ------------------------------------------------------------------------ TexasElectr <- mutate(TexasElectr, C = expfuel + explab + expcap, sl = explab / C, sk = expcap / C, C = log(C / mean(C)) - pf) ## ------------------------------------------------------------------------ TexasElectr <- mutate(TexasElectr, pll = 1/2 * pl ^ 2, plk = pl * pk, pkk = 1/2 * pk ^ 2, qq = 1/2 * q ^ 2) ## ------------------------------------------------------------------------ cost <- C ~ pl + pk + q + pll + plk + pkk + qq shlab <- sl ~ pl + pk shcap <- sk ~ pl + pk ## ------------------------------------------------------------------------ R <- matrix(0, nrow = 6, ncol = 14) R[1, 2] <- R[2, 3] <- R[3, 5] <- R[4, 6] <- R[5, 6] <- R[6, 7] <- 1 R[1, 9] <- R[2, 12] <- R[3, 10] <- R[4, 11] <- R[5, 13] <- R[6, 14] <- -1 ## ------------------------------------------------------------------------ z <- plm(list(cost = C ~ pl + pk + q + pll + plk + pkk + qq, shlab = sl ~ pl + pk, shcap = sk ~ pl + pk), TexasElectr, model = "random", restrict.matrix = R) summary(z) }
#### Example 2-6 ## ------------------------------------------------------------------------ data("TexasElectr", package = "pder") library("plm") TexasElectr$cost <- with(TexasElectr, explab + expfuel + expcap) TE <- pdata.frame(TexasElectr) summary(log(TE$output)) ercomp(log(cost) ~ log(output), TE) models <- c("within", "random", "pooling", "between") sapply(models, function(x) coef(plm(log(cost) ~ log(output), TE, model = x))["log(output)"]) #### Example 3-2 ## ------------------------------------------------------------------------ data("TexasElectr", package = "pder") if (requireNamespace("dplyr")){ library("dplyr") TexasElectr <- mutate(TexasElectr, pf = log(pfuel / mean(pfuel)), pl = log(plab / mean(plab)) - pf, pk = log(pcap / mean(pcap)) - pf) ## ------------------------------------------------------------------------ TexasElectr <- mutate(TexasElectr, q = log(output / mean(output))) ## ------------------------------------------------------------------------ TexasElectr <- mutate(TexasElectr, C = expfuel + explab + expcap, sl = explab / C, sk = expcap / C, C = log(C / mean(C)) - pf) ## ------------------------------------------------------------------------ TexasElectr <- mutate(TexasElectr, pll = 1/2 * pl ^ 2, plk = pl * pk, pkk = 1/2 * pk ^ 2, qq = 1/2 * q ^ 2) ## ------------------------------------------------------------------------ cost <- C ~ pl + pk + q + pll + plk + pkk + qq shlab <- sl ~ pl + pk shcap <- sk ~ pl + pk ## ------------------------------------------------------------------------ R <- matrix(0, nrow = 6, ncol = 14) R[1, 2] <- R[2, 3] <- R[3, 5] <- R[4, 6] <- R[5, 6] <- R[6, 7] <- 1 R[1, 9] <- R[2, 12] <- R[3, 10] <- R[4, 11] <- R[5, 13] <- R[6, 14] <- -1 ## ------------------------------------------------------------------------ z <- plm(list(cost = C ~ pl + pk + q + pll + plk + pkk + qq, shlab = sl ~ pl + pk, shcap = sk ~ pl + pk), TexasElectr, model = "random", restrict.matrix = R) summary(z) }
weeklyly observations of 25 firms from 1982 to 1983
number of observations : 483
number of time-series : 22
country : Egypt
package : panelproduction
JEL codes: D24, C13, C51, C23, J31
Chapter : 01, 03
data(Tileries)
data(Tileries)
A dataframe containing:
firm id
week (3 weeks aggregated)
one of "fayoum"
and "kalyubiya"
output
labor hours
machine hours
Journal of Applied Econometrics Data Archive : http://qed.econ.queensu.ca/jae/
Horrace and Schmidt (1996) “Confidence Statements for Efficiency Estimates From Stochastic Frontier Models”, Journal of Productity Analysis, 7, 257–282, doi:10.1007/BF00157044 .
Horrace and Schmidt (2012) “Multiple Comparisons with the Best, with Economic Applications”, Journal of Applied Econometrics, 15(1), 1–26, doi:10.1002/(SICI)1099-1255(200001/02)15:1<1::AID-JAE551>3.0.CO;2-Y .
Seale J.L. (1990) “Estimating Stochastic Frontier Systems with Unbalanced Panel Data: the Case of Floor Tile Manufactories in Egypt”, Journal of Applied Econometrics, 5, 59–79, doi:10.1002/jae.3950050105 .
#### Example 1-2 ## ------------------------------------------------------------------------ data("Tileries", package = "pder") library("plm") coef(summary(plm(log(output) ~ log(labor) + machine, data = Tileries, subset = area == "fayoum"))) ## ------------------------------------------------------------------------ coef(summary(plm(log(output) ~ log(labor) + machine, data = Tileries, model = "pooling", subset = area == "fayoum"))) #### Example 1-5 ## ------------------------------------------------------------------------ data("Tileries", package = "pder") til.fm <- log(output) ~ log(labor) + log(machine) lm.mod <- lm(til.fm, data = Tileries, subset = area == "fayoum") ## ------------------------------------------------------------------------ if (requireNamespace("car")){ library("car") lht(lm.mod, "log(labor) + log(machine) = 1") ## ------------------------------------------------------------------------ library("car") lht(lm.mod, "log(labor) + log(machine) = 1", vcov=vcovHC) } #### Example 1-6 ## ------------------------------------------------------------------------ plm.mod <- plm(til.fm, data = Tileries, subset = area == "fayoum") ## ------------------------------------------------------------------------ if (requireNamespace("car")){ library("car") lht(plm.mod, "log(labor) + log(machine) = 1", vcov = vcovHC) } #### Example 3-1 ## ------------------------------------------------------------------------ library(plm) data("Tileries", package = "pder") head(Tileries, 3) pdim(Tileries) ## ------------------------------------------------------------------------ Tileries <- pdata.frame(Tileries) plm.within <- plm(log(output) ~ log(labor) + log(machine), Tileries) y <- log(Tileries$output) x1 <- log(Tileries$labor) x2 <- log(Tileries$machine) lm.within <- lm(I(y - Between(y)) ~ I(x1 - Between(x1)) + I(x2 - Between(x2)) - 1) lm.lsdv <- lm(log(output) ~ log(labor) + log(machine) + factor(id), Tileries) coef(lm.lsdv)[2:3] coef(lm.within) coef(plm.within) ## ------------------------------------------------------------------------ tile.r <- plm(log(output) ~ log(labor) + log(machine), Tileries, model = "random") summary(tile.r) ## ------------------------------------------------------------------------ plm.within <- plm(log(output) ~ log(labor) + log(machine), Tileries, effect = "twoways") lm.lsdv <- lm(log(output) ~ log(labor) + log(machine) + factor(id) + factor(week), Tileries) y <- log(Tileries$output) x1 <- log(Tileries$labor) x2 <- log(Tileries$machine) y <- y - Between(y, "individual") - Between(y, "time") + mean(y) x1 <- x1 - Between(x1, "individual") - Between(x1, "time") + mean(x1) x2 <- x2 - Between(x2, "individual") - Between(x2, "time") + mean(x2) lm.within <- lm(y ~ x1 + x2 - 1) coef(plm.within) coef(lm.within) coef(lm.lsdv)[2:3] ## ------------------------------------------------------------------------ wh <- plm(log(output) ~ log(labor) + log(machine), Tileries, model = "random", random.method = "walhus", effect = "twoways") am <- update(wh, random.method = "amemiya") sa <- update(wh, random.method = "swar") ercomp(sa) ## ------------------------------------------------------------------------ re.models <- list(walhus = wh, amemiya = am, swar = sa) sapply(re.models, function(x) sqrt(ercomp(x)$sigma2)) sapply(re.models, coef)
#### Example 1-2 ## ------------------------------------------------------------------------ data("Tileries", package = "pder") library("plm") coef(summary(plm(log(output) ~ log(labor) + machine, data = Tileries, subset = area == "fayoum"))) ## ------------------------------------------------------------------------ coef(summary(plm(log(output) ~ log(labor) + machine, data = Tileries, model = "pooling", subset = area == "fayoum"))) #### Example 1-5 ## ------------------------------------------------------------------------ data("Tileries", package = "pder") til.fm <- log(output) ~ log(labor) + log(machine) lm.mod <- lm(til.fm, data = Tileries, subset = area == "fayoum") ## ------------------------------------------------------------------------ if (requireNamespace("car")){ library("car") lht(lm.mod, "log(labor) + log(machine) = 1") ## ------------------------------------------------------------------------ library("car") lht(lm.mod, "log(labor) + log(machine) = 1", vcov=vcovHC) } #### Example 1-6 ## ------------------------------------------------------------------------ plm.mod <- plm(til.fm, data = Tileries, subset = area == "fayoum") ## ------------------------------------------------------------------------ if (requireNamespace("car")){ library("car") lht(plm.mod, "log(labor) + log(machine) = 1", vcov = vcovHC) } #### Example 3-1 ## ------------------------------------------------------------------------ library(plm) data("Tileries", package = "pder") head(Tileries, 3) pdim(Tileries) ## ------------------------------------------------------------------------ Tileries <- pdata.frame(Tileries) plm.within <- plm(log(output) ~ log(labor) + log(machine), Tileries) y <- log(Tileries$output) x1 <- log(Tileries$labor) x2 <- log(Tileries$machine) lm.within <- lm(I(y - Between(y)) ~ I(x1 - Between(x1)) + I(x2 - Between(x2)) - 1) lm.lsdv <- lm(log(output) ~ log(labor) + log(machine) + factor(id), Tileries) coef(lm.lsdv)[2:3] coef(lm.within) coef(plm.within) ## ------------------------------------------------------------------------ tile.r <- plm(log(output) ~ log(labor) + log(machine), Tileries, model = "random") summary(tile.r) ## ------------------------------------------------------------------------ plm.within <- plm(log(output) ~ log(labor) + log(machine), Tileries, effect = "twoways") lm.lsdv <- lm(log(output) ~ log(labor) + log(machine) + factor(id) + factor(week), Tileries) y <- log(Tileries$output) x1 <- log(Tileries$labor) x2 <- log(Tileries$machine) y <- y - Between(y, "individual") - Between(y, "time") + mean(y) x1 <- x1 - Between(x1, "individual") - Between(x1, "time") + mean(x1) x2 <- x2 - Between(x2, "individual") - Between(x2, "time") + mean(x2) lm.within <- lm(y ~ x1 + x2 - 1) coef(plm.within) coef(lm.within) coef(lm.lsdv)[2:3] ## ------------------------------------------------------------------------ wh <- plm(log(output) ~ log(labor) + log(machine), Tileries, model = "random", random.method = "walhus", effect = "twoways") am <- update(wh, random.method = "amemiya") sa <- update(wh, random.method = "swar") ercomp(sa) ## ------------------------------------------------------------------------ re.models <- list(walhus = wh, amemiya = am, swar = sa) sapply(re.models, function(x) sqrt(ercomp(x)$sigma2)) sapply(re.models, coef)
yearly observations of 188 firms from 1951 to 1985
number of observations : 6580
number of time-series : 35
country : United States
package : panel
Chapter : 02
data(TobinQ)
data(TobinQ)
A dataframe containing:
compustat's identifying number
year
sic industry classification
investment divided by capital : broad definition
investment divided by capital : narrow definition
Tobin's Q : broad definition
Tobin's Q : narrow definition
capital stock
investment divided by capital with imperfect competition : broad definition
investment divided by capital with imperfect competition : narrow definition
one minus phi (see the article p. 320)
Tobin's Q with imperfect competition : broad definition
Tobin's Q with imperfect competition : narrow definition
S (see equation 10 p. 320) : broad definition
S (see equation 10 p. 320) : narrow definition
Journal of Applied Econometrics Data Archive : http://qed.econ.queensu.ca/jae/
Schaller, Huntley (1990) “A Re-examination of the Q Theory of Investment Using U.S. Firm Data”, Journal of Applied Econometrics, 5(4), 309–325, doi:10.1002/jae.3950050402 .
#### Example 2-1 ## ------------------------------------------------------------------------ ## Not run: library("plm") data("TobinQ", package = "pder") ## ------------------------------------------------------------------------ pTobinQ <- pdata.frame(TobinQ) pTobinQa <- pdata.frame(TobinQ, index = 188) pTobinQb <- pdata.frame(TobinQ, index = c('cusip')) pTobinQc <- pdata.frame(TobinQ, index = c('cusip', 'year')) ## ------------------------------------------------------------------------ pdim(pTobinQ) ## ----results = 'hide'---------------------------------------------------- pdim(TobinQ, index = 'cusip') pdim(TobinQ) ## ------------------------------------------------------------------------ head(index(pTobinQ)) ## ------------------------------------------------------------------------ Qeq <- ikn ~ qn Q.pooling <- plm(Qeq, pTobinQ, model = "pooling") Q.within <- update(Q.pooling, model = "within") Q.between <- update(Q.pooling, model = "between") ## ------------------------------------------------------------------------ Q.within summary(Q.within) ## ------------------------------------------------------------------------ head(fixef(Q.within)) head(fixef(Q.within, type = "dfirst")) head(fixef(Q.within, type = "dmean")) ## ------------------------------------------------------------------------ head(coef(lm(ikn ~ qn + factor(cusip), pTobinQ))) #### Example 2-2 ## ------------------------------------------------------------------------ Q.swar <- plm(Qeq, pTobinQ, model = "random", random.method = "swar") Q.swar2 <- plm(Qeq, pTobinQ, model = "random", random.models = c("within", "between"), random.dfcor = c(2, 2)) summary(Q.swar) ## ------------------------------------------------------------------------ ercomp(Qeq, pTobinQ) ercomp(Q.swar) ## ------------------------------------------------------------------------ Q.walhus <- update(Q.swar, random.method = "swar") Q.amemiya <- update(Q.swar, random.method = "amemiya") Q.nerlove <- update(Q.swar, random.method = "nerlove") Q.models <- list(swar = Q.swar, walhus = Q.walhus, amemiya = Q.amemiya, nerlove = Q.nerlove) sapply(Q.models, function(x) ercomp(x)$theta) sapply(Q.models, coef) #### Example 2-3 ## ------------------------------------------------------------------------ sapply(list(pooling = Q.pooling, within = Q.within, between = Q.between, swar = Q.swar), function(x) coef(summary(x))["qn", c("Estimate", "Std. Error")]) ## ------------------------------------------------------------------------ summary(pTobinQ$qn) ## ------------------------------------------------------------------------ SxxW <- sum(Within(pTobinQ$qn) ^ 2) SxxB <- sum((Between(pTobinQ$qn) - mean(pTobinQ$qn)) ^ 2) SxxTot <- sum( (pTobinQ$qn - mean(pTobinQ$qn)) ^ 2) pondW <- SxxW / SxxTot pondW pondW * coef(Q.within)[["qn"]] + (1 - pondW) * coef(Q.between)[["qn"]] ## ------------------------------------------------------------------------ T <- 35 N <- 188 smxt2 <- deviance(Q.between) * T / (N - 2) sidios2 <- deviance(Q.within) / (N * (T - 1) - 1) phi <- sqrt(sidios2 / smxt2) ## ------------------------------------------------------------------------ pondW <- SxxW / (SxxW + phi^2 * SxxB) pondW pondW * coef(Q.within)[["qn"]] + (1 - pondW) * coef(Q.between)[["qn"]] #### Example 2-8 ## ------------------------------------------------------------------------ Q.models2 <- lapply(Q.models, function(x) update(x, effect = "twoways")) sapply(Q.models2, function(x) sqrt(ercomp(x)$sigma2)) sapply(Q.models2, function(x) ercomp(x)$theta) ## End(Not run)
#### Example 2-1 ## ------------------------------------------------------------------------ ## Not run: library("plm") data("TobinQ", package = "pder") ## ------------------------------------------------------------------------ pTobinQ <- pdata.frame(TobinQ) pTobinQa <- pdata.frame(TobinQ, index = 188) pTobinQb <- pdata.frame(TobinQ, index = c('cusip')) pTobinQc <- pdata.frame(TobinQ, index = c('cusip', 'year')) ## ------------------------------------------------------------------------ pdim(pTobinQ) ## ----results = 'hide'---------------------------------------------------- pdim(TobinQ, index = 'cusip') pdim(TobinQ) ## ------------------------------------------------------------------------ head(index(pTobinQ)) ## ------------------------------------------------------------------------ Qeq <- ikn ~ qn Q.pooling <- plm(Qeq, pTobinQ, model = "pooling") Q.within <- update(Q.pooling, model = "within") Q.between <- update(Q.pooling, model = "between") ## ------------------------------------------------------------------------ Q.within summary(Q.within) ## ------------------------------------------------------------------------ head(fixef(Q.within)) head(fixef(Q.within, type = "dfirst")) head(fixef(Q.within, type = "dmean")) ## ------------------------------------------------------------------------ head(coef(lm(ikn ~ qn + factor(cusip), pTobinQ))) #### Example 2-2 ## ------------------------------------------------------------------------ Q.swar <- plm(Qeq, pTobinQ, model = "random", random.method = "swar") Q.swar2 <- plm(Qeq, pTobinQ, model = "random", random.models = c("within", "between"), random.dfcor = c(2, 2)) summary(Q.swar) ## ------------------------------------------------------------------------ ercomp(Qeq, pTobinQ) ercomp(Q.swar) ## ------------------------------------------------------------------------ Q.walhus <- update(Q.swar, random.method = "swar") Q.amemiya <- update(Q.swar, random.method = "amemiya") Q.nerlove <- update(Q.swar, random.method = "nerlove") Q.models <- list(swar = Q.swar, walhus = Q.walhus, amemiya = Q.amemiya, nerlove = Q.nerlove) sapply(Q.models, function(x) ercomp(x)$theta) sapply(Q.models, coef) #### Example 2-3 ## ------------------------------------------------------------------------ sapply(list(pooling = Q.pooling, within = Q.within, between = Q.between, swar = Q.swar), function(x) coef(summary(x))["qn", c("Estimate", "Std. Error")]) ## ------------------------------------------------------------------------ summary(pTobinQ$qn) ## ------------------------------------------------------------------------ SxxW <- sum(Within(pTobinQ$qn) ^ 2) SxxB <- sum((Between(pTobinQ$qn) - mean(pTobinQ$qn)) ^ 2) SxxTot <- sum( (pTobinQ$qn - mean(pTobinQ$qn)) ^ 2) pondW <- SxxW / SxxTot pondW pondW * coef(Q.within)[["qn"]] + (1 - pondW) * coef(Q.between)[["qn"]] ## ------------------------------------------------------------------------ T <- 35 N <- 188 smxt2 <- deviance(Q.between) * T / (N - 2) sidios2 <- deviance(Q.within) / (N * (T - 1) - 1) phi <- sqrt(sidios2 / smxt2) ## ------------------------------------------------------------------------ pondW <- SxxW / (SxxW + phi^2 * SxxB) pondW pondW * coef(Q.within)[["qn"]] + (1 - pondW) * coef(Q.between)[["qn"]] #### Example 2-8 ## ------------------------------------------------------------------------ Q.models2 <- lapply(Q.models, function(x) update(x, effect = "twoways")) sapply(Q.models2, function(x) sqrt(ercomp(x)$sigma2)) sapply(Q.models2, function(x) ercomp(x)$theta) ## End(Not run)
yearly observations of 91 pairs of countries from 1960 to 2001
number of observations : 3822
number of time-series : 42
country : Europe
package : gravity
JEL codes: C51, F14
Chapter : 06
data(TradeEU)
data(TradeEU)
A dataframe containing:
the year
a pair of countries
the sum of logged exports and imports, bilateral trade flow
the sum of the logged real GDPs
a measure of similarity between two trading countries;
a measure of relative factor endowments;
the logged bilateral real exchange rate;
a dummy equal to 1 when both belong to European Community;
a dummy equal to 1 when both adopt the common currency;
the geographical distance between capital cities;
a dummy equal to 1 when the trading partners share a border;
a dummy equal to 1 when both speak the same language;
the logarithm of real exchange rates between the European currencies and the U.S. dollar;
the time specific common factors (individual means) of the variables trade
the time specific common factors (individual means) of the variables gdp
the time specific common factors (individual means) of the variables sim
the time specific common factors (individual means) of the variables rlf
the time specific common factors (individual means) of the variables rer
Journal of Applied Econometrics Data Archive : http://qed.econ.queensu.ca/jae/
Serlenga, Laura and Yongcheol Shin (2007) “Gravity Models of Intra-eu Trade: Application of the Ccep-ht Estimation in Heterogenous Panels with Unobserved Common Time-specific Factors”, Journal of Applied Econometrics, 22, 361–381, doi:10.1002/jae.944 .
#### Example 6-3 ## ------------------------------------------------------------------------ ## Not run: data("TradeEU", package = "pder") library("plm") ## ------------------------------------------------------------------------ ols <- plm(trade ~ gdp + dist + rer + rlf + sim + cee + emu + bor + lan, TradeEU, model = "pooling", index = c("pair", "year")) fe <- update(ols, model = "within") fe ## ------------------------------------------------------------------------ re <- update(fe, model = "random") re ## ------------------------------------------------------------------------ phtest(re, fe) ## ----results='hide'------------------------------------------------------ ht1 <- plm(trade ~ gdp + dist + rer + rlf + sim + cee + emu + bor + lan | rer + dist + bor | gdp + rlf + sim + cee + emu + lan , data = TradeEU, model = "random", index = c("pair", "year"), inst.method = "baltagi", random.method = "ht") ht2 <- update(ht1, trade ~ gdp + dist + rer + rlf + sim + cee + emu + bor + lan | rer + gdp + rlf + dist + bor| sim + cee + emu + lan) ## ------------------------------------------------------------------------ phtest(ht1, fe) phtest(ht2, fe) ## ------------------------------------------------------------------------ ht2am <- update(ht2, inst.method = "am") ## ------------------------------------------------------------------------ phtest(ht2am, fe) ## End(Not run)
#### Example 6-3 ## ------------------------------------------------------------------------ ## Not run: data("TradeEU", package = "pder") library("plm") ## ------------------------------------------------------------------------ ols <- plm(trade ~ gdp + dist + rer + rlf + sim + cee + emu + bor + lan, TradeEU, model = "pooling", index = c("pair", "year")) fe <- update(ols, model = "within") fe ## ------------------------------------------------------------------------ re <- update(fe, model = "random") re ## ------------------------------------------------------------------------ phtest(re, fe) ## ----results='hide'------------------------------------------------------ ht1 <- plm(trade ~ gdp + dist + rer + rlf + sim + cee + emu + bor + lan | rer + dist + bor | gdp + rlf + sim + cee + emu + lan , data = TradeEU, model = "random", index = c("pair", "year"), inst.method = "baltagi", random.method = "ht") ht2 <- update(ht1, trade ~ gdp + dist + rer + rlf + sim + cee + emu + bor + lan | rer + gdp + rlf + dist + bor| sim + cee + emu + lan) ## ------------------------------------------------------------------------ phtest(ht1, fe) phtest(ht2, fe) ## ------------------------------------------------------------------------ ht2am <- update(ht2, inst.method = "am") ## ------------------------------------------------------------------------ phtest(ht2am, fe) ## End(Not run)
yearly observations of 490 combinations of countries / industries from 1989 to 1999
number of observations : 3860
number of time-series : 11
country : Germany and United States
package : gravity
JEL codes: F12, F14, F21, F23
Chapter : 06
data(TradeFDI)
data(TradeFDI)
A dataframe containing:
id
time period
country name
industry code
importer code
log real bilateral exports
log real bilateral outward stocks of FDI
log sum of bilateral real GDP
log (1-[exporter GDP/(exporter+importer GDP)]^2- [exporter GDP/(exporter+importer GDP)]^2)
log (real capital stock of exporter/real capital stock of importer)
log (secondary school enrolment of exporter/secondary school enrolment of importer)
log (labor force of exporter/labor force of importer)
log bilateral distance between exporter and importer
(lrk-lrl) * ldist
abs(lrk)*lgdt
Journal of Applied Econometrics Data Archive : http://qed.econ.queensu.ca/jae/
Peter Egger and Michael Pfaffermayr (2004) “Distance, Trade, and Fdi: A Hausman-taylor Sur Approach”, Journal of Applied Econometrics, 19(2), 227–246, doi:10.1002/jae.721 .
yearly observations of 53 banks from 1990 to 2000
number of observations : 583
number of time-series : 11
country : Turkey
package : productionpanel
JEL codes: D24, G21, L33
Chapter : 02
data(TurkishBanks)
data(TurkishBanks)
A dataframe containing:
bank id
the years
one of "conventional"
and "islamic"
price of labor
price of borrowed funds
price of physical capital
output, total loans
total cost
employee expenses
number of employees
assets expenses
fixed assets
total interest expenses (interest on deposits and non-deposit funds + other interest expenses),
borrowed funds (deposits + non-deposit funds)
deposits
non-deposits
non performing loans
equity capital
quality index
risk index
total assets
total securities (only for conventional banks)
Journal of Applied Econometrics Data Archive : http://qed.econ.queensu.ca/jae/
Mahmoud A. El-Gamal and Hulusi Inanoglu (2005) “Inefficiency and Heterogeneity in Turkish Banking: 1990-2000”, Journal of Applied Econometrics, 20(5), 641–664, doi:10.1002/jae.835 .
#### Example 2-5 ## ------------------------------------------------------------------------ data("TurkishBanks", package = "pder") library("plm") TurkishBanks <- na.omit(TurkishBanks) TB <- pdata.frame(TurkishBanks) summary(log(TB$output)) ercomp(log(cost) ~ log(output), TB) models <- c("within", "random", "pooling", "between") sapply(models, function(x) coef(plm(log(cost) ~ log(output), TB, model = x))["log(output)"])
#### Example 2-5 ## ------------------------------------------------------------------------ data("TurkishBanks", package = "pder") library("plm") TurkishBanks <- na.omit(TurkishBanks) TB <- pdata.frame(TurkishBanks) summary(log(TB$output)) ercomp(log(cost) ~ log(output), TB) models <- c("within", "random", "pooling", "between") sapply(models, function(x) coef(plm(log(cost) ~ log(output), TB, model = x))["log(output)"])
yearly observations of 22 countries from 1970 to 1997
number of observations : 616
number of time-series : 28
country : world
package : panel
JEL codes: F32, G15, G21, O16, O19, O47
Chapter : 06
data(TwinCrises)
data(TwinCrises)
A dataframe containing:
the country name
the year
real gdp growth
change in budget surplus to real gdp ratio
credit growth
external growth rates (weight average)
real exchange rate overvaluation
openess
currency crises
banking crises
twin crises
a factor with levels 'other', 'asia' and 'latam' (for latin America)
Journal of Money, Credit and Banking : https://jmcb.osu.edu/archive
Hutchison, Michael M. and Ilan Noy (2005) “How Bad Are Twins ? Output Costs of Currency and Banking Crises”, Journal of Money, Credit and Banking, 37(4), 725–752.
Spatial weights matrix of the 48 continental US States plus District of Columbia based on the queen contiguity criterium.
data(usaw49) data(usaw46)
data(usaw49) data(usaw46)
A matrix with elements different from zero if state i and j are neighbors. Weights are row standardized. According to the queen contiguity criterium, Arizona and Colorado are considered neighbours. Two versions are provided, one for 49 States, the other one for 46 States.
Giovanni Millo