Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Lab Class 08 (17-05-2022)
- # S Vijay Balaji (19BCE7571)
- x1bar <- 74
- n1 <- 40
- sigma1 <- 8
- x2bar <- 78
- n2 <- 50
- sigma2 <- 7
- level <- 0.05
- # calculation of z
- z <- (x1bar - x2bar) / sqrt(((sigma1)^2 / n1) + ((sigma2)^2 / n2))
- print(z)
- pvalue <- 2 * pnorm(z, lower.tail = TRUE)
- print(pvalue)
- if (pvalue <= level) {
- print("Null Hypothesis H0 is rejected")
- } else {
- print("Null Hypothesis H0 is accepted")
- }
- # Example 2: The research investigator is interested in studying wheather there is a significant difference
- # in the salaries of B.Tech grades in two metropolian cities.
- # A random sample of size 100 from kolkata yields an average income of Rs. 20,150. Another random sample of 60 from Delhi results in an average income of
- # Rs. 20,250. If the variance of both the populations are given as sigma square = Rs. 40,000 and sigma square 2 = Rs 32,400 respectively,
- # What is your conclusion?
- x1bar <- 20150
- n1 <- 100
- sigma1 <- 40000
- x2bar <- 20250
- n2 <- 60
- sigma2 <- 32400
- level <- 0.05
- # calculation of z
- z <- (x1bar - x2bar) / sqrt(((sigma1)^2 / n1) + ((sigma2)^2 / n2))
- print(z)
- pvalue <- 2 * pnorm(z, lower.tail = TRUE)
- print(pvalue)
- if (pvalue <= level) {
- print("Null Hypothesis H0 is rejected")
- } else {
- print("Null Hypothesis H0 is accepted")
- }
- # Example 3: A manufacturer claims that the average tensile strength of thread A exceeds the average tensile strength of thread B by at least 12 kgs.
- # To test this claim, 50 pieces of each type of thread were tested under similar conditions. Type A thread had an average tensile strength of 86.7 kgs with a
- # Standard devaiation of 6.28 kgs, while type B thread had an average tensile strength of 77.8 kilograms with a standard devation of 5.61 kgs.
- # Test the manufacturer's claim using a 0.05 level of significance.
- x1bar <- 86.7
- n1 <- 50
- sigma1 <- 6.28
- x2bar <- 77.8
- n2 <- 50
- sigma2 <- 5.61
- level <- 0.05
- # calculation of z
- z <- (x1bar - x2bar) / sqrt(((sigma1)^2 / n1) + ((sigma2)^2 / n2))
- print(z)
- pvalue <- 2 * pnorm(z, lower.tail = TRUE)
- print(pvalue)
- if (pvalue <= level) {
- print("Null Hypothesis H0 is rejected")
- } else {
- print("Null Hypothesis H0 is accepted")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement