# Multilevel analysis: panel data and multiple levels

Suppose we have a historical (panel/longitudinal) dataset on the number of buildings in each sub-region (this is a made-up dataset to explain the concept):  • The variable “Year” ranges from 1 to 10 and it represents the year that each data point belongs to.
• The variable “Sub-region” ranges from 1 to 50 and it represents the sub-region the data was collected from.
• The variable “Type” ranges from 1 to 2 and it represents the type of each building (say: office car or residential).
• The variable “Group” ranges from 1 to 3 and it represents the age group of each building (say: <5years, 5-10 years, >10 years old).
• The variable “Count” is the dependent variable (Y) and it represents the number of each building group of each type in each sub-region at any specific year.
• The variable “Population” is one of the independent variables (X1) and it represent the population size in each sub-region. Note: it has the same value for each sub-region at any specific year. However it varies from sub-region to sub-region and in each sub-region across years.
• The variable “Cost” is another independent variable (X2) and it represent construction cost in each year. Note: it has the same value for all sub-regions at any specific year. However it varies across years.

The idea is to develop a regression model (Y= a + b1*X1 + b2*X2) while taking into account the hierarchical (multilevel) nature of the data.

In multilevel models (the classic example of students within classes within schools within districts), each level is defined by a unique set of observations. For instance, classes’ IDs and attributes vary from one school to another. However, in my example each sub-region has the same number and IDs of building types –same thing for groups within types.

My first question is: can I treat this data as multilevel data and accordingly develop a multilevel model with three levels (sub-region, type, and group) while considering the longitudinal nature of the data by adding a random effect (intercept and slope) for years? For instance, in R using nlme, develop a model:

Model <- lme(fixed= log(Count)~Year+log(Population)+Cost,
random=list(Sub-region =~year, Type=~1, Group=~1),
correlation= corAR1(form=~Year|Sub-region/Type/Group), data=mydata)


Alternatively,

Model <- lme(fixed= log(Count)~Year+log(Population)+Cost, random=~Year|Sub-region/Type/Group, correlation= corAR1(form=~Year|Sub-region/Type/Group), data=mydata)


The second question is related to applying this model: suppose we want to estimate / forecast the number of buildings in group 3 of type 1 for sub-region 2 then the model formula should be:

Y|(sub-region=2, type=1, group=3) = [fixed effect: intercept] +
[fixed effect: Year]*(Year) + [fixed effect: Population]*(log(Population)) +
[fixed effect: Cost] *(Cost) + [random effect: intercept for sub-region 2] +
[random effect: Year for sub-region 2] *(Year) +
[random effect: intercept of type 1 for sub-region 2] +
[random effect: intercept of group 3 of type 1 for sub-region 2]
= number of buildings in group 3 of type 1 for sub-region 2


What are the other alternatives? Can I model each type / group (6 different models, estimated separately), each as a multilevel model where data is clustered within sub-regions and the longitudinal nature of the data is considered (especially in this case where the independent variables do not vary across the type / groups (the case when SUR is the same as OLS))?