Code covered by the BSD License  

Highlights from
Heteroskedasticity test

Be the first to rate this file! 23 Downloads (last 30 days) File Size: 715.91 KB File ID: #24722

Heteroskedasticity test

by Oleg Komarov

 

14 Jul 2009 (Updated 15 Aug 2009)

White, White special case and Breush-Pagan tests. Stat TB needed: regstats and chi2cdf.

| Watch this File

File Information
Description

TESTHET Tests wether heteroskedasticity affects data. Need 'regstats' and 'chi2cdf' (Stat TB).

PVAL = TESTHET(RES, X, WHICHTEST, YHAT)
INPUTS:
- Res: residuals obtained by regressing Y on x1, x2 etc...(1) It can be a numeric 'n-by-1' vector or a 'n-by-p' matrix with 'p' residuals obtained from different regressions. The # of obs. is 'n'.
- X: predictors suspected of causing heteroskedasticity. Not necessarily all those in (1). Same format as Res.
- Whichtest: test chosen in format string.
                a. Breush-Pagan, Koenker mod. --> -BPK
                b. White --> -W
                c. White, Wooldridge --> -Ws
[OPTIONAL]
- Yhat: only for '-Ws' test. Fitted values from (1). Same format as Res.

OUTPUT:
A '1-by-p' array with p-values.

EXAMPLE:
1. Regress Y on x1, x2:
--> regstats(Y, [x1 x2], 'linear', {'r','yhat'})
2. Test with -Ws:
--> TestHet(r,[x1, x2], '-Ws', yhat)

For general econometric reference:
[1] Greene, W.H. (2003 - 5th ed.) Econometric Analysis. Prentice Hall.
[2] Wooldridge, J.M. (2006 - 3rd ed.). Introductory Econometrics: A Modern Approach. Thomson - South West.
[3] Kennedy, P. (2008 - 6th ed.). A Guide to Econometrics. Blackwell Publishing.

Any comments, suggestions and critics are truly welcome.
Plz let me know if you prefer a function which doesn't use the stats toolbox.

p2v1.21

Required Products Statistics Toolbox
MATLAB release MATLAB 7.7 (R2008b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
14 Jul 2009 Oleg Komarov

DemoDataset missing, updating...

17 Jul 2009 Oleg Komarov

Updating with check on solvability of the system. In case observations < regressors, regstats gives an error. If this is the case, skip that series and leave NaN in the Pvalue vector.

Please login to add a comment or rating.
Updates
14 Jul 2009

DemoDataset.mat was missing in the package. Added.

17 Jul 2009

Added check on solvability of the system.

15 Aug 2009

Error on line 80: Nseries = size(Res,2)-1 --> Nseries = size(Res,2).
Pointed out by Dan Iancu.

Tag Activity for this File
Tag Applied By Date/Time
heteroskedasticity Oleg Komarov 14 Jul 2009 09:58:00
white Oleg Komarov 14 Jul 2009 09:58:00
test Oleg Komarov 28 Oct 2009 16:05:26
econometric Oleg Komarov 16 Dec 2009 14:00:01
pagan Oleg Komarov 16 Dec 2009 14:00:01
breush Oleg Komarov 16 Dec 2009 14:00:01
breush Octavianus 06 May 2010 09:52:35
econometric Octavianus 06 May 2010 09:52:46
heteroskedasticity Octavianus 06 May 2010 09:52:49
pagan Octavianus 06 May 2010 09:52:51
test Octavianus 06 May 2010 09:52:58
white Octavianus 06 May 2010 09:53:00
heteroskedasticity Luong 28 Jan 2011 08:00:47
heteroskedasticity Yasir 21 Jun 2011 12:42:33
white Yasir 21 Jun 2011 12:42:48

Contact us at files@mathworks.com