Weighted Statistics in pooled model

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

irulishka
Posts: 45
Joined: Fri Jun 03, 2011 9:38 am

Weighted Statistics in pooled model

Postby irulishka » Wed Oct 30, 2013 11:34 pm

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
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

Postby EViews Glenn » Thu Oct 31, 2013 9:59 am

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

irulishka
Posts: 45
Joined: Fri Jun 03, 2011 9:38 am

Re: Weighted Statistics in pooled model

Postby irulishka » Wed Nov 06, 2013 6:22 am

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?
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.

irulishka
Posts: 45
Joined: Fri Jun 03, 2011 9:38 am

Re: Weighted Statistics in pooled model

Postby irulishka » Wed Nov 06, 2013 6:23 am

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

Postby EViews Glenn » Wed Nov 06, 2013 10:38 am

What are you doing in your weight computation?

irulishka
Posts: 45
Joined: Fri Jun 03, 2011 9:38 am

Re: Weighted Statistics in pooled model

Postby irulishka » Thu Nov 07, 2013 2:46 am

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

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Weighted Statistics in pooled model

Postby EViews Glenn » Thu Nov 07, 2013 11:39 am

Why are you dividing by scale? Is there a Cholesky factorization or matrix inverse in there?

irulishka
Posts: 45
Joined: Fri Jun 03, 2011 9:38 am

Re: Weighted Statistics in pooled model

Postby irulishka » Fri Nov 08, 2013 4:46 am

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.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Weighted Statistics in pooled model

Postby EViews Glenn » Fri Nov 08, 2013 7:28 am

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.

irulishka
Posts: 45
Joined: Fri Jun 03, 2011 9:38 am

Re: Weighted Statistics in pooled model

Postby irulishka » Mon Nov 11, 2013 1:00 am

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?
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

Postby EViews Glenn » Mon Nov 11, 2013 1:24 pm

@mean(@inverse(@cholesky(w))*y)

irulishka
Posts: 45
Joined: Fri Jun 03, 2011 9:38 am

Re: Weighted Statistics in pooled model

Postby irulishka » Wed Nov 13, 2013 1:21 am

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?

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Weighted Statistics in pooled model

Postby EViews Glenn » Wed Nov 13, 2013 9:27 am

The base model we use is always a model with a constant only.

irulishka
Posts: 45
Joined: Fri Jun 03, 2011 9:38 am

Re: Weighted Statistics in pooled model

Postby irulishka » Tue Feb 04, 2014 11:50 pm

Thank you!=)

irulishka
Posts: 45
Joined: Fri Jun 03, 2011 9:38 am

Re: Weighted Statistics in pooled model

Postby irulishka » Wed Mar 05, 2014 2:31 am

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?


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests