Hierarchical regression in a time series dataset I have a dataset of 250 lines and 11 columns. Each line contains data referring to a school. For each school I have its name and the number of applications, from 2012 to 2016, and I would like to predict the number of applications for 2017. I also have the neighborhood where each school is located, and the population of children in that neighborhood, from 2012 to 2017.
I know I should apply some kind of algorithm related to time series, but 1) I do not have much experience with time series, and 2) maybe a time series of 5 years is too short, right?
My question is whether it would make sense to transform my database to long format, previously removing the population variable of the year 2017, and apply a hierarchical regression model, with the number of applications as a dependent variable and the neighborhood and the population of children as independent variables. If this does not make sense, what type of analysis do you think is appropriate with this data to be able to make a prediction of the number of applications for the year 2017?
By the way, I'm doing the analysis in Python, but I would not have any trouble doing it in R.   
 A: I think a reasonable model that you could still estimate from this data is that the number of kids on a school is a percentage of the number of kids in the neighborhood. This percentage might have a trend, so perhaps including a linear trend for that is a good try. 
#kids ~ binom(n = #pop, p = inverse_logit(a_school + b_school * (#year)))
This is a timeseries model in that time is involved, but I wouldn't be looking at AR, MA or ARIMA for this if that's your idea. Something that is not in this model is that schools might have a maximum number of kids allowed each year. If there is such system, it will influence the numbers and the predictions of course. Also, in this simple model, you assume each kid has an independent chance of picking this school, but they might not be independent so you might see overdispersion. Also, in this simple model, you are assuming the school only gets kids from the neighborhood, but if there is schoolgoing happening over larger distances, it's not included in the model. Whether these things will actually affect the quality of your predictions remains to be seen. 
Now if there's important structural things going on, like a neighborhood expansion, or the opening or closing of a school nearby, these things are fit (badly probably) with the trend term, so if you know something about this, you should definitely include that, perhaps with a indicator term. Let's say you know the neighborhood in 2017 is twice the size of the neighborhood in 2016. Then a good bet will be a doubling of the number of kids on the school, and no model, be it ARIMA or linear or neural network whatever, will see it coming based on the numbers up to that year. 
Your question is about long format. The model you are describing is 
#kids ~ norm(a + b_neighborhood * neighborhood + b_population * population, sigma)
I think the coefficient of the population should vary by school. Some schools have a large percentage of the kids in a neighborhood, some only a small number. So a single coefficient here is probably not optimal. Also normal errors is not apriopriate, allthough it could work fine. 
The model you are describing, by the way, unless I'm missing something, is not a hierarchical model as commonly understood by statisticians. That term is used for a model with random effects, see https://en.wikipedia.org/wiki/Mixed_model. Including random effects in your model can be very beneficial as well, depending on the correlations between the schools.
