14 Fixed Effects

This file demonstrates three approaches to estimating “fixed effects” models (remember this is what economists call “fixed effects”, but other disciplines use “fixed effects” to refer to something different). We’re going to use the wbstats package to download country-level data from the World Bank for 2018 - 2021 (the most recently available for the variables I chose). We’ll then estimate models with country fixed effects, with year fixed effects, and with both country and year fixed effects. We’ll estimate each model three ways: using the within transformation, using dummy variables, and using the plm package to apply the within transformation for us. If you don’t know what these are, go through LN5 first.

Note that the model we’ll estimate isn’t a great model in terms of producing interesting, reliable result. This is by design. Part of this chapter is introducing you to another API you can use to get data. You’ve worked with the US Census Bureau’s API to get data on US counties. Now from this chapter you will have experience getting data on countries from the World Bank. You are free to use either source for data for your RP. If the model here was a great one, it might take away something you want to do for your RP. This way you get experience with fixed effects models and with getting data from the World Bank, but don’t waste any potential ideas you might have for your RP. So just don’t read too much into the results. They likely suffer from reverse causation and omitted variable bias (both violations of ZCM). If you’re interested in cross-country variation in life expectancy you’ll need to dig much deeper than we’ll go in this chapter.

So what do you have to do? First, go through the details of the models with country fixed effects. I already did it for you, but you should go through it (together with going through LN5) to make sure you understand. After you feel you understand country fixed effects, try to estimate the models with Year Fixed Effects yourself. Once you’ve figured that out, try to estimate the models with both Country and Year Fixed Effects yourself. Just look for the code chunk comments that say “YOUR CODE GOES HERE”. That’s where you need to write code (mostly copy/pasting from what comes before it, making changes as appropriate).

Note that I have you the code for the stargazer tables, but until you estimate all the models it will display an error. For example, until you estimate yearDummies, you’ll get an error message: “object ‘yearDummies’ not found”. When you’re done all the error messages should be gone.

library(wbstats) # To get data from the World Bank API
library(plm) # To estimate fixed effects models
library(formattable) # to make colorful tables similar to Excel's conditional formatting
library(stargazer)
library(tidyverse)

## Set how many decimals at which R starts to use scientific notation 
options(scipen=3)
## This shows you a lot of what's available from the World Bank API
# listWBinfo <- wb_cachelist

## List of countries in the World Bank data
countryList <- wb_countries()

## List of all available variables (what they call "indicators")
availableIndicators <- wb_cachelist$indicators

## Sometimes it's easier to look through the indicator list if you write it to CSV and open it in Excel (you can do the same thing with the US Census data). The following does that: 
# write.csv(select(availableIndicators,indicator_id, indicator, indicator_desc),"indicators.csv")

## NOTE: if you use any of these (the full list of variables, exporting it to CSV), make sure you do NOT leave that in your final code. It doesn't belong in your RMD file. I just put these things in here so you see how to get to this information. 

## We'll use the following variables: 
# SP.DYN.LE00.IN    Life expectancy at birth, total (years)
# NY.GDP.PCAP.KD    GDP per capita (constant 2018 US$)
# SP.POP.TOTL   Population, total
# SP.POP.TOTL.FE.ZS Population, female (% of total population)
# SP.RUR.TOTL.ZS    Rural population (% of total population)


## Create named vector of indicators to download
indicatorsToDownload <- c(
  lifeExp = "SP.DYN.LE00.IN", 
  gdpPerCapita ="NY.GDP.PCAP.KD", 
  pop = "SP.POP.TOTL",
  pctFemale = "SP.POP.TOTL.FE.ZS",
  pctRural = "SP.RUR.TOTL.ZS"
)

## Download descriptions of on World Bank indicators (i.e., variables)
indicatorInfo <- availableIndicators %>% 
                  filter(indicator_id %in% indicatorsToDownload)


## Build description of our variables that we'll output in the HTML body
sDesc <- ""
for(i in 1:nrow(indicatorInfo)){
  sDesc <- paste0(sDesc
                  ,"<b>",
                  indicatorInfo$indicator[i],
                  " (",indicatorInfo$indicator_id[i]
                  , ")</b>: "
                  ,indicatorInfo$indicator_desc[i]
                  ,"<br>")
}
## Download data
mydataOrig <- wb_data(indicatorsToDownload, 
                      start_date = 2018, 
                      end_date = 2021)

## get vector of TRUE and FALSE where FALSE indicates there's one or more NA
noNAs <- complete.cases(mydataOrig)

## When writing this code, I first checked how many rows do have NAs, and then out of how many rows 
# sum(noNAs)
## out of how many rows:
# length(noNAs)

## keep rows without any NA
mydata <- mydataOrig[noNAs,]

## get count of rows for each country
countOfYearsByCountry <-  mydata %>% count(country)

## merge the count variable with the data
mydata <- inner_join(mydata,countOfYearsByCountry, by="country")

## keep only countries that have all 4 years complete
mydata <- mydata %>% filter(n==4)

## drop count variable (since all are now 4)
mydata <- mydata %>% select(-n)


## For the purposes of this chapter, let's only examine one group of countries 
## so that we can output results without it taking up hundreds of lines
## Normally you don't want to get rid of countries like this
## but doing so will make things run much more quickly,
## so for the purposes of the BP we're going to only keep one region

## Merge in country info (e.g., region)
mydata <- inner_join(mydata,select(countryList,country,region),by="country")

## Keep only region "Latin America & Caribbean" (so we end up with only 31 countries)
mydata <- mydata %>% filter(region == "Latin America & Caribbean") %>% select(-region)

mydata <- mydata %>% rename(year=date)

## Change scale of variables. This re-scales regression coefficients (instead of getting 0.00000123)
####  Measure population in millions of people instead of people
####  Measure GDP per Capita in thousands of 2010 US $ (instead of 2010 US $)
mydata <- mydata %>% mutate(pop=pop/1000000, 
                            gdpPerCapita=gdpPerCapita/1000)
## Display results of selected variables in stargazer table
## (without converting it to a data frame it doesn't display anything)
mydata %>% select(lifeExp, gdpPerCapita, pop, pctFemale, pctRural) %>% 
  as.data.frame() %>%
  stargazer(., type = "html",summary.stat = c("n","mean","sd", "min", "p25", "median", "p75", "max"))
Statistic N Mean St. Dev. Min Pctl(25) Median Pctl(75) Max
lifeExp 148 73.983 3.637 63.192 72.146 73.822 76.749 80.326
gdpPerCapita 148 12.091 8.855 1.284 5.948 8.607 15.768 36.925
pop 148 16.715 39.711 0.041 0.178 3.428 11.358 214.326
pctFemale 148 50.604 1.205 46.478 49.936 50.437 51.136 53.236
pctRural 148 34.378 22.239 0.000 17.339 31.764 47.478 81.322

14.1 Variables

Variable descriptions from the World Bank API. These descriptions do not reflect two changes we made (that are reflected in the table of summary statistics above and in the regression results that follow): population is measured in millions of people and GDP per capita is measured in thousands of 2010 US dollars.

GDP per capita (constant 2010 US$) (NY.GDP.PCAP.KD): GDP per capita is gross domestic product divided by midyear population. GDP is the sum of gross value added by all resident producers in the economy plus any product taxes and minus any subsidies not included in the value of the products. It is calculated without making deductions for depreciation of fabricated assets or for depletion and degradation of natural resources. Data are in constant 2010 U.S. dollars.
Life expectancy at birth, total (years) (SP.DYN.LE00.IN): Life expectancy at birth indicates the number of years a newborn infant would live if prevailing patterns of mortality at the time of its birth were to stay the same throughout its life.
Population, total (SP.POP.TOTL): Total population is based on the de facto definition of population, which counts all residents regardless of legal status or citizenship. The values shown are midyear estimates.
Population, female (% of total population) (SP.POP.TOTL.FE.ZS): Female population is the percentage of the population that is female. Population is based on the de facto definition of population, which counts all residents regardless of legal status or citizenship.
Rural population (% of total population) (SP.RUR.TOTL.ZS): Rural population refers to people living in rural areas as defined by national statistical offices. It is calculated as the difference between total population and urban population.

