# Standard deviation when estimating a Poisson regression using R

I'm interested in plotting the estimator of the standard deviation in a Poisson regression. The variance is $Var(y)=\phi⋅V(\mu)$ where $\phi=1$ and $V(\mu)=\mu$. So the variance should be $Var(y)=V(\mu)=\mu$. (I'm just interested in how the variance should be, so if overdispersion occurs $(\hat{\phi} \ne 1)$, I don't care about it). Thus an estimator of the variance should be $Var(\widehat{y})=V(\widehat{μ})=\widehat{\mu}$ and an estimator of the standard deviation should be $\sqrt{Var(\widehat{y})}=\sqrt{V(\widehat{\mu})}=\sqrt{\widehat{\mu}}=\sqrt{exp(x\widehat{\beta})}=exp(x\widehat{\beta}/2)$ when using the canonical link. Is this correct? I haven't found a discussion about standard deviation in the context with poisson regression yet, that's why I'm asking.

So here is an easy example (which makes no sense btw) of what I'm talking about.

>data1<-function(x){x^(2)}

>numberofdrugs<-data(1:84)

>data2<-function(x){x}

>healthvalue<-data2(1:84)
>
>plot(healthvalue,numberofdrugs)
>
>test<-glm(numberofdrugs~healthvalue, family=poisson)

>summary(test) #beta0=5.5 beta1=0.042
>
>mu<-function(x){exp(5.5+0.042*x)}
>
>plot(healthvalue,numberofdrugs)

>
> #the purple curve is the estimator for mu and it's also the estimator of the
> #variance,but if I'd like to plot the (not constant) standard deviation I just
> #take the squaroot of the variance. So it is var(y)=mu=exp(Xb) and thus the
> #standard deviation is sqrt(exp(Xb))
>
>sd<-function(x){sqrt(exp(5.5+0.042*x))}

>curve(sd, col="green", lwd=2)
>


Is the the green curve the correct estimator of the standard deviation in a Poisson regression? It should be, no?

-

## merged by chl♦Jul 10 '11 at 17:10

This question was merged with Estimating standard deviation in Poisson regression because it is an exact duplicate of that question.