Create two different normal probability distribution objects.
The first distribution has `mu = 0`

and ```
sigma
= 1
```

, and the second distribution has `mu = 2 `

and ```
sigma
= 1
```

.

Create a matrix of sample data by generating random numbers
from these two distributions.

The first two columns of `x`

contain data generated
from the first distribution, while the third column contains data
generated from the second distribution.

Test the null hypothesis that the sample data from each
column in `x`

comes from the same distribution.

The returned value of `p`

indicates that `kruskalwallis`

rejects
the null hypothesis that all three data samples come from the same
distribution at a 1% significance level. The ANOVA table provides
additional test results, and the box plot visually presents the summary
statistics for each column in `x`

.

Create two different normal probability distribution objects.
The first distribution has `mu = 0`

and ```
sigma
= 1
```

. The second distribution has `mu = 2 `

and ```
sigma
= 1
```

.

Create a matrix of sample data by generating random numbers
from these two distributions.

The first two columns of `x`

contain data generated
from the first distribution, while the third column contains data
generated from the second distribution.

Test the null hypothesis that the sample data from each
column in `x`

comes from the same distribution. Suppress
the output displays, and generate the structure `stats`

to
use in further testing.

p =
3.6896e-06
tbl =
Columns 1 through 4
'Source' 'SS' 'df' 'MS'
'Columns' [7.6311e+03] [ 2] [3.8155e+03]
'Error' [1.0364e+04] [57] [ 181.8228]
'Total' [ 17995] [59] []
Columns 5 through 6
'Chi-sq' 'Prob>Chi-sq'
[25.0200] [ 3.6896e-06]
[] []
[] []
stats =
gnames: [3x1 char]
n: [20 20 20]
source: 'kruskalwallis'
meanranks: [26.7500 18.9500 45.8000]
sumt: 0

The returned value of `p`

indicates that the
test rejects the null hypothesis at the 1% significance level. You
can use the structure `stats`

to perform additional
followup testing. The cell array `tbl`

contains the
same data as the graphical ANOVA table, including column and row labels.

Conduct a followup test to identify which data sample
comes from a different distribution.

Note: Intervals can be used for testing but are not simultaneous confidence intervals.
c =
1.0000 2.0000 -5.1435 7.8000 20.7435
1.0000 3.0000 -31.9935 -19.0500 -6.1065
2.0000 3.0000 -39.7935 -26.8500 -13.9065

The results indicate that there is a significant difference
between groups 1 and 3, so the test rejects the null hypothesis that
the data in these two groups comes from the same distribution. The
same is true for groups 2 and 3. However, there is not a significant
difference between groups 1 and 2, so the test does not reject the
null hypothesis that these two groups come from the same distribution.
Therefore, these results suggest that the data in groups 1 and 2 come
from the same distribution, and the data in group 3 comes from a different
distribution.

Create a vector, `strength`

, containing
measurements of the strength of metal beams. Create a second vector, `alloy`

,
containing strings indicating the type of metal alloy from which the
corresponding beam is made.

Test the null hypothesis that the beam strength measurements
have the same distribution across all three alloys.

The returned value of `p`

indicates that the
test rejects the null hypothesis at the 1% significance level.