Source of data definitions: wbstats package

Note that if you displayed the exact wording of others without quotation marks in a paper, it would be plagiarism (and if you added quotation marks it wouldn’t be plagiarism, but it would make for a bad paper). However, for our purposes here, we’re just printing out a convenient list of definitions so we have it all in one place (i.e., this isn’t a paper).

14.2 OLS

Our focus is fixed effects models, but often when estimating fixed effects models we also estimate regular OLS without fixed effects for comparison.

ols <- lm(data=mydata,lifeExp~gdpPerCapita+pop+pctFemale+pctRural)

14.3 Country Fixed Effects

Our basic OLS model is the following: \[ lifeExp_{it} = \beta_0+\beta_1 gdpPerCapita_{it} + \beta_2 pop_{it} + \beta_3 pctFemale_{it} + \beta_4 pctRural_{it} + v_{it} \] To save on notation, we’ll use generic variables (and I wrote out the “composite error term”), i.e.,

\[ y_{it} = \beta_0+\beta_1 x_{1it} + \beta_2 x_{2it} + \beta_3 x_{2it} + \beta_4 x_{4it} + (c_i + u_{it}) \]

Below there are 3 equations. The first is for country \(i\) in year \(t\) (the same as the one above). The second equation is the average over the four years for country \(i\), where \(\bar{y}_{i}=\sum_{t=2018}^{2021}y_{it}\) is the average value of \(y_{it}\) over the 4 years for country \(i\), \(\bar{x}_{ji}=\sum_{t=2018}^{2021}x_{jti}\) is the average value of \(x_{jti}\) over the 4 years for country \(i\) for the four explanatory variables \(j\in\{1,2,3,4\}\), \(\bar{c}_{i}=\sum_{t=2018}^{2021}c_{i}=c_i\) is the average value of \(c_{i}\) over the 4 years for country \(i\) (which just equals \(c_i\) because \(c_i\) is the same in all years for country \(i\)), and \(\bar{u}_{i}=\sum_{t=2018}^{2021}u_{it}\) is the average value of \(u_{it}\) over the 4 years for country \(i\). For the final equation, subtract country \(i\)’s average from the value in each year \(t\).

\[ \begin{align} y_{it} &= \beta_0+\beta_1 x_{1it} + \beta_2 x_{2it} + \beta_3 x_{2it} + \beta_4 x_{4it} + (c_i + u_{it}) \\ \bar{y}_{i} &= \beta_0+\beta_1 \bar{x}_{1i} + \beta_2 \bar{x}_{2i} + \beta_3 \bar{x}_{3i} + \beta_4 \bar{x}_{4i} + (\bar{c}_i + \bar{u}_{i}) \\ y_{it}-\bar{y}_{i} &= (\beta_0-\beta_0)+\beta_1 (x_{1it}-\bar{x}_{1i}) + \beta_2 (x_{2it}-\bar{x}_{2i}) + \beta_3 (x_{3it}-\bar{x}_{3i}) \\ &\hspace{6cm} + \beta_4 (x_{4it}-\bar{x}_{4i}) + (c_i-\bar{c}_i + u_{it}-\bar{u}_{i}) \end{align} \]

This final equation simplifies to the “within transformation” for country \(i\), \[ y_{it}-\bar{y}_{i} = \beta_1 (x_{1it}-\bar{x}_{1i}) + \beta_2 (x_{2it}-\bar{x}_{2i}) + \beta_3 (x_{3it}-\bar{x}_{3i}) + \beta_4 (x_{4it}-\bar{x}_{4i}) + (u_{it}-\bar{u}_{i}) \] because \(\beta_0-\beta_0=0\) and \(c_i-\bar{c}_i=0\), where \(\bar{c}_i=c_i\) because \(c_i\) is the same in all years for country \(i\). Mathematically, this is why the fixed effects model allows us to control for observable factors that do not change of time (or whatever is measured by \(t=1,,,,.T\)). If \(c_i\) is not constant for all time periods, then \(\bar{c}_i=c_i\) isn’t correct and it doesn’t drop out of the final equation. That means it remains in the equations we estimate, and our coefficients are biased.

At the end of this file there are tables that demonstrate the within transformation for our dataset. There is a table for each variable. Look at the table for Life expectancy. Find the row for Argentina (iso3c code ARG). It’s average value of life expectancy is 76.39. In 2018, their value was 77, which is 0.61 below Argentina’s four-year average value of 76.39. In 2018, Argentina’s life expectancy was 77, which is 0.61 above Argentina’s four-year average. Below this table for life expectancy is a similar table for each explanatory variable. When economists say a model has country “fixed effects”, they mean estimating an OLS regression using data transformed by this “within” transformation.

Alternatively, a model with country “fixed effects” can be estimated using the original OLS equation with the addition of a dummy variable for each country (omitting one).

\[ y_{it} = \beta_0+\beta_1 x_{1it} + \beta_2 x_{2it} + \beta_3 x_{2it} + \beta_4 x_{4it} + \sum_{i=2}^{50}\sigma_idC_i + (c_i + u_{it}) \]

where \(dC_i\) is a dummy variable with a value of 1 if that observation is country \(i\) and equals 0 otherwise (and \(\sigma_i\) is the coefficient on dummy variable \(dC_i\)).

These two models, the “within transformation” and the model with a dummy variable for each country, are mathematically and empirically equivalent. To see that they are empirically equivalent, we’ll estimate both models and compare the results. Note that the standard errors and \(R^2\) values are not equivalent, as discussed below.

Note that when we create the within-transformed variables, we’re going to store them in a new dataframe mydataCountry so that we can use the same variable names. By keeping the same variable names, when we use the variables in the regression and display the results in stargazer, the coefficients will go on the same rows as the other two models.

## Dummy variable for each country (it automatically omits one)
countryDummies <- lm(lifeExp~gdpPerCapita+pop+pctFemale+pctRural+factor(country),data=mydata)

## Within transformation (subtract country averages from each observation for each variable)

## Create country averages and add them to mydata
mydata <- mydata %>%
  group_by(country) %>%
  mutate(cAvg_lifeExp=mean(lifeExp),
         cAvg_gdpPerCapita=mean(gdpPerCapita),
         cAvg_pop=mean(pop),
         cAvg_pctFemale=mean(pctFemale),
         cAvg_pctRural=mean(pctRural)
         ) %>%
  ungroup()

## Within transformation (stored in its own dataframe so can use the same names)
mydataCountry <- mydata %>%
  mutate(lifeExp=lifeExp-cAvg_lifeExp,
         gdpPerCapita=gdpPerCapita-cAvg_gdpPerCapita,
         pop=pop-cAvg_pop,
         pctFemale=pctFemale-cAvg_pctFemale,
         pctRural=pctRural-cAvg_pctRural
         ) 

## Estimate within transformation using the transformed data (stored in mydataCountry)
countryWithin <- lm(lifeExp~gdpPerCapita+pop+pctFemale+pctRural,data=mydataCountry)

## Using plm package
countryPlm <- plm(lifeExp~gdpPerCapita+pop+pctFemale+pctRural,data=mydata, index=c("country"), model = "within", effect="individual")
stargazer(countryDummies,countryWithin,countryPlm, 
          type = "html", 
          report=('vcs*'),
          single.row = TRUE,
          digits = 4,
          keep.stat = c("n","rsq","adj.rsq"), 
          notes = "Standard Errors reported in parentheses, <em>&#42;p&lt;0.1;&#42;&#42;p&lt;0.05;&#42;&#42;&#42;p&lt;0.01</em>", 
          notes.append = FALSE,
          title = "Country Fixed Effects",
          model.numbers = FALSE, 
          column.labels = c("Dummies", "Within", "PLM"))
