1
$\begingroup$

I have a dataset where I am interested in calculating a slope for each observation / row.

I have dependent variable $Y$ that is continuous. Every $Y$ is unique to a zipcode. and my independent / predictor variables are measured over time for every $Y$, say $x_1$ to $x_{20}$. I am looking for a slope for each $Y$ for each zip code for each row. I am not sure if I can do this by linear regression because I only have one observation for $y$.

I cannot average $x_1$ to $x_{20}$, because I will lose the information on the slope.

The goal here is to measure change in $x$ ($x_1$ to $x_{20}$) on $Y$, and since $x_1$ to $x_{20}$ is measured over time I like to retain the slope information and not simply take the average. I am trying to answer the question 'how severe is the change in $x$ on a zipcode which has a value $Y$'.

$\endgroup$
1
$\begingroup$

You will want to use a mixed effects model / multi-level model (these are ultimately the same thing, but they have different terminology and historical development, and constitute different ways of thinking about the situation).

The idea behind these is that you are sampling your zip codes from a population, and you can fit distributions of slopes and intercepts associated with your zip codes over time. The primary output of such analyses is a population mean slope and intercept, but you can get predicted slopes for each zip code as well.

Your question is rather vague, but I'm guessing you will actually want to take your $x$'s as the dependent variable and $Y$ as the predictor variable. ${\rm Time}$ will also be a predictor variable and your data will be nested within zipcodes.

If you want to explore the threads on CV related to this topic, you can search under the , , and tags. In my opinion, the best overall book is:

$\endgroup$
  • $\begingroup$ unfortunately I do not have lots of data on all zip codes. but your idea is definitely worth trying. Thanks. $\endgroup$ – user45806 Jun 9 '14 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.