A structural engineering company has made a large order of A36 steel for a construction project. For quality control purposes, a random sample of 20 steel members are tested to ensure steel has been made to specification. The yield strength of each member is given in the csv file YieldStrengths.csv.
Import the data from YieldStrengths.csv into MATLAB using the csvread function.
(1 mark)
Use MATLAB’s mean and std functions to solve the sample mean and sample standard deviation.
Evaluate the 95% confidence intervals for the mean yield strength of the steel.
The published mean yield strength for A36 steel is 250 MPa. Conduct a hypothesis test to determine whether the steel has been made to specifi- cation, using a significance level of α = 0.05.
Use MATLAB’s ttest function to check your solutions to Q3 and Q4. Comment on whether the results match.
Yield Strength Data
248.55 |
242.35 |
250.49 |
251.33 |
248.78 |
249.57 |
249.43 |
245.92 |
248.55 |
243.71 |
249.06 |
242.31 |
244.76 |
242.46 |
242.97 |
250.23 |
248.94 |
245.17 |
251.5 |
242.34 |
Ans (1): Importing Data set
Matlab Code:
y=csvread('YieldStrengths.csv');
Then the Matlab output is as follows:
y =
248.5500
242.3500
250.4900
251.3300
248.7800
249.5700
249.4300
245.9200
248.5500
243.7100
249.0600
242.3100
244.7600
242.4600
242.9700
250.2300
248.9400
245.1700
251.5000
242.3400
Ans (2): sample mean and sample standard deviation
Matlab code:
mean_y=mean(y)
std_y=std(y)
Then the Matlab output is as follows:
mean_y = 246.9210
std_y = 3.3444
Ans (3): Confidence Interval:
The 95% confidence interval for mean is given as:
Here, mean = 246.9210, standard deviation = 3.3444, n= 20
Mablab Code for 95% CI:
upper_bound=mean_y+(tinv(0.975,19)*(std_y/sqrt(n)))
lower_bound=mean_y-(tinv(0.975,19)*(std_y/sqrt(n)))
The matlab outputs are as follows:
upper_bound = 248.4862
lower_bound = 245.3558
Therefore, the 95% confidence interval for the mean yield strength of the steel is (245.3558, 248.4862).
Ans (4): Hypothesis testing using t-test:
Now, we want to conduct hypothesis test to determine whether the steel has been made to specification, using a significance level of α = 0.05.
The published mean yield strength for A36 steel is 250 MPa.
The hypotheses to be test are stated as follows:
Null hypothesis:
Alternative hypothesis:
Since, sample size is less than 30. So, t test will be an appropriate test. The t statistic is given as below:
where, = mean_y = 246.9210, s = Standard deviation = 3.3444 and n = 20.
Substituting all the values, we get
The level of significance is 0.05. The t distribution value for a two-tailed test is . So, if the computed t value is outside the range, the null hypothesis will be rejected; otherwise, it is accepted.
Since, computed t value -4.1174 is less than -2.093. Therefore we reject the null hypothesis and accept the alternative hypothesis at 5% level of significance.
Thus, we conclude that the steel is not made to standard specification.
Ans (5): t-test using standard function:
Matlab code for performing t-test:
y=csvread('YieldStrengths.csv');
[h p ci stats] = ttest(y, 250)
Then the matlab output is as follows:
h =
1
p =
5.8629e-04
ci =
245.3558
248.4862
stats =
tstat: -4.1172
df: 19
sd: 3.3444
Comments of Result:
The returned value of h = 1 indicates that t-test reject the null hypothesis at the 5% significance level.
t-statistic using t-test = -4.1172
Confidence Interval using t-test = (245.3558, 248.4862)
Thus, the result are matched with the above calculated result.
Get Answers For Free
Most questions answered within 1 hours.