Country Fixed Effects
Dependent variable:
lifeExp
OLS panel
linear
Dummies Within PLM
gdpPerCapita 0.0126 (0.0699) 0.0126 (0.0605) 0.0126 (0.0699)
pop -0.9195 (0.2391)*** -0.9195 (0.2069)*** -0.9195 (0.2391)***
pctFemale -1.3297 (1.3705) -1.3297 (1.1855) -1.3297 (1.3705)
pctRural 1.2241 (0.2518)*** 1.2241 (0.2178)*** 1.2241 (0.2518)***
factor(country)Argentina 119.5922 (17.3566)***
factor(country)Aruba 21.1099 (4.8311)***
factor(country)Bahamas, The 65.5174 (14.9276)***
factor(country)Barbados 6.8268 (1.9029)***
factor(country)Belize 17.3394 (7.3872)**
factor(country)Bolivia 50.6276 (12.2941)***
factor(country)Brazil 265.5228 (47.4508)***
factor(country)Chile 93.4475 (15.9234)***
factor(country)Colombia 110.4371 (15.6802)***
factor(country)Costa Rica 70.1699 (15.0467)***
factor(country)Cuba 70.2195 (13.6619)***
factor(country)Dominica 48.8484 (12.9520)***
factor(country)Dominican Republic 71.7647 (15.2832)***
factor(country)Ecuador 57.9905 (10.7213)***
factor(country)El Salvador 58.5636 (11.6919)***
factor(country)Grenada 7.9266 (5.1355)
factor(country)Guatemala 39.4123 (7.7079)***
factor(country)Guyana -8.8023 (2.2323)***
factor(country)Haiti 32.5696 (8.7404)***
factor(country)Honduras 39.8849 (9.8795)***
factor(country)Jamaica 31.7467 (8.9637)***
factor(country)Mexico 175.9963 (28.2625)***
factor(country)Nicaragua 41.0821 (9.1484)***
factor(country)Panama 52.8577 (12.1244)***
factor(country)Paraguay 42.7676 (10.6443)***
factor(country)Peru 89.6611 (13.8823)***
factor(country)Puerto Rico 88.4363 (17.0956)***
factor(country)Sint Maarten (Dutch part) 81.0392 (22.7212)***
factor(country)St. Kitts and Nevis -0.3503 (2.2995)
factor(country)St. Lucia -15.0436 (2.6502)***
factor(country)St. Vincent and the Grenadines 23.8994 (9.6618)**
factor(country)Suriname 41.9954 (11.7112)***
factor(country)Trinidad and Tobago 29.5107 (8.1729)***
factor(country)Turks and Caicos Islands 77.4414 (18.9547)***
factor(country)Uruguay 87.6720 (17.9353)***
factor(country)Virgin Islands (U.S.) 89.3023 (17.8717)***
Constant 55.5712 (79.8256) 0.0000 (0.0704)
Observations 148 148 148
R2 0.9461 0.4125 0.4125
Adjusted R2 0.9260 0.3961 0.1929
Note: Standard Errors reported in parentheses, *p<0.1;**p<0.05;***p<0.01

We’ve changed a few of the stargazer options for this chapter. We’re displaying standard errors instead of p-values so that we can use only one row per variable (it lets us report coefficient and standard error on one line, but not if we use p-values instead). I modified the note to say that standard errors are reported in parentheses.

Note that for the PP and RP, you should report p-values instead of standard errors, so make sure to use the stargazer code chunks from the MLR chapter isntead of this one

Now look at the coefficient estimates. The 3 models all have the same coefficients on gdpPerCapita, pop, pctFemale, and pctRurla. In LN5 we discuss how the within transformation is equivalent to including dummy variables for each group (in this case, countries). That’s exactly what see in the table. The PLM package estimates the within transformation for us (so this is usually what you want to use in practice…we’re just doing it by hand here to help you better understand the models).

You also may notice that the standard errors (and statistical significance stars) are different in the middle column. When we estimate the model with dummy variables (column 1), the regular OLS standard errors are correct. But when we apply the within transformation, we need to adjust the standard errors to account for the within transformation. This would be a bit difficult for us to do. Thankfully, the PLM package correctly adjusts the standard errors (and thus p-values) for us. Thus, in practice we won’t actually want to apply the within transformation ourselves. We’re doing it in this chapter so you can see exactly what it is in practice and see that the coefficient estimates for all 3 versions result in the same coefficients.

If you compare the \(R^2\) values across models, you’ll notice that the \(R^2\) for the model with dummy variables is much higher. Including all the dummy variables makes it artificially high. We want to use the \(R^2\) from the within transformation. The PLM model does this for us.

Another reason we want to use the PLM model when we estimate fixed effects models is that we often don’t want to see all of the coefficients on the dummy variables. For country fixed effects, the coefficient on each country dummy is estimated off of only 4 observations. Thus, it is not a reliable estimate of the effect of being Argentina (or Belize, etc). It still allows us to estimate the model with country fixed effects, even if we don’t care about the coefficient estimates themselves. However, if we had not dropped all countries except South America, we would have hundreds of dummy variables. If we were estimating a model using US county data, we would have over 3000. R probably wouldn’t even let us estimate a model with that many variables. This again makes the PLM package preferable.

14.4 Year Fixed Effects

Above you saw how to estimate models with country fixed effects in three different ways. Here, you should estimate models with year fixed effects in the same three ways. Hint: you just have to switch “country” with “year” and everything else is the same. If you’ve done it correctly, the coefficients will be identical in all three models (and the standard errors will be identical in the “dummies” and “PLM” models).

## Dummy variable for each year (it automatically omits one)
yearDummies <- lm(lifeExp~gdpPerCapita+pop+pctFemale+pctRural+factor(year),data=mydata)

## Within transformation (subtract year averages from each observation for each variable)


## Create year averages and add them to mydata

mydata <- mydata %>%
  group_by(year) %>%
  mutate(yAvg_lifeExp=mean(lifeExp),
         yAvg_gdpPerCapita=mean(gdpPerCapita),
         yAvg_pop=mean(pop),
         yAvg_pctFemale=mean(pctFemale),
         yAvg_pctRural=mean(pctRural)
         ) %>%
  ungroup()

## Within transformation (stored in its own dataframe so can use the same names)
mydataYear <- mydata %>%
  mutate(lifeExp=lifeExp-yAvg_lifeExp,
         gdpPerCapita=gdpPerCapita-yAvg_gdpPerCapita,
         pop=pop-yAvg_pop,
         pctFemale=pctFemale-yAvg_pctFemale,
         pctRural=pctRural-yAvg_pctRural
         ) 



## Estimate within transformation using the transformed data
yearWithin <- lm(lifeExp~gdpPerCapita+pop+pctFemale+pctRural,data=mydataYear)

## Using plm package (for year, still use model = "within", effect="individual")
yearPlm <- plm(lifeExp~gdpPerCapita+pop+pctFemale+pctRural,data=mydata, index=c("year"), model = "within", effect="individual")
stargazer(yearDummies,yearWithin,yearPlm,
          type = "html",
          report=('vcs*'),
          single.row = TRUE,
          digits = 4,
          keep.stat = c("n","rsq","adj.rsq"),
          notes = "Standard Errors reported in parentheses, <em>&#42;p&lt;0.1;&#42;&#42;p&lt;0.05;&#42;&#42;&#42;p&lt;0.01</em>",
          notes.append = FALSE,
          title = "Year Fixed Effects",
          model.numbers = FALSE,
          column.labels = c("Dummies", "Within", "PLM"))
