param.t.test | R Documentation |
Performs one and two sample t-tests using describing parameters (i.e., mean, variance, length) of data
param.t.test(mean_x,var_x,n_x,mean_y=NA,var_y=NA,n_y=NA,
mu=0,paired=FALSE,var.equal=FALSE,
alternative=c("two.sided","less","greater"),conf.level=0.95,
name_x="x",name_y="y")
mean_x |
The mean of the x data |
var_x |
The variance of the x data |
n_x |
The number of observations of the x data |
mean_y |
Optional. The mean of the y data |
var_y |
Optional. The variance of the y data |
n_y |
Optional. The number of observations of the y data |
mu |
The value of the true mean of x (if only x is provided) of the value of the differences between the true means of x and y (if both x and y are provided). By default set to |
paired |
A logical indicating whether one wants a paired t-test. By default set to |
var.equal |
A logical indicating whether the variances of x and y are assumed to be equal or not. By default set to |
alternative |
A character indicating the alternative hypothesis. By default, the t-test is bilateral and H1 is that there is a difference no matter its sign ( |
conf.level |
The confidence level of the interval. By default set to 95% |
name_x |
The name of the x data to be outputted in the test result |
name_y |
The name of the y data to be outputted in the test result |
As for t.test
, a list with class "htest"
containing the following components:
statistic
the value of the t-statistic
parameter
the degrees of freedom of the t-statistic
p.value
the p-value for the test
conf.int
a confidence interval for the mean appropriate to the specified alternative hypothesis
estimate
the (inputted) estimated mean or means depending on whether it was a one-sample or a two-sample test
null.value
the specified hypothesized value of the mean or mean difference depending on whether it was a one-sample or a two-sample test
stderr
the standard error of the mean/difference, used as denominator in the t-statistic formula
alternative
a character string describing the alternative hypothesis
method
a character string indicating what type of t-test was performed
data.name
a character string giving the (inputted) name(s) of the data
t.test
## Define data
set.seed(1)
A<-runif(10,0,100)
B<-runif(10,50,150)
mean_x<-mean(A)
var_x<-var(A)
n_x<-length(A)
mean_y<-mean(B)
var_y<-var(B)
n_y<-length(B)
## One sample t-test
t.test(A)
param.t.test(mean_x=mean_x,var_x=var_x,n_x=n_x)
## Two sample t-test with equal variances
t.test(A,B,var.equal=TRUE)
param.t.test(mean_x,var_x,n_x,mean_y,var_y,n_y,var.equal=TRUE)
## Two sample t-test with unequal variances
t.test(A,B)
param.t.test(mean_x,var_x,n_x,mean_y,var_y,n_y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.