# Combining multiple datasets vs combining regression models

I have 5 datasets, each one represent an observation for many countries.

data1 = (y,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10) as an observation at time t1.
data2 = (y,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10) as an observation at time t2.
data3 = (y,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10) as an observation at time t3.
data4 = (y,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10) as an observation at time t4.
data5 = (y,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10) as an observation at time t5.


each observation measures the variable $Y$ and $X_i$, $i$=1,..10 for 140 countries.

I want to fit a linear regression model to estimate a $Y$ variable with $X_i$ varibales.

My question is how to fit the best model using the five datasets.

There are two propositions:

1. fit the linear regression for each dataset and combine the models. in this case, what's the technique to combine several regression models.

2. combine all the datasets into one and fit one regression model. in this case, how to combine multiple datasets into one for fit linear regression). like concatinate them or take average, etc.

• So you have 5 observations for many countries. What is your dependent variable? one of five is the dependent variable and the other 4 are predictor variables?
– MFR
Sep 18, 2016 at 11:57
• i have 5 datasets, each one represent an observation with the same variables: Y as dependent variable and Xi, i=1,...,10 as independent variables. Sep 18, 2016 at 12:03
• Do you expect that the same model will be valid for data from across all 5 countries? Do you expect that some parameters will differ between countries? Sep 18, 2016 at 12:07
• It would be a good idea to add your clarifications into the question itself, using the "edit" button, rather than to post clarifications in the comments. Sep 18, 2016 at 12:08
• Combining the datasets into one may ignore the importance of time on the model. If t1 is 2004 and t5 is 2008 and you are looking at stock prices, ignoring time may erase some insight that could have been had from the model due to the severe recession. Sep 18, 2016 at 13:45

Your question isn't completely clear (what are the dependent and independent variables?) but I'll do my best to answer it.

I'm going to assume the following:

• All the datasets have the same dependent and independent variables.
• The datasets are split because each of them have something interesting that you want to evaluate.

With this in mind, I would suggest combining the datasets into one and fitting a single model. In this model I would include a "dataset" variable (i.e. a variable that differentiates between the datasets). By including this variable you could test whether there is a significant difference in your response variable between the original datasets.

As for how to combine them, if all datasets have the same variables (and you are working in R), then you can just use rbind(data.frame1, data.frame2) to join them together. If each dataset has different variables then its a bit more difficult.

One possibility is to use partial least square regression (PLSR) for the analysis of your data. It is a multivariate regression method that allows for the multivariate response matrix (in your case 5 y variables from five time points) to be fitted simultaniously to data matrix X consisting of all your measured variables.

In practice, this means that you would concatenate horizontally all y variables (from each time point) into one matrix which would be of dimension (140 x 5). This would be the response matrix Y in the PLSR model. Then you could collect all your measurement data into one large matrix that would be of dimension (140 x 50), where you horizontally concatenate the five blocks of x variables (each block consisting of 10 x variables). This would be your X matrix in the PLSR model.

You can use the pls-package in R to do this analysis. This article shows some examples how to do it. You can use loadings and correlation loading plots to identify variables in X that are important for describing the variance in Y. The plot for X scores you can study how the 140 countries are distributed in the new latent variable space, which ones are simliar, which are not, etc.

Make sure your variables are scaled in case they are measuring different units.