Year Fixed Effects
Dependent variable:
lifeExp
OLS panel
linear
Dummies Within PLM
gdpPerCapita 0.1653 (0.0341)*** 0.1653 (0.0337)*** 0.1653 (0.0341)***
pop -0.0008 (0.0070) -0.0008 (0.0069) -0.0008 (0.0070)
pctFemale 0.3823 (0.2330) 0.3823 (0.2306)* 0.3823 (0.2330)
pctRural -0.0345 (0.0131)*** -0.0345 (0.0130)*** -0.0345 (0.0131)***
factor(year)2019 -0.0771 (0.7020)
factor(year)2020 -0.6869 (0.7042)
factor(year)2021 -1.8445 (0.7029)***
Constant 54.4905 (11.4648)*** 0.0000 (0.2456)
Observations 148 148 148
R2 0.3438 0.3124 0.3124
Adjusted R2 0.3110 0.2932 0.2781
Note: Standard Errors reported in parentheses, *p<0.1;**p<0.05;***p<0.01

14.5 Country and Year Fixed Effects

Now that you’ve estimated the models with year fixed effects, estimate models with both country and year fixed effects. It works the same way as above, just doing it for both country and year. If you’ve done it correctly, the coefficients will be identical in all three models (and the standard errors will be identical in the “dummies” and “PLM” models).

## Dummy variable for each country and each year (it automatically omits one of each)
countryyearDummies <- lm(lifeExp~gdpPerCapita+pop+pctFemale+pctRural+factor(year)+factor(country),data=mydata)

## Within transformation (subtract country AND year averages from each observation for each variable)

## We already created the country averages and year averages above so we don't need to create them again


## Within transformation (stored in its own dataframe so can use the same names)
mydataCountryYear <- mydata %>%
  mutate(lifeExp=lifeExp-cAvg_lifeExp-yAvg_lifeExp,
         gdpPerCapita=gdpPerCapita-cAvg_gdpPerCapita-yAvg_gdpPerCapita,
         pop=pop-cAvg_pop-yAvg_pop,
         pctFemale=pctFemale-cAvg_pctFemale-yAvg_pctFemale,
         pctRural=pctRural-cAvg_pctRural-yAvg_pctRural
         ) 

##Estimate within transformation using the transformed data
countryYearWithin <- lm(lifeExp~gdpPerCapita+pop+pctFemale+pctRural,data=mydataCountryYear)

##Using plm package (using index = both country and year, joined together in c(), and model = "within", effect="twoways")

countryYearPlm <- plm(lifeExp~gdpPerCapita+pop+pctFemale+pctRural,data=mydata, index=c("year", "country"), model = "within", effect="twoways")
stargazer(countryyearDummies,countryYearWithin, countryYearPlm,
          type = "html",
          report=('vcs*'),
          single.row = TRUE,
          digits = 4,
          keep.stat = c("n","rsq","adj.rsq"),
          notes = "Standard Errors reported in parentheses, <em>&#42;p&lt;0.1;&#42;&#42;p&lt;0.05;&#42;&#42;&#42;p&lt;0.01</em>",
          notes.append = FALSE,
          title = "Country and Year Fixed Effects",
          model.numbers = FALSE,
          column.labels = c("Dummies", "Within", "PLM"))
Country and Year Fixed Effects
Dependent variable:
lifeExp
OLS panel
linear
Dummies Within PLM
gdpPerCapita -0.1336 (0.0745)* -0.1336 (0.0635)** -0.1336 (0.0745)*
pop -0.6231 (0.2192)*** -0.6231 (0.1869)*** -0.6231 (0.2192)***
pctFemale 0.7765 (1.2593) 0.7765 (1.0740) 0.7765 (1.2593)
pctRural 0.3172 (0.2885) 0.3172 (0.2460) 0.3172 (0.2885)
factor(year)2019 0.1581 (0.2152)
factor(year)2020 -0.7531 (0.2980)**
factor(year)2021 -1.5153 (0.3317)***
factor(country)Argentina 48.0688 (21.3800)**
factor(country)Aruba 4.2326 (5.4575)
factor(country)Bahamas, The 14.0486 (16.8079)
factor(country)Barbados 0.9965 (2.0555)
factor(country)Belize 1.6340 (7.2725)
factor(country)Bolivia 9.1414 (13.8402)
factor(country)Brazil 147.7513 (48.6836)***
factor(country)Chile 34.0362 (18.6542)*
factor(country)Colombia 45.9107 (19.3488)**
factor(country)Costa Rica 22.2799 (16.5103)
factor(country)Cuba 21.9719 (15.6289)
factor(country)Dominica 9.9136 (13.9217)
factor(country)Dominican Republic 20.3059 (17.1552)
factor(country)Ecuador 20.0561 (12.3314)
factor(country)El Salvador 10.6088 (14.2357)
factor(country)Grenada 0.8221 (4.7517)
factor(country)Guatemala 11.7895 (8.9399)
factor(country)Guyana -9.5696 (1.9705)***
factor(country)Haiti 1.7685 (10.0320)
factor(country)Honduras 10.2738 (10.6796)
factor(country)Jamaica 4.5115 (9.6934)
factor(country)Mexico 89.3965 (30.9195)***
factor(country)Nicaragua 9.0234 (10.4429)
factor(country)Panama 16.4274 (13.0509)
factor(country)Paraguay 10.5090 (11.5163)
factor(country)Peru 33.4872 (16.9555)*
factor(country)Puerto Rico 25.8644 (19.7233)
factor(country)Sint Maarten (Dutch part) 26.1300 (22.9685)
factor(country)St. Kitts and Nevis -4.0098 (2.1611)*
factor(country)St. Lucia -7.0189 (2.7966)**
factor(country)St. Vincent and the Grenadines 3.9928 (9.4467)
factor(country)Suriname 7.2885 (12.5348)
factor(country)Trinidad and Tobago 6.2617 (8.6405)
factor(country)Turks and Caicos Islands 21.3692 (20.2526)
factor(country)Uruguay 23.7938 (20.4855)
factor(country)Virgin Islands (U.S.) 25.7910 (20.3457)
Constant 16.9131 (69.9545) -35.8142 (55.5930)
Observations 148 148 148
R2 0.9602 0.1369 0.1369
Adjusted R2 0.9437 0.1128 -0.2199
Note: Standard Errors reported in parentheses, *p<0.1;**p<0.05;***p<0.01

14.6 Comparison of all models

Below we have comparisons of the four models: ols, country fixed effects, year fixed effects, and country and year fixed effects. The comparisons are done three times, one for each method of estimating the models.

14.6.1 Within Transformation

stargazer(ols,countryWithin,yearWithin,countryYearWithin,
          type = "html",
          report=('vcs*'),
          single.row = TRUE,
          digits = 3,
          keep.stat = c("n","rsq","adj.rsq"),
          notes = "Standard Errors reported in parentheses, <em>&#42;p&lt;0.1;&#42;&#42;p&lt;0.05;&#42;&#42;&#42;p&lt;0.01</em>",
          notes.append = FALSE,
          title = "Fixed Effects Models: Within Transformation",
          model.numbers = FALSE,
          column.labels = c("OLS", "Country FE", "Year FE", "Country+Year FE"))
Fixed Effects Models: Within Transformation
Dependent variable:
lifeExp
OLS Country FE Year FE Country+Year FE
gdpPerCapita 0.171 (0.035)*** 0.013 (0.060) 0.165 (0.034)*** -0.134 (0.064)**
pop -0.0004 (0.007) -0.919 (0.207)*** -0.001 (0.007) -0.623 (0.187)***
pctFemale 0.350 (0.237) -1.330 (1.186) 0.382 (0.231)* 0.777 (1.074)
pctRural -0.033 (0.013)** 1.224 (0.218)*** -0.035 (0.013)*** 0.317 (0.246)
Constant 55.330 (11.683)*** 0.000 (0.070) 0.000 (0.246) -35.814 (55.593)
Observations 148 148 148 148
R2 0.302 0.413 0.312 0.137
Adjusted R2 0.283 0.396 0.293 0.113
Note: Standard Errors reported in parentheses, *p<0.1;**p<0.05;***p<0.01

