Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Cross-Sectional Regression

Subject: Cross-Sectional Regression

From: Hans Schmidt

Date: 19 Feb, 2009 23:46:02

Message: 1 of 6

Hey folks,

I've a question concerning running cross sectioinal regressions in ML and getting regression statistics.

Suppose I've a dependent variable Y (100 return observations x 1000 firms) and I've 5 beta coefficients (5x1) that should explain the cross section of Y. So for each one of the 100 return observations, I would like to do a cross sectional regression on the 1000 firms reporting me coefficients, t-stats, standard errors and Rsquared.

Is there a clever way to do it? The function regress does not seem to work in the case of cross-sectional regressions.

I'd really appreciate your help.

Thank you.

Kind regards,
Hans

Subject: Cross-Sectional Regression

From: Peter Perkins

Date: 20 Feb, 2009 15:29:26

Message: 2 of 6

Hans Schmidt wrote:
> Hey folks,
>
> I've a question concerning running cross sectioinal regressions in ML and getting regression statistics.
>
> Suppose I've a dependent variable Y (100 return observations x 1000 firms) and I've 5 beta coefficients (5x1) that should explain the cross section of Y. So for each one of the 100 return observations, I would like to do a cross sectional regression on the 1000 firms reporting me coefficients, t-stats, standard errors and Rsquared.
>
> Is there a clever way to do it? The function regress does not seem to work in the case of cross-sectional regressions.

Hans, REGRESS will fit any univariate linear regression you want, you just have to create the right design matrix.

You haven't mentioned any predictor variables, but you do mention 5 coefficients, so perhaps you have 5 predictor variables, or four plus an intercept. I'm not an econometrician, but I'm guessing that you have data at 100 times, and you want to model each of the 100 1x1000 vectors of returns as a function of your predictors values at each of those times. What I don't know is if you want common estimates across times for some or all of the coefficients.

If you don't, then you'd just call regress 100 times. If you do, then you'll need to set up an appropriate design matrix. What you're asking for may be a standard thing in financial modelling, but I'm not relly up on that jargon.

Hope this helps.

Subject: Cross-Sectional Regression

From: Hans Schmidt

Date: 22 Feb, 2009 17:02:01

Message: 3 of 6

Peter Perkins <Peter.PerkinsRemoveThis@mathworks.com> wrote in message <gnmi8m$6n2$1@fred.mathworks.com>...
> Hans Schmidt wrote:
> > Hey folks,
> >
> > I've a question concerning running cross sectioinal regressions in ML and getting regression statistics.
> >
> > Suppose I've a dependent variable Y (100 return observations x 1000 firms) and I've 5 beta coefficients (5x1) that should explain the cross section of Y. So for each one of the 100 return observations, I would like to do a cross sectional regression on the 1000 firms reporting me coefficients, t-stats, standard errors and Rsquared.
> >
> > Is there a clever way to do it? The function regress does not seem to work in the case of cross-sectional regressions.
>
> Hans, REGRESS will fit any univariate linear regression you want, you just have to create the right design matrix.
>
> You haven't mentioned any predictor variables, but you do mention 5 coefficients, so perhaps you have 5 predictor variables, or four plus an intercept. I'm not an econometrician, but I'm guessing that you have data at 100 times, and you want to model each of the 100 1x1000 vectors of returns as a function of your predictors values at each of those times. What I don't know is if you want common estimates across times for some or all of the coefficients.
>
> If you don't, then you'd just call regress 100 times. If you do, then you'll need to set up an appropriate design matrix. What you're asking for may be a standard thing in financial modelling, but I'm not relly up on that jargon.
>
> Hope this helps.

Hey Peter,

thanks for your assistance.

What I am focussing on is a Procedure of Fama-Macbeth. It is a two-stage regression model. First you estimate your beta coefficients via a time series regression. Then you use these estimates as explanatory variables for the following cross sectional regressions in order to identify whether they are really priced in the cross section (i.e. they carry a risk premium) or not.

Let me put it the following way:

Assume I have T=100 observations of returns. Furthermore, I have two risk factors (regressors) with each 100 observations. Now I use the first 60 observations to estimate the coefficients via a time series regression. This leaves me with the observations 61 to 100 for cross sectional tests. For this, suppose I have these 61 to 100 for, say, 10 firms. So my cross sectional test would be, whether the two estimated coefficients explain each (61, 62, ..., 100) cross section of stock returns. So I should get 2 (risk factors) * 10 (number of firms) parameter estimates (when excluding a constant) for each cross section.

For example:

Y=normrnd(0.05,0.1,40,10) % cross section of stock returns, 40 dates/10 firms
X=[1.12 -0.67] % my coefficients computed used first 60 observations

How can I then run the cross sectional regressions described above?

