2
$\begingroup$

I am using KPSS test to verify if my process has constant variance around the mean, but I am not sure if this is the correct test for my case. In KPSS the null hypothesis is that the process is stationary.

For example for two separate random variables, x, y:

from statsmodels.tsa.stattools import kpss

x = np.random.randn(100) # variance 1
y = np.random.randn(100)*10 # variance 100
z = np.concatenate([x,y]) # make one big vector of size 200

statistic, pvalue, lags, crit = kpss(z,'c')

print(pvalue)
out: 0.1

P value is 0.1 (or greater), so I can not reject the null. But clearly, the variance of first 100 observations is 1 and for the other 100 obserations it is 100. What test should I use?

$\endgroup$
0

1 Answer 1

2
$\begingroup$

KPSS considers an alternative of a unit root to the null of no unit root. Heteroskedasticity is a different thing from a unit root. You should look for tests designed specifically to detect heteroskedasticity where the alternative is a heteroskedastic series to the null of a homoskedastic series.

For example, consider Levene's test, Bartlett's test, or the Brown–Forsythe test. In the simple case of comparing variances of two normal populations, an $F$-test of equality of variances will be appropriate. However, it is notoriously sensitive to the normality assumption.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.