Weighted Statistics in pooled model
Moderators: EViews Gareth, EViews Moderator
Weighted Statistics in pooled model
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
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
- Attachments
-
- Pool.xlsx
- (11.63 KiB) Downloaded 589 times
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Weighted Statistics in pooled model
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
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
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?
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?
- Attachments
-
- Wgh.xlsx
- (10.17 KiB) Downloaded 576 times
Last edited by irulishka on Wed Nov 06, 2013 6:36 am, edited 1 time in total.
Re: Weighted Statistics in pooled model
And EViews wf
- Attachments
-
- Wgh.WF1
- (10.44 KiB) Downloaded 465 times
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Weighted Statistics in pooled model
What are you doing in your weight computation?
Re: Weighted Statistics in pooled model
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
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
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Weighted Statistics in pooled model
Why are you dividing by scale? Is there a Cholesky factorization or matrix inverse in there?
Re: Weighted Statistics in pooled model
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.
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.
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Weighted Statistics in pooled model
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
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?
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?
- Attachments
-
- mean.wf1
- (11.32 KiB) Downloaded 474 times
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Weighted Statistics in pooled model
@mean(@inverse(@cholesky(w))*y)
Re: Weighted Statistics in pooled model
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?
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?
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Weighted Statistics in pooled model
The base model we use is always a model with a constant only.
Re: Weighted Statistics in pooled model
Thank you!=)
Re: Weighted Statistics in pooled model
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?
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?
Who is online
Users browsing this forum: No registered users and 2 guests
