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

# Re: st: Plotting Residuals vs Fitted Values using GLM

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: Plotting Residuals vs Fitted Values using GLM Date Wed, 24 Oct 2012 13:07:32 +0100

```-rvfplot2- is a user-written command from the -modeldiag- package
(Stata Journal 4(4), updated SJ 10(1)). Please recall from your
reading of the Statalist FAQ that you are expected to explain that.

The main idea here is that a residual vs fitted plot will show up
gross heteroscedasticity by a marked deviation from approximate
constancy if you average or smooth across the graph. You can do that
by eye or -rvfplot2- offers smoothers to guide the eye.

The examples for -fscale()- are taken from McCullagh and Nelder as
referenced in the help for -rvfplot2. I can't say which scale is
optimal for negative binomial, but what the specific suggestions have
in common is that they pull in the right tail of a right-skewed
distribution. Note that logarithms won't work if your predicted values
are not positive but I think that's unlikely. I think it's a case of
try it and see, so that anything much like a square root or
logarithmic scale might help. It's not a rigorous procedure, however
you do it.

Others may want to comment on the use of negative binomial as a model
here for a response that is a cost variable.

Nick

On Tue, Oct 23, 2012 at 10:57 PM, Brent Gibbons <brent.gibbons@gmail.com> wrote:

> I am working with a model that has a Dependent Variable of Total Health Costs. Other than using the log transformation, the best fit is using GLM, family(negative binomial) link(log). But I'm worried about heteroscedasticity and have been trying the rvfplot2 command. The documentation recommends the sqrt(abs(resid)) as the rscale to look at heteroscedasticity.
>
> My question is whether or not I need to use a transformation scale for the fitted values, an fscale? If so, what should that transformation be? And what should I be looking for in the plot?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```