14.6.2 PLM Package

stargazer(ols,countryPlm,yearPlm,countryYearPlm,
          type = "html",
          report=('vcs*'),
          single.row = TRUE,
          digits = 3,
          keep.stat = c("n","rsq","adj.rsq"),
          notes = "Standard Errors reported in parentheses, <em>&#42;p&lt;0.1;&#42;&#42;p&lt;0.05;&#42;&#42;&#42;p&lt;0.01</em>",
          notes.append = FALSE,
          title = "Fixed Effects Models: PLM Package",
          model.numbers = FALSE,
          column.labels = c("OLS", "Country FE", "Year FE", "Country+Year FE"))
Fixed Effects Models: PLM Package
Dependent variable:
lifeExp
OLS panel
linear
OLS Country FE Year FE Country+Year FE
gdpPerCapita 0.171 (0.035)*** 0.013 (0.070) 0.165 (0.034)*** -0.134 (0.074)*
pop -0.0004 (0.007) -0.919 (0.239)*** -0.001 (0.007) -0.623 (0.219)***
pctFemale 0.350 (0.237) -1.330 (1.370) 0.382 (0.233) 0.777 (1.259)
pctRural -0.033 (0.013)** 1.224 (0.252)*** -0.035 (0.013)*** 0.317 (0.288)
Constant 55.330 (11.683)***
Observations 148 148 148 148
R2 0.302 0.413 0.312 0.137
Adjusted R2 0.283 0.193 0.278 -0.220
Note: Standard Errors reported in parentheses, *p<0.1;**p<0.05;***p<0.01

14.6.3 Dummy Variables

stargazer(ols,countryDummies,yearDummies,countryyearDummies,
          type = "html",
          report=('vcs*'),
          single.row = TRUE,
          digits = 3,
          keep.stat = c("n","rsq","adj.rsq"),
          notes = "Standard Errors reported in parentheses, <em>&#42;p&lt;0.1;&#42;&#42;p&lt;0.05;&#42;&#42;&#42;p&lt;0.01</em>",
          notes.append = FALSE,
          title = "Fixed Effects Models: Dummy Variables",
          model.numbers = FALSE,
          column.labels = c("OLS", "Country FE", "Year FE", "Country+Year FE"))
Fixed Effects Models: Dummy Variables
Dependent variable:
lifeExp
OLS Country FE Year FE Country+Year FE
gdpPerCapita 0.171 (0.035)*** 0.013 (0.070) 0.165 (0.034)*** -0.134 (0.074)*
pop -0.0004 (0.007) -0.919 (0.239)*** -0.001 (0.007) -0.623 (0.219)***
pctFemale 0.350 (0.237) -1.330 (1.370) 0.382 (0.233) 0.777 (1.259)
pctRural -0.033 (0.013)** 1.224 (0.252)*** -0.035 (0.013)*** 0.317 (0.288)
factor(country)Argentina 119.592 (17.357)*** 48.069 (21.380)**
factor(country)Aruba 21.110 (4.831)*** 4.233 (5.458)
factor(country)Bahamas, The 65.517 (14.928)*** 14.049 (16.808)
factor(country)Barbados 6.827 (1.903)*** 0.997 (2.055)
factor(country)Belize 17.339 (7.387)** 1.634 (7.273)
factor(country)Bolivia 50.628 (12.294)*** 9.141 (13.840)
factor(country)Brazil 265.523 (47.451)*** 147.751 (48.684)***
factor(country)Chile 93.447 (15.923)*** 34.036 (18.654)*
factor(country)Colombia 110.437 (15.680)*** 45.911 (19.349)**
factor(country)Costa Rica 70.170 (15.047)*** 22.280 (16.510)
factor(country)Cuba 70.220 (13.662)*** 21.972 (15.629)
factor(country)Dominica 48.848 (12.952)*** 9.914 (13.922)
factor(country)Dominican Republic 71.765 (15.283)*** 20.306 (17.155)
factor(country)Ecuador 57.991 (10.721)*** 20.056 (12.331)
factor(country)El Salvador 58.564 (11.692)*** 10.609 (14.236)
factor(country)Grenada 7.927 (5.136) 0.822 (4.752)
factor(country)Guatemala 39.412 (7.708)*** 11.790 (8.940)
factor(country)Guyana -8.802 (2.232)*** -9.570 (1.971)***
factor(country)Haiti 32.570 (8.740)*** 1.768 (10.032)
factor(country)Honduras 39.885 (9.880)*** 10.274 (10.680)
factor(country)Jamaica 31.747 (8.964)*** 4.512 (9.693)
factor(country)Mexico 175.996 (28.262)*** 89.396 (30.919)***
factor(country)Nicaragua 41.082 (9.148)*** 9.023 (10.443)
factor(country)Panama 52.858 (12.124)*** 16.427 (13.051)
factor(country)Paraguay 42.768 (10.644)*** 10.509 (11.516)
factor(country)Peru 89.661 (13.882)*** 33.487 (16.956)*
factor(country)Puerto Rico 88.436 (17.096)*** 25.864 (19.723)
factor(country)Sint Maarten (Dutch part) 81.039 (22.721)*** 26.130 (22.969)
factor(country)St. Kitts and Nevis -0.350 (2.300) -4.010 (2.161)*
factor(country)St. Lucia -15.044 (2.650)*** -7.019 (2.797)**
factor(country)St. Vincent and the Grenadines 23.899 (9.662)** 3.993 (9.447)
factor(country)Suriname 41.995 (11.711)*** 7.288 (12.535)
factor(country)Trinidad and Tobago 29.511 (8.173)*** 6.262 (8.640)
factor(country)Turks and Caicos Islands 77.441 (18.955)*** 21.369 (20.253)
factor(country)Uruguay 87.672 (17.935)*** 23.794 (20.486)
factor(country)Virgin Islands (U.S.) 89.302 (17.872)*** 25.791 (20.346)
factor(year)2019 -0.077 (0.702) 0.158 (0.215)
factor(year)2020 -0.687 (0.704) -0.753 (0.298)**
factor(year)2021 -1.844 (0.703)*** -1.515 (0.332)***
Constant 55.330 (11.683)*** 55.571 (79.826) 54.491 (11.465)*** 16.913 (69.955)
Observations 148 148 148 148
R2 0.302 0.946 0.344 0.960
Adjusted R2 0.283 0.926 0.311 0.944
Note: Standard Errors reported in parentheses, *p<0.1;**p<0.05;***p<0.01

14.7 Data Summary by Country

The remainder of this file has summaries of the data that are included to illustrate the within transformation. The colors in the tables for each variable make it easy to see the variation used when we use the within transformation, and thus that is used for identification in fixed effects models. For each variable, for each country you can clearly see which years are above that countries average and which years are below that country’s average.

14.7.1 Standard Summary Statistics

Statistic N Mean St. Dev. Min Pctl(25) Median Pctl(75) Max
lifeExp 148 73.983 3.637 63.192 72.146 73.822 76.749 80.326
gdpPerCapita 148 12.091 8.855 1.284 5.948 8.607 15.768 36.925
pop 148 16.715 39.711 0.041 0.178 3.428 11.358 214.326
pctFemale 148 50.604 1.205 46.478 49.936 50.437 51.136 53.236
pctRural 148 34.378 22.239 0.000 17.339 31.764 47.478 81.322

14.7.2 Average Values for Each Country

