| Contents | Index |
h = jbtest(x)
h = jbtest(x,alpha)
[h,p] = jbtest(...)
[h,p,jbstat] = jbtest(...)
[h,p,jbstat,critval] = jbtest(...)
[h,p,...] = jbtest(x,alpha,mctol)
h = jbtest(x) performs a Jarque-Bera test of the null hypothesis that the sample in vector x comes from a normal distribution with unknown mean and variance, against the alternative that it does not come from a normal distribution. The test is specifically designed for alternatives in Generating Data Using the Pearson System of distributions. The test returns the value h = 1 if it rejects the null hypothesis at the 5% significance level, and h = 0 if it cannot. The test treats NaN values in x as missing values, and ignores them.
The Jarque-Bera test is a two-sided goodness-of-fit test suitable when a fully-specified null distribution is unknown and its parameters must be estimated. The test statistic is

where n is the sample size, s is the sample skewness, and k is the sample kurtosis. For large sample sizes, the test statistic has a chi-square distribution with two degrees of freedom.
Jarque-Bera tests often use the chi-square distribution to estimate critical values for large samples, deferring to the Lilliefors test (see lillietest) for small samples. jbtest, by contrast, uses a table of critical values computed using Monte-Carlo simulation for sample sizes less than 2000 and significance levels between 0.001 and 0.50. Critical values for a test are computed by interpolating into the table, using the analytic chi-square approximation only when extrapolating for larger sample sizes.
h = jbtest(x,alpha) performs the test at significance level alpha. alpha is a scalar in the range [0.001, 0.50]. To perform the test at a significance level outside of this range, use the mctol input argument.
[h,p] = jbtest(...) returns the p value p, computed using inverse interpolation into the table of critical values. Small values of p cast doubt on the validity of the null hypothesis. jbtest warns when p is not found within the tabulated range of [0.001, 0.50], and returns either the smallest or largest tabulated value. In this case, you can use the mctol input argument to compute a more accurate p value.
[h,p,jbstat] = jbtest(...) returns the test statistic jbstat.
[h,p,jbstat,critval] = jbtest(...) returns the critical value critval for the test. When jbstat > critval, the null hypothesis is rejected at significance level alpha.
[h,p,...] = jbtest(x,alpha,mctol) computes a Monte-Carlo approximation for p directly, rather than interpolating into the table of pre-computed values. This is useful when alpha or p lie outside the range of the table. jbtest chooses the number of Monte Carlo replications, mcreps, large enough to make the Monte Carlo standard error for p, sqrt(p*(1-p)/mcreps), less than mctol.
Use jbtest to determine if car mileage, in miles per gallon (MPG), follows a normal distribution across different makes of cars:
load carbig
[h,p] = jbtest(MPG)
h =
1
p =
0.0022The p value is below the default significance level of 5%, and the test rejects the null hypothesis that the distribution is normal.
With a log transformation, the distribution becomes closer to normal, but the p value is still well below 5%:
[h,p] = jbtest(log(MPG))
h =
1
p =
0.0078Decreasing the significance level makes it harder to reject the null hypothesis:
[h,p] = jbtest(log(MPG),0.0075)
h =
0
p =
0.0078[1] Jarque, C. M., and A. K. Bera. "A test for normality of observations and regression residuals." International Statistical Review. Vol. 55, No. 2, 1987, pp. 163–172.
[2] Deb, P., and M. Sefton. "The Distribution of a Lagrange Multiplier Test of Normality." Economics Letters. Vol. 51, 1996, pp. 123–130. This paper proposed a Monte Carlo simulation for determining the distribution of the test statistic. The results of this function are based on an independent Monte Carlo simulation, not the results in this paper.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |