mean_test1: Two sided or one sided test of hypothesis of mu of one normal sample
Description
Compute the two sided or one sided test of hypothesis of mu of one normal sample when the population variance is known or unknown.
Usage
mean_test1(x, mu = 0, sigma = -1, side = 0)
Value
A data.frame with variables:
mean
The sample mean.
df
The degree of freedom.
statistic
The statistic, when sigma>=0, statistic = Z = (xb-mu)/(sigma/sqrt(n)); when sigma<0, statistic = T = (xb-mu)/(sd(x)/sqrt(n)).
p_value
The P value.
Arguments
x
A numeric vector.
mu
mu is mu0 in the null hypothesis. Default is 0, i.e., H0: mu = 0.
sigma
The standard deviation of the population. sigma>=0 indicates it is known, sigma<0 indicates it is unknown. Default to unknown standard deviation.
side
A parameter used to control two sided or one sided test of hypothesis. When inputting side = 0 (default), the function computes two sided test of hypothesis, and H1: mu != mu0; when inputting side = -1 (or a number < 0), the function computes one sided test of hypothesis, and H1: mu < mu0; when inputting side = 1 (or a number > 0), the function computes one sided test of hypothesis, and H1: mu > mu0.