country Avg
lifeExp
Avg
gdpPerCapita
Avg
pop
Avg
pctFemale
Avg
pctRural
Antigua and Barbuda 78.63 16.75 0.09 52.27 75.52
Argentina 76.39 12.40 45.15 50.49 7.95
Aruba 75.67 28.47 0.11 52.85 56.37
Bahamas, The 72.32 27.46 0.41 52.13 16.81
Barbados 77.32 16.14 0.28 52.08 68.81
Belize 72.74 5.56 0.39 49.66 54.05
Bolivia 65.92 3.11 11.85 49.79 30.05
Brazil 74.30 8.51 212.37 50.85 13.05
Chile 79.69 13.62 19.13 50.37 12.31
Colombia 75.27 6.25 50.48 50.64 18.74
Costa Rica 78.80 12.52 5.10 49.93 19.60
Cuba 76.59 7.64 11.30 50.29 22.84
Dominica 73.40 7.27 0.07 50.10 29.06
Dominican Republic 73.08 8.02 10.94 49.73 17.84
Ecuador 75.05 5.67 17.44 50.02 35.92
El Salvador 71.73 4.02 6.29 52.36 26.92
Grenada 74.88 8.66 0.12 49.91 63.53
Guatemala 71.72 4.24 16.73 50.48 48.36
Guyana 68.04 8.12 0.80 50.96 73.26
Haiti 63.88 1.36 11.23 50.41 43.37
Honduras 71.82 2.37 10.04 49.48 41.96
Jamaica 71.48 5.08 2.82 50.37 43.84
Mexico 72.14 9.90 125.45 51.11 19.41
Nicaragua 73.38 2.00 6.71 50.72 41.11
Panama 77.14 14.12 4.26 49.96 31.76
Paraguay 72.66 6.23 6.57 49.77 37.96
Peru 74.55 6.32 33.01 50.45 21.80
Puerto Rico 79.26 29.11 3.23 52.64 6.42
Sint Maarten (Dutch part) 74.78 30.03 0.04 46.75 0.00
St. Kitts and Nevis 71.59 20.28 0.05 51.52 69.17
St. Lucia 72.83 9.98 0.18 50.42 81.20
St. Vincent and the Grenadines 72.18 8.09 0.10 48.91 47.18
Suriname 71.91 7.95 0.60 50.13 33.87
Trinidad and Tobago 73.85 14.89 1.52 50.61 46.79
Turks and Caicos Islands 75.34 22.01 0.04 49.56 6.53
Uruguay 77.25 17.20 3.43 51.60 4.53
Virgin Islands (U.S.) 79.77 36.05 0.11 53.02 4.12

14.7.3 Variable-Specific Values and Within Transformation for Each Country

For each variable, display each country’s values in 2018, 2019, 2020, and 2021, followed by the country’s average. These 5 columns are shaded from red (lowest) to green (highest) for each country. Then, in the final 4 columns display the within transformation (i.e., subtract the country’s average from each year’s value). These last 4 columns are also shaded for each country.

14.7.4 Life expectancy

iso3c 2018
Life Exp
2019
Life Exp
2020
Life Exp
2021
Life Exp
Avg
Life Exp
2018
Within
2019
Within
2020
Within
2021
Within
ABW 76.07 76.25 75.72 74.63 75.67 0.40 0.58 0.06 -1.04
ARG 77.00 77.28 75.89 75.39 76.39 0.61 0.89 -0.50 -1.00
ATG 78.51 78.69 78.84 78.50 78.63 -0.12 0.06 0.21 -0.14
BHS 73.81 71.20 72.68 71.60 72.32 1.48 -1.12 0.36 -0.72
BLZ 73.70 73.93 72.85 70.47 72.74 0.96 1.19 0.11 -2.27
BOL 67.75 67.84 64.47 63.63 65.92 1.83 1.92 -1.45 -2.29
BRA 75.11 75.34 74.01 72.75 74.30 0.81 1.04 -0.29 -1.55
BRB 77.07 77.26 77.39 77.57 77.32 -0.26 -0.06 0.07 0.25
CHL 80.13 80.33 79.38 78.94 79.69 0.44 0.63 -0.32 -0.75
COL 76.75 76.75 74.77 72.83 75.27 1.47 1.48 -0.51 -2.44
CRI 79.48 79.43 79.28 77.02 78.80 0.68 0.62 0.47 -1.78
CUB 77.50 77.61 77.57 73.68 76.59 0.91 1.02 0.98 -2.91
DMA 73.59 73.56 73.65 72.81 73.40 0.19 0.16 0.25 -0.59
DOM 73.23 73.58 72.89 72.61 73.08 0.15 0.50 -0.19 -0.46
ECU 77.09 77.30 72.15 73.67 75.05 2.04 2.24 -2.90 -1.38
GRD 74.81 74.86 74.92 74.94 74.88 -0.07 -0.02 0.04 0.05
GTM 72.73 73.13 71.80 69.24 71.72 1.00 1.41 0.07 -2.49
GUY 68.90 69.12 68.49 65.67 68.04 0.85 1.08 0.44 -2.37
HND 72.81 72.88 71.46 70.12 71.82 0.99 1.06 -0.36 -1.70
HTI 64.02 64.25 64.05 63.19 63.88 0.14 0.38 0.17 -0.69
JAM 71.79 71.77 71.87 70.50 71.48 0.31 0.28 0.39 -0.98
KNA 71.47 71.57 71.63 71.68 71.59 -0.12 -0.02 0.04 0.09
LCA 73.36 73.44 73.42 71.11 72.83 0.52 0.61 0.58 -1.72
MEX 74.02 74.20 70.13 70.21 72.14 1.87 2.06 -2.01 -1.93
NIC 73.85 74.05 71.80 73.84 73.38 0.47 0.67 -1.59 0.45
PAN 77.86 77.81 76.66 76.22 77.14 0.72 0.67 -0.48 -0.92
PER 76.01 76.16 73.67 72.38 74.55 1.46 1.60 -0.89 -2.17
PRI 79.77 79.06 78.04 80.16 79.26 0.51 -0.20 -1.22 0.90
PRY 73.57 73.62 73.18 70.26 72.66 0.91 0.96 0.52 -2.40
SLV 72.56 72.56 71.06 70.75 71.73 0.82 0.83 -0.67 -0.98
SUR 72.55 72.24 72.56 70.27 71.91 0.65 0.33 0.65 -1.63
SXM 75.13 75.44 74.58 73.97 74.78 0.35 0.66 -0.20 -0.81
TCA 76.44 75.33 75.00 74.59 75.34 1.10 -0.01 -0.34 -0.75
TTO 73.80 74.23 74.41 72.97 73.85 -0.05 0.38 0.55 -0.88
URY 77.61 77.51 78.43 75.44 77.25 0.36 0.26 1.18 -1.81
VCT 74.13 72.83 72.13 69.63 72.18 1.95 0.66 -0.05 -2.55
VIR 79.52 79.67 79.82 80.07 79.77 -0.25 -0.10 0.05 0.30

14.7.5 GDP per capita

iso3c 2018
GDP per Capita
2019
GDP per Capita
2020
GDP per Capita
2021
GDP per Capita
Avg
GDP per Capita
2018
Within
2019
Within
2020
Within
2021
Within
ABW 31172.80 30317.61 23015.74 29390.38 28474.13 2.70 1.84 -5.46 0.92
ARG 13105.40 12716.22 11346.65 12444.32 12403.15 0.70 0.31 -1.06 0.04
ATG 17901.04 18357.68 14803.77 15921.10 16745.90 1.16 1.61 -1.94 -0.82
BHS 30412.13 29988.17 22830.50 26614.19 27461.25 2.95 2.53 -4.63 -0.85
BLZ 5699.06 5833.17 4957.94 5768.91 5564.77 0.13 0.27 -0.61 0.20
BOL 3219.20 3242.95 2920.20 3061.90 3111.06 0.11 0.13 -0.19 -0.05
BRA 8553.87 8592.21 8255.57 8621.73 8505.84 0.05 0.09 -0.25 0.12
BRB 17283.38 17298.51 15067.44 14922.53 16142.96 1.14 1.16 -1.08 -1.22
CHL 13904.12 13758.75 12738.72 14093.09 13623.67 0.28 0.14 -0.88 0.47
COL 6320.99 6404.11 5852.98 6423.86 6250.49 0.07 0.15 -0.40 0.17
CRI 12470.96 12662.42 12030.05 12907.00 12517.61 -0.05 0.14 -0.49 0.39
CUB 8047.94 8043.01 7172.52 7291.04 7638.63 0.41 0.40 -0.47 -0.35
DMA 7586.65 7936.30 6566.43 6978.47 7266.96 0.32 0.67 -0.70 -0.29
DOM 7894.96 8205.14 7571.78 8410.61 8020.62 -0.13 0.18 -0.45 0.39
ECU 5976.25 5863.91 5331.98 5492.49 5666.16 0.31 0.20 -0.33 -0.17
GRD 9252.55 9247.90 7915.14 8223.19 8659.69 0.59 0.59 -0.74 -0.44
GTM 4163.48 4263.71 4124.14 4388.72 4235.01 -0.07 0.03 -0.11 0.15
GUY 6127.68 6348.68 9126.79 10857.32 8115.12 -1.99 -1.77 1.01 2.74
HND 2423.28 2446.11 2190.97 2428.03 2372.10 0.05 0.07 -0.18 0.06
HTI 1430.82 1387.51 1324.28 1284.48 1356.77 0.07 0.03 -0.03 -0.07
JAM 5264.20 5307.51 4769.69 4976.36 5079.44 0.18 0.23 -0.31 -0.10
KNA 21255.15 22138.59 18943.11 18788.42 20281.32 0.97 1.86 -1.34 -1.49
LCA 11176.44 11060.56 8335.18 9333.01 9976.30 1.20 1.08 -1.64 -0.64
MEX 10343.35 10226.23 9273.81 9760.45 9900.96 0.44 0.33 -0.63 -0.14
NIC 2052.14 1965.27 1904.28 2072.28 1998.49 0.05 -0.03 -0.09 0.07
PAN 14922.13 15166.88 12307.26 14069.88 14116.54 0.81 1.05 -1.81 -0.05
PER 6530.42 6550.45 5754.31 6446.89 6320.52 0.21 0.23 -0.57 0.13
PRI 29687.21 30181.27 28138.68 28423.81 29107.74 0.58 1.07 -0.97 -0.68
PRY 6338.51 6229.22 6095.39 6259.74 6230.72 0.11 0.00 -0.14 0.03
SLV 4011.54 4103.82 3775.58 4183.26 4018.55 -0.01 0.09 -0.24 0.16
SUR 8751.11 8756.15 7275.36 7029.63 7953.06 0.80 0.80 -0.68 -0.92
SXM 30149.58 32882.19 28030.41 29067.58 30032.44 0.12 2.85 -2.00 -0.96
TCA 25080.16 25438.78 18122.43 19386.52 22006.97 3.07 3.43 -3.88 -2.62
TTO 15716.43 15614.99 14214.39 13997.62 14885.86 0.83 0.73 -0.67 -0.89
URY 17440.38 17563.21 16459.98 17342.79 17201.59 0.24 0.36 -0.74 0.14
VCT 8152.41 8234.28 7948.48 8034.73 8092.47 0.06 0.14 -0.14 -0.06
VIR 35183.24 36328.07 35758.79 36925.33 36048.86 -0.87 0.28 -0.29 0.88

14.7.6 Population

iso3c 2018
Population
2019
Population
2020
Population
2021
Population
Avg
Population
2018
Within
2019
Within
2020
Within
2021
Within
ABW 105962 106442 106585 106537 106381.50 0.00 0.00 0.00 0.00
ARG 44494502 44938712 45376763 45808747 45154681.00 -0.66 -0.22 0.22 0.65
ATG 91626 92117 92664 93219 92406.50 0.00 0.00 0.00 0.00
BHS 401906 404557 406471 407906 405210.00 0.00 0.00 0.00 0.00
BLZ 382066 389095 394921 400031 391528.25 -0.01 0.00 0.00 0.01
BOL 11606905 11777315 11936162 12079472 11849963.50 -0.24 -0.07 0.09 0.23
BRA 210166592 211782878 213196304 214326223 212367999.25 -2.20 -0.59 0.83 1.96
BRB 279688 280180 280693 281200 280440.25 0.00 0.00 0.00 0.00
CHL 18701450 19039485 19300315 19493184 19133608.50 -0.43 -0.09 0.17 0.36
COL 49276961 50187406 50930662 51516562 50477897.75 -1.20 -0.29 0.45 1.04
CRI 5040734 5084532 5123105 5153957 5100582.00 -0.06 -0.02 0.02 0.05
CUB 11328244 11316697 11300698 11256372 11300502.75 0.03 0.02 0.00 -0.04
DMA 70823 71428 71995 72412 71664.50 0.00 0.00 0.00 0.00
DOM 10765531 10881882 10999664 11117873 10941237.50 -0.18 -0.06 0.06 0.18
ECU 17015672 17343740 17588595 17797737 17436436.00 -0.42 -0.09 0.15 0.36
GRD 121838 122724 123663 124610 123208.75 0.00 0.00 0.00 0.00
GTM 16346950 16604026 16858333 17109746 16729763.75 -0.38 -0.13 0.13 0.38
GUY 785514 798753 797202 804567 796509.00 -0.01 0.00 0.00 0.01
HND 9792850 9958829 10121763 10278345 10037946.75 -0.25 -0.08 0.08 0.24
HTI 11012421 11160438 11306801 11447569 11231807.25 -0.22 -0.07 0.07 0.22
JAM 2811835 2813773 2820436 2827695 2818434.75 -0.01 0.00 0.00 0.01
KNA 47761 47712 47642 47606 47680.25 0.00 0.00 0.00 0.00
LCA 177888 178583 179237 179651 178839.75 0.00 0.00 0.00 0.00
MEX 124013861 125085311 125998302 126705138 125450653.00 -1.44 -0.37 0.55 1.25
NIC 6572233 6663924 6755895 6850540 6710648.00 -0.14 -0.05 0.05 0.14
PAN 4165255 4232532 4294396 4351267 4260862.50 -0.10 -0.03 0.03 0.09
PER 32203944 32824861 33304756 33715471 33012258.00 -0.81 -0.19 0.29 0.70
PRI 3193354 3193694 3281557 3262693 3232824.50 -0.04 -0.04 0.05 0.03
PRY 6443328 6530026 6618695 6703799 6573962.00 -0.13 -0.04 0.04 0.13
SLV 6276342 6280217 6292731 6314167 6290864.25 -0.01 -0.01 0.00 0.02
SUR 593715 600301 607065 612985 603516.50 -0.01 0.00 0.00 0.01
SXM 40895 41608 42310 42668 41870.25 0.00 0.00 0.00 0.00
TCA 41487 43080 44276 45114 43489.25 0.00 0.00 0.00 0.00
TTO 1504709 1519955 1518147 1525663 1517118.50 -0.01 0.00 0.00 0.01
URY 3427042 3428409 3429086 3426260 3427699.25 0.00 0.00 0.00 0.00
VCT 105281 104924 104632 104332 104792.25 0.00 0.00 0.00 0.00
VIR 107001 106669 106290 105870 106457.50 0.00 0.00 0.00 0.00

14.7.7 Percent female

iso3c 2018
%Female
2019
%Female
2020
%Female
2021
%Female
Avg
%Female
2018
Within
2019
Within
2020
Within
2021
Within
ABW 52.79 52.85 52.89 52.87 52.85 -0.06 0.00 0.04 0.02
ARG 50.49 50.49 50.49 50.49 50.49 0.00 0.00 0.00 0.00
ATG 52.29 52.28 52.26 52.25 52.27 0.02 0.01 -0.01 -0.02
BHS 52.06 52.11 52.15 52.19 52.13 -0.06 -0.02 0.02 0.06
BLZ 49.65 49.64 49.66 49.70 49.66 -0.01 -0.02 0.00 0.03
BOL 49.75 49.76 49.80 49.84 49.79 -0.04 -0.02 0.01 0.06
BRA 50.82 50.84 50.85 50.87 50.85 -0.02 -0.01 0.01 0.03
BRB 52.11 52.09 52.07 52.05 52.08 0.03 0.01 -0.01 -0.03
CHL 50.37 50.36 50.36 50.37 50.37 0.00 0.00 0.00 0.00
COL 50.62 50.63 50.64 50.67 50.64 -0.02 -0.01 0.00 0.03
CRI 49.90 49.92 49.94 49.97 49.93 -0.03 -0.01 0.01 0.03
CUB 50.24 50.27 50.30 50.35 50.29 -0.05 -0.02 0.01 0.06
DMA 49.94 50.06 50.16 50.23 50.10 -0.16 -0.04 0.06 0.13
DOM 49.68 49.71 49.75 49.79 49.73 -0.05 -0.02 0.02 0.06
ECU 49.99 49.99 50.02 50.07 50.02 -0.03 -0.02 0.00 0.05
GRD 49.86 49.90 49.93 49.96 49.91 -0.05 -0.01 0.02 0.05
GTM 50.47 50.47 50.48 50.50 50.48 -0.01 -0.01 0.00 0.02
GUY 50.86 50.82 51.09 51.07 50.96 -0.11 -0.14 0.13 0.11
HND 49.46 49.47 49.49 49.50 49.48 -0.02 -0.01 0.00 0.02
HTI 50.39 50.40 50.42 50.44 50.41 -0.03 -0.01 0.01 0.03
JAM 50.35 50.36 50.37 50.39 50.37 -0.02 -0.01 0.01 0.02
KNA 51.39 51.48 51.57 51.66 51.52 -0.13 -0.04 0.05 0.13
LCA 50.35 50.40 50.44 50.49 50.42 -0.07 -0.02 0.02 0.07
MEX 51.07 51.08 51.12 51.18 51.11 -0.05 -0.03 0.01 0.07
NIC 50.72 50.71 50.72 50.72 50.72 0.00 0.00 0.00 0.01
PAN 49.94 49.95 49.96 49.98 49.96 -0.02 -0.01 0.00 0.02
PER 50.43 50.44 50.46 50.48 50.45 -0.02 -0.01 0.01 0.03
PRI 52.51 52.60 52.69 52.76 52.64 -0.13 -0.04 0.05 0.12
PRY 49.75 49.76 49.78 49.80 49.77 -0.02 -0.01 0.01 0.03
SLV 52.32 52.35 52.37 52.38 52.36 -0.03 -0.01 0.01 0.03
SUR 50.09 50.12 50.14 50.18 50.13 -0.05 -0.01 0.01 0.05
SXM 47.07 46.84 46.63 46.48 46.75 0.31 0.08 -0.12 -0.28
TCA 49.50 49.54 49.58 49.62 49.56 -0.06 -0.02 0.02 0.06
TTO 50.59 50.53 50.65 50.66 50.61 -0.02 -0.08 0.04 0.05
URY 51.63 51.61 51.59 51.57 51.60 0.03 0.01 -0.01 -0.03
VCT 48.85 48.88 48.93 49.00 48.91 -0.07 -0.03 0.02 0.09
VIR 52.81 52.94 53.09 53.24 53.02 -0.21 -0.08 0.07 0.22

14.7.8 Percent rural

iso3c 2018
%Rural
2019
%Rural
2020
%Rural
2021
%Rural
Avg
%Rural
2018
Within
2019
Within
2020
Within
2021
Within
ABW 56.59 56.45 56.30 56.13 56.37 0.22 0.08 -0.07 -0.24
ARG 8.13 8.01 7.89 7.77 7.95 0.18 0.06 -0.06 -0.18
ATG 75.40 75.49 75.57 75.62 75.52 -0.12 -0.03 0.05 0.10
BHS 16.98 16.87 16.75 16.64 16.81 0.17 0.06 -0.05 -0.17
BLZ 54.28 54.13 53.98 53.80 54.05 0.23 0.09 -0.07 -0.25
BOL 30.58 30.23 29.88 29.52 30.05 0.52 0.18 -0.17 -0.53
BRA 13.43 13.18 12.93 12.68 13.05 0.38 0.12 -0.13 -0.37
BRB 68.85 68.84 68.81 68.75 68.81 0.04 0.03 -0.01 -0.06
CHL 12.44 12.36 12.27 12.18 12.31 0.12 0.04 -0.04 -0.13
COL 19.22 18.90 18.58 18.26 18.74 0.48 0.16 -0.16 -0.48
CRI 20.66 19.92 19.23 18.58 19.60 1.06 0.33 -0.37 -1.02
CUB 22.96 22.89 22.81 22.71 22.84 0.12 0.05 -0.04 -0.13
DMA 29.52 29.21 28.91 28.60 29.06 0.46 0.15 -0.15 -0.46
DOM 18.93 18.17 17.46 16.79 17.84 1.09 0.34 -0.38 -1.05
ECU 36.18 36.01 35.83 35.64 35.92 0.26 0.10 -0.08 -0.28
GRD 63.73 63.60 63.46 63.31 63.53 0.20 0.08 -0.06 -0.22
GTM 48.95 48.56 48.16 47.76 48.36 0.59 0.20 -0.19 -0.60
GUY 73.39 73.31 73.21 73.10 73.26 0.14 0.06 -0.04 -0.15
HND 42.90 42.27 41.64 41.02 41.96 0.95 0.31 -0.32 -0.94
HTI 44.72 43.81 42.91 42.04 43.37 1.35 0.44 -0.46 -1.33
JAM 44.33 44.02 43.69 43.35 43.84 0.48 0.17 -0.16 -0.50
KNA 69.22 69.20 69.16 69.09 69.17 0.06 0.03 -0.01 -0.08
LCA 81.32 81.25 81.16 81.06 81.20 0.13 0.05 -0.04 -0.14
MEX 19.84 19.56 19.27 18.98 19.41 0.43 0.14 -0.14 -0.43
NIC 41.48 41.24 40.99 40.72 41.11 0.37 0.13 -0.12 -0.38
PAN 32.29 31.94 31.59 31.23 31.76 0.53 0.18 -0.17 -0.54
PER 22.09 21.90 21.70 21.50 21.80 0.29 0.10 -0.10 -0.30
PRI 6.42 6.42 6.42 6.41 6.42 0.00 0.01 0.00 -0.01
PRY 38.42 38.12 37.82 37.50 37.96 0.45 0.16 -0.15 -0.46
SLV 27.98 27.25 26.56 25.88 26.92 1.06 0.34 -0.36 -1.04
SUR 33.94 33.91 33.85 33.78 33.87 0.07 0.04 -0.02 -0.09
SXM 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
TCA 6.90 6.64 6.39 6.17 6.53 0.38 0.11 -0.13 -0.36
TTO 46.82 46.81 46.79 46.74 46.79 0.03 0.03 0.00 -0.05
URY 4.67 4.57 4.48 4.40 4.53 0.14 0.04 -0.05 -0.13
VCT 47.80 47.39 46.97 46.55 47.18 0.63 0.21 -0.21 -0.63
VIR 4.28 4.17 4.06 3.96 4.12 0.16 0.05 -0.06 -0.16