Page 1 of 2

Weighted Statistics in pooled model

Posted: Wed Oct 30, 2013 11:34 pm
by irulishka
Hello
I don’t understand how do you calculate weighted SSR in Pooled Model with Weighted (Cross Section Weights). It doesn’t fit the value I’ve got by hand. Besides, weighted DW is calculated using SSR, that I’ve get, not yours. Is it a mistake in formulas?
The same problem is for weighted stats: mean Dep VAR, SD Dep VAR, SE

Best regards, Ira

Re: Weighted Statistics in pooled model

Posted: Thu Oct 31, 2013 9:59 am
by EViews Glenn
I'm not certain what your spreadsheet calculations are supposed to represent as there are no pooled data nor estimates of the weights.

On a slightly different note, the following thread from yesterday may be of interest.

http://forums.eviews.com/viewtopic.php?f=4&t=9003

Re: Weighted Statistics in pooled model

Posted: Wed Nov 06, 2013 6:22 am
by irulishka
Thank you for your answer. It was very helpful.
But, if I apply this algoritm for Periodic Sur my "by hand" result would not be equivalent to EViews. May be I must use another algorithm to get Weighted?
May be you know how to get Weighted in Eviews by function, or could you show me where is a mistake in my algorithm?

Re: Weighted Statistics in pooled model

Posted: Wed Nov 06, 2013 6:23 am
by irulishka
And EViews wf

Re: Weighted Statistics in pooled model

Posted: Wed Nov 06, 2013 10:38 am
by EViews Glenn
What are you doing in your weight computation?

Re: Weighted Statistics in pooled model

Posted: Thu Nov 07, 2013 2:46 am
by irulishka
my algorithm:
1. Create equation eq0.ls y c x and take Residual of this model
2. Create matrix
on main diagonal: @sumsby(resid*resid,dateid)/@obsby(resid01,dateid)
not on diagonal:
1. multiply resid with following pairs by crossid
2. sum whis pairs by dateid and divide on number of observations in every dateid
3. Create scale = @sumsq(resid01)/@obs(resid01)
4. Divide all matrix element on scale
5. Use matrix from 4 in WLS

example of matrix cration in wgh.xlsx

Re: Weighted Statistics in pooled model

Posted: Thu Nov 07, 2013 11:39 am
by EViews Glenn
Why are you dividing by scale? Is there a Cholesky factorization or matrix inverse in there?

Re: Weighted Statistics in pooled model

Posted: Fri Nov 08, 2013 4:46 am
by irulishka
I use FORMULA b = (x'*omg^-1*x)^-1*x'*omg^-1*y, where omg is a matrix:
on main diagonal: @sumsby(resid*resid,dateid)/@obsby(resid01,dateid)
not on diagonal:
1. multiply resid with following pairs by crossid
2. sum this pairs by dateid and divide on number of observations in every dateid

and if I not use scale I get equivalent Eviews result!!! :D


But, when I start calculate statistics I get another result:( for example: mean(y_Weigts)=0.4196, there y_Weigts=omg*y, in Eviews mean(y_Weigts)=0.2444.
I must use Cholesky factorization? But after Cholesky factorization I get not simmetric matrix.

Re: Weighted Statistics in pooled model

Posted: Fri Nov 08, 2013 7:28 am
by EViews Glenn
I don't quite understand the question, but you can think of the weighted dependent variable as the Cholesky factor multipled by the dependent variable. You basically orthogonalize the entire Y series.

Re: Weighted Statistics in pooled model

Posted: Mon Nov 11, 2013 1:00 am
by irulishka
I want to explain my question. I have martix W. We know how to calculate it from previous posts. And we have actual y.
If we want to apply Cholesky factorization we use this EViews code:

matrix wCh = @cholesky(w)
matrix ym = wch*y
scalar meanYW=@mean(ym)

after this meanYW = 0.4905948469694039, where the result in equation: Mean dependent var = 0.2444270961051787

I can'tundirstand how you get this result, when you use the Cholesky factorization. May be I should use another matrix, not W?

Re: Weighted Statistics in pooled model

Posted: Mon Nov 11, 2013 1:24 pm
by EViews Glenn
@mean(@inverse(@cholesky(w))*y)

Re: Weighted Statistics in pooled model

Posted: Wed Nov 13, 2013 1:21 am
by irulishka
Thank you! Your previous post was very helpful!

But I found one more problem:( I can't calculate Weighted R2.
I use algoritm from http://forums.eviews.com/viewtopic.php? ... ics#p30543, but it works only for model with constant. => How to calculate Weighted R2 for model like y= c*x?

Re: Weighted Statistics in pooled model

Posted: Wed Nov 13, 2013 9:27 am
by EViews Glenn
The base model we use is always a model with a constant only.

Re: Weighted Statistics in pooled model

Posted: Tue Feb 04, 2014 11:50 pm
by irulishka
Thank you!=)

Re: Weighted Statistics in pooled model

Posted: Wed Mar 05, 2014 2:31 am
by irulishka
Hello!
I have tried to use formula @mean(@inverse(@cholesky(w))*y) for data with gaps, but EViews show the error message: "Size do not match in matrix function". Why?
I have matrix [15*15] and vector y [1*15] with gaps.
i mast use other formuls?