Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: RE: variance in glm
From
Argyn Kuketayev <[email protected]>
To
[email protected]
Subject
Re: st: RE: variance in glm
Date
Wed, 2 Mar 2011 23:00:16 -0500
this is what i've done.
1. got residuals of linear regression
regress Y X
predict res, r
2. tabulated for each X, and got frequencies and st devs
table X, c(N res sd res) replace
g w=table1-1
3. computed relative errors
g re=table2/X
4. regressed relative errors over inverse squares of X, with weight
proportional to freq of X
g Xin2=1/X
regress re Xin2 [aweight=w]
R-squared = 0.8316
Adj R-squared = 0.8281
finally, i have an estimate of st dev of errors:
2.75 / X + 0.5 X
---
now i want to plug this into Stata, so that it assumes that
Var[Ei] = 2.75 / Xi + 0.5 Xi
in Yi = Xi + Ei
any idea how?
thanks
On Wed, Mar 2, 2011 at 7:55 PM, Keith Dear <[email protected]> wrote:
> Argyn,
> You might consider calculating squared residuals and modelling those as as
> function of X using gamma errors (glm). If the original errors Ei are
> normal, their squares will be distributed proportional to chi-squared
> (special case of gamma). Then you can test for constant variance, which
> would be rejected if the mean of the squared residuals turns out to depend
> on X.
> Keith
>
thanks
--
Argyn Kuketayev
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/