This is a generic function to depict the p-value area for a object with class htest
.
# S3 method for htest
plot(x, col = "red", shade.col = "red", cex = 0.8, from = NULL, to = NULL, ...)
Object of class “htest”.
color for the observed statistic.
color for the shaded area.
a numerical value giving the amount by which plotting the p-value.
the minimum value of the X-axis.
the maximum value of the X-axis.
Other plotting parameters to affect the plot.
None. Function produces a plot.
# Example
# H0: mu = 170
# Ha: mu != 170 with sigma2=25
x <- rnorm(n=80, mean=171, sd=5)
res <- z.test(x=x, mu=170, sigma2=25, alternative='two.sided')
res
#>
#> One Sample z-test
#>
#> data: x
#> Z = 2.9986, p-value = 0.002712
#> alternative hypothesis: true mean is not equal to 170
#> 95 percent confidence interval:
#> 170.5806 172.7719
#> sample estimates:
#> mean of x
#> 171.6763
#>
plot(res, col='blue', shade.col='tomato')