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: Normally distributed error term & testing normality of residuals
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: Normally distributed error term & testing normality of residuals
Date
Mon, 15 Oct 2012 10:33:14 +0200
--- On Sun, Oct 14, 2012 at 9:54 AM, Ebru Ozturk <[email protected]> wrote:
>> Thank you. So, there is no possibility to check heteroscedasticity graphically?
--- On Sun, Oct 14, 2012 at 1:53 PM, Nick Cox <[email protected]> wrote:
> No one said that. You can plot the residuals, or their squares, or
> their absolute values, or roots of absolute values -- there are
> arguments for each -- against anything of interest, e.g. a predictor
> or fitted values.
The challenge with a model like Tobit is to know what kind of patter
in such a graph represents a problem, as you would expect the raw
residuals to be heteroskedastic in a Tobit model. One solution that
has been mentioned several times in this thread is to simulate from
the model to see what is "normal". An example is given below:
*--------------- begin example ----------------
// prepare data
sysuse auto, clear
gen wgt = weight/2000
label var wgt "weight in short tons"
replace mpg = 17 if mpg <= 17
// estimate Tobit model
tobit mpg wgt, ll
// To make the graphing and simulation easier I
// am going to change the data radically, so I
// first preserve the data
preserve
// only plot those observatin used in the model
keep if e(sample)
// I want 6 simulations, identified by the
// variable samp
gen id = _n
expand 6
bys id : gen samp = _n
// simulate outcome from the model
predict xb, xb
set seed 123456
gen sim = xb + rnormal(0, [sigma]_b[_cons])
replace sim = 17 if sim <= 17
// predict resiudals for both the observed
// data and the simulations
predict yhat, ystar(17,.)
replace sim = yhat - sim
gen resid = yhat - mpg
// plot the results
scatter sim resid wgt, by(samp) ///
msymbol(Oh o) msize(medium small) ///
mcolor(gs8 black)
restore
*---------------- end example -----------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany
http://www.maartenbuis.nl
---------------------------------
*
* 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/