Generate two sample data sets, one from a Weibull distribution and another from a lognormal distribution. Perform the Lilliefors test to assess whether each data set is from a Weibull distribution. Confirm the test decision by performing a visual comparison using a Weibull probability plot (wblplot).
Generate samples from a Weibull distribution.
rng('default')
data1 = wblrnd(0.5,2,[500,1]);
Perform the Lilliefors test by using the lillietest. To test data for a Weibull distribution, test if the logarithm of the data has an extreme value distribution.
h1 = lillietest(log(data1),'Distribution','extreme value')
h1 = 0
The returned value of h1 = 0 indicates that lillietest fails to reject the null hypothesis at the default 5% significance level. Confirm the test decision using a Weibull probability plot.
wblplot(data1)
The plot indicates that the data follows a Weibull distribution.
Generate samples from a lognormal distribution.
data2 =lognrnd(5,2,[500,1]);
Perform the Lilliefors test.
h2 = lillietest(log(data2),'Distribution','extreme value')
h2 = 1
The returned value of h2 = 1 indicates that lillietest rejects the null hypothesis at the default 5% significance level. Confirm the test decision using a Weibull probability plot.
wblplot(data2)
The plot indicates that the data does not follow a Weibull distribution.