Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: conditional SE of y|X in glm

 From Marco Ventura To statalist@hsphsun2.harvard.edu Subject Re: st: conditional SE of y|X in glm Date Tue, 24 Apr 2012 11:29:22 +0200

```Dear Nick,
thank you very much of your quick replies.
Unfortunately there is something I still do not understand. If I do
use http://www.stata-press.com/data/r10/beetle
glm r ldose, fam(bin n) link (logit)
di sqrt(e(dispers))
glmcorr
```
I get two very different values 4.065 against 13.179. Which of the two is correct?
```
Thank you again.
Marco

Il 24/04/2012 10:57, Nick Cox ha scritto:
```
```See -glmcorr- (SSC) for one approach here. That calculates an rmse
which appears similar, if not identical, to what you want. I like to
have such measures accessible for comparing -glm- results  with those
of other models in which rmse appears naturally. Perhaps it is a
comfort blanket, but there you go.

Note that putting a constant into a variable is usually overkill as

di sqrt(e(dispers))

does the calculation. Use a scalar or local macro if you want to store
the value.

On Tue, Apr 24, 2012 at 9:31 AM, Marco Ventura<mventura@istat.it>  wrote:

```
```from a GLM estimate I want to retrieve the conditional standard error of y
given the covariates. If I do

gen sigma=sqrt(e(dispers))

do I always get the right thing independently of any family and link?
Should I correct it by sqrt(e(dispers)* (_N-1)/_N)?
And do you think I should instead use the Pearson residuals such as

gen sigma=sqrt(e(dispers_p))

```
```*
*   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/
```
```*
*   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/
```