Info

Questions & Answers

Question 1

A machine is set to produce metal plates of thickness 1.5 cms with standard deviation of 0.2 cm. A sample of 100 plates produced by the machine gave an average thickness of 1.52 cms. Is the machine fulfilling the purpose? Write a R program for above problem.

Confidence Interval

The confidence interval is the range of values within which the true value of the parameter is expected to lie with a certain level of confidence. The confidence interval is denoted by where is the level of significance.

Link to original

# Sample data
mu = 1.5          # Population mean
x_bar = 1.52      # Sample mean
sigma = 0.2        # Standard deviation
n = 100            # Sample size
alpha = 0.05       # Level of significance
 
# Z-test statistic
z_stat = (x_bar - mu) / (sigma / sqrt(n))
print(paste("Z-statistic:", z_stat))
 
# P-value for two-tailed test
p_value = 2 * pnorm(-abs(z_stat))
print(paste("P-value:", p_value))
 
# Decision
if (p_value < alpha) {
  print("Reject Null Hypothesis: The machine is NOT working to the standards set.")
} else {
  print("Fail to Reject Null Hypothesis: The machine is working to the Standards set.")
}
 

Question 2

The average marks scored by 32 boys are 72 with SD of 8, while that for 36 girls is 70 with SD of 6. Test at 1% LOS whether the boys perform equal as girls.

BoysGirls
7270
3236
86

Hypothesis Boys and girls perform equally Boys and girls do not perform equally

From Hypothesis and Probability and Statistics

# Sample data
x1 <- 72        # Mean of boys
s1 <- 8         # SD of boys
n1 <- 32        # Sample size of boys
 
x2 <- 70        # Mean of girls
s2 <- 6         # SD of girls
n2 <- 36        # Sample size of girls
 
alpha <- 0.01   # Level of significance
 
# t-test statistic
t_stat <- (x1 - x2) / sqrt((s1^2 / n1) + (s2^2 / n2))
print(paste("t-statistic:", t_stat))
 
# Degrees of freedom (Welch-Satterthwaite)
df <- ((s1^2 / n1 + s2^2 / n2)^2) /
      ((s1^2 / n1)^2 / (n1 - 1) + (s2^2 / n2)^2 / (n2 - 1))
print(paste("Degrees of freedom:", df))
 
# P-value (two-tailed test)
p_value <- 2 * pt(-abs(t_stat), df)
print(paste("P-value:", p_value))
 
# Decision
if (p_value < alpha) {
  print("Reject Null Hypothesis: Boys and girls perform differently.")
} else {
  print("Fail to Reject Null Hypothesis: Boys and girls perform equally.")
}
 

Testing of Hypothesis Sample

References

Information
  • date: 2025.03.25
  • time: 12:27