# Social science panel data analysis

Currently I am working on a project where I need to find out whether financial aid (per capita) has an influence on the country's HDI. I have compiled a dataset, which you can find here: http://paste.ofcode.org/bKHLd3fLcY9awWQqQ6ebgX

I am looking at the best way to find out whether my research question is true. Obviously I am going to needs some kind of regression analysis, but I do not really know where to start. I have read something about panel data/longitudinal data analysis, but I am really unsure whether that is indeed what I am looking for.

I tried some things, obviously, like the following:

plm(HDI ~ Aid, data=HDIData, index=c("Country", "Year"), model="within")


But this gave me the result that an increase of one unit in aid would result in an increase of 0.0355 in HDI. This seems highly unlikely, as some countries have received 800 dollars per capita in financial aid. Granted, the P value was 0.8432, so it would be statistically insignificant, but even then, I have got no clue whether this is even remotely correct.

I also saw people running the same command, but then using log(HDI) ~ log(Aid)...?

Could someone point me in the right direction? Much obliged!

• Consider changing the title of the question. The current one is not very informative and perhaps slightly misleading (since the problem is not exactly about time series). May 29 '15 at 20:38

This looks like panel data to me. I have no practical experience with panel data (only had an introductory, theoretical course) but I will try to guess what models could make sense. Please take this as an opinion of an inexperienced guy, and certainly not a definite answer.

You may assume that each country's $HDI$ changes directly proportionally to $aid$ so that

$$\Delta HDI_{i,t} = \alpha_i + \beta_i aid_{i,t} + \varepsilon_{i,t};$$

here $i$ indexes countries and $t$ indexes time. Allowing for an intercept $\alpha_i$ in the model allows for a linear time trend in $HDI$; it may or may not be relevant, so you may or may not want to include the intercept into the model.

You may also consider how long it takes for the $aid$ to have an effect on $HDI$; the effect need not be immediate -- the delay could be one year or more. Then the model would look like

$$\Delta HDI_{i,t} = \alpha_i + \beta_i aid_{i,t-h} + \varepsilon_{i,t}$$

with some $h>0$. In the code examples below, I will assume that $h=0$ or $h=1$ (just for the sake of simplicity).

If you make no further simplifying assumptions, you could run regressions of the form lm(diff(HDI_i)~ aid_i[-y]) (with intercept) or
lm(diff(HDI_i)~-1+aid_i[-y]) (without intercept)
for each country separately.
[-y] allows you to remove either the first year (use [-1] in place of [-y]; then the effect of $aid$ on $HDI$ would be immediate) or the last year (use [-9], since you have 9 years of data; then the effect of $aid$ on $HDI$ would be lagged by one year).
HDI_i and aid_i are $HDI$ and $aid$ for country $i$, respectively.

If you assume that the effect of $aid$ on the change in $HDI$ is the same for all countries ($\beta_i \equiv \beta$) and you include the intercept, you could estimate the following model (how is it called?) using the data for all the countries at once (as opposed to the separate models for each country above):

$$\Delta HDI_{i,t} = \alpha_i + \beta \ aid_{i,t-h} + \varepsilon_{i,t}.$$

If you assume that the effect of $aid$ on the change in $HDI$ is the same for all countries ($\beta_i \equiv \beta$) and you include the intercept and you furthermore assume that it is the same for each country (that is, the linear trend in $HDI$ is the same for each country), you get the following model (again, how is it called?) which you again can estimate using the data for all the countries at once:

$$\Delta HDI_{t} = \alpha + \beta \ aid_{t-h} + \varepsilon_{t}$$

This can be coded in R as follows:
lm(diff(HDI)~ aid[-which(Year==2005)]) for non-lagged aid or
lm(diff(HDI)~ aid[-which(Year==2013)]) for aid lagged by one period.
Here HDI is a long column vector including all the countries and all the time periods, as you have in the data in the link in the original post. The same with aid and Year.

If you exclude the intercept but still assume that $\beta_i \equiv \beta$, a model of the form

$$\Delta HDI_{t} = \beta \ aid_{t-h} + \varepsilon_{t}$$

would do. This can be coded in R as follows:
lm(diff(HDI)~-1+aid[-which(Year==2005)]) for non-lagged aid or
lm(diff(HDI)~-1+aid[-which(Year==2013)]) for aid lagged by one period.

The different assumptions made above are testable.

• Thank you very much for your contribution! Would you using an intercept or not (tbh not too sure what the difference is). And the last two models (of which you forgot the name). Would you perhaps know how to do these in R? May 29 '15 at 21:56
• If you use an intercept, that means you are assuming a linear time trend in $HDI$; this trend is not due to the effect of $aid$ but due to some other reason. I know little about the human development index and what is causing it to change (besides the aid), so I am not able to tell whether it is supposed to have a linear trend or not. If I had to guess right now, I would assume there is no linear trend (the humanity is not constantly improving or constantly deteriorating in terms of $HDI$). But this may be wrong, so you had better check the literature about $HDI$. May 30 '15 at 8:58
• I edited the answer to include the code for the last two models. May 30 '15 at 9:07
• Thank you very much! I wish I could upvote your answers, but I don't have enough rep yet. May 31 '15 at 11:06
• That's OK. Keep in mind that I know little about panel data, so you may benefit from consulting someone more experienced. May 31 '15 at 11:10