Produce 10 random observations from a normal distribution with mean 80 and typical deviation 30 Let's pretend that we do not know the mean μ of the distribution. Using the sample ,check(test) the 2 hypothesis
H0 : µ = 80 vs H1 : µ not equal 80.
Repeat the process for 100 times and record only the p-value each time. Using the 5% significance level to comment your results Show all the values of p-value.
Here is what i did
t<-c( rnorm(10, mean = 80, sd = 30))
t.test (y, mu = 80)
t.test(y, mu =80, alternative = ”greater”)$p.value
t.test(y, mu = 80, alternative = ”less”)$p.value
notes:
Suppose that in a vector y is stored the data of a sample. This command
t.test(y, mu = 9)
make two-sided hypothesis check(testing), specifically it check whether the mean of the distribution from which the data comes from is equal to 9 ,in case of one-sided check the command is,
t.test(y, mu = 9, alternative = ”greater”) or t.test(y, mu = 9, alternative = ”less”)
accordingly. These commands give the results of the check(testing), including the confidence interval. If someone wants only the value of p-value ,must add $p.value in the end command . For example, the command
t.test (y, mu = 9) $p.value
only gives the p-value for the two -sided check(test) hypothesis
replicate(100, t.test(rnorm(10, 80, 30), mu = 80)$p.value)
– rawr