Thank you very much for your assistance!

Subject: Cross-Sectional Regression

From: Peter Perkins

Date: 23 Feb, 2009 15:05:23

Message: 4 of 6

Hans Schmidt wrote:

> Assume I have T=100 observations of returns. Furthermore, I have two risk factors (regressors) with each 100 observations. Now I use the first 60 observations to estimate the coefficients via a time series regression. This leaves me with the observations 61 to 100 for cross sectional tests. For this, suppose I have these 61 to 100 for, say, 10 firms. So my cross sectional test would be, whether the two estimated coefficients explain each (61, 62, ..., 100) cross section of stock returns. So I should get 2 (risk factors) * 10 (number of firms) parameter estimates (when excluding a constant) for each cross section.

Hans, I'm not an econometrician. As I read your description, you want to do 40 linear regressions, each with 10 observations and each involving 20 or perhaps 21 coefficients. Obviously that makes no sense. Perhaps you mean that you want to estimate the _same_ 21 coefficients across all 40 times. That s easy to do. Perhaps you mean something else.

Subject: Cross-Sectional Regression

From: Hans Schmidt

Date: 24 Feb, 2009 19:16:01

Message: 5 of 6

Peter Perkins <Peter.PerkinsRemoveThis@mathworks.com> wrote in message <gnudvj$c1o$1@fred.mathworks.com>...
> Hans Schmidt wrote:
>
> > Assume I have T=100 observations of returns. Furthermore, I have two risk factors (regressors) with each 100 observations. Now I use the first 60 observations to estimate the coefficients via a time series regression. This leaves me with the observations 61 to 100 for cross sectional tests. For this, suppose I have these 61 to 100 for, say, 10 firms. So my cross sectional test would be, whether the two estimated coefficients explain each (61, 62, ..., 100) cross section of stock returns. So I should get 2 (risk factors) * 10 (number of firms) parameter estimates (when excluding a constant) for each cross section.
>
> Hans, I'm not an econometrician. As I read your description, you want to do 40 linear regressions, each with 10 observations and each involving 20 or perhaps 21 coefficients. Obviously that makes no sense. Perhaps you mean that you want to estimate the _same_ 21 coefficients across all 40 times. That s easy to do. Perhaps you mean something else.

Hey Peter,

I try to regress my 2 coefficients on each observation for each firm. So for instance, I start with t=61 and regress my 2 coefficients on each firm's observation separately. So I should get 2 (or 3 with a constant) estimates for firm 1, 2 (or 3) estimates for firm 2, etc. With ten firms, I get 2 (or 3) times 10 estimated parameters in the first cross section.

This procedure is repeated for t=62, t=63,...,100.

Thanks for your assistance.

Regards,
Hans

Subject: Cross-Sectional Regression

From: Peter Perkins

Date: 25 Feb, 2009 19:49:40

Message: 6 of 6

Hans Schmidt wrote:
> Peter Perkins <Peter.PerkinsRemoveThis@mathworks.com> wrote in message <gnudvj$c1o$1@fred.mathworks.com>...
>> Hans Schmidt wrote:
>>
>>> Assume I have T=100 observations of returns. Furthermore, I have two risk factors (regressors) with each 100 observations. Now I use the first 60 observations to estimate the coefficients via a time series regression. This leaves me with the observations 61 to 100 for cross sectional tests. For this, suppose I have these 61 to 100 for, say, 10 firms. So my cross sectional test would be, whether the two estimated coefficients explain each (61, 62, ..., 100) cross section of stock returns. So I should get 2 (risk factors) * 10 (number of firms) parameter estimates (when excluding a constant) for each cross section.
>> Hans, I'm not an econometrician. As I read your description, you want to do 40 linear regressions, each with 10 observations and each involving 20 or perhaps 21 coefficients. Obviously that makes no sense. Perhaps you mean that you want to estimate the _same_ 21 coefficients across all 40 times. That s easy to do. Perhaps you mean something else.
>
> Hey Peter,
>
> I try to regress my 2 coefficients on each observation for each firm. So for instance, I start with t=61 and regress my 2 coefficients on each firm's observation separately. So I should get 2 (or 3 with a constant) estimates for firm 1, 2 (or 3) estimates for firm 2, etc. With ten firms, I get 2 (or 3) times 10 estimated parameters in the first cross section.
>
> This procedure is repeated for t=62, t=63,...,100.

Hans, again, as I read your description, you are asking to estimate 20 (or 30) parameters using only 10 observations. You may well be using standard finance terminology, but I'm not following. REGRESS can fit any linear rgression you want, but I can't tell you how to set up the design matrix unless you describe the model that you want to fit very specifically in terms of what data you are using to estimate which parameters.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us