View source: R/one_two_sample.R
one_two_sample | R Documentation |
Deal with one and two (normal) samples. For one normal sample x, the function reports descriptive statistics, plot, interval estimation and test of hypothesis of x. For two normal samples x and y, the function reports descriptive statistics, plot, interval estimation and test of hypothesis of x and y, respectively. It also reports interval estimation and test of hypothesis of mu1-mu2 (the difference of the means of x and y) and sigma1^2/sigma2^2 (the ratio of the variances of x and y), tests whether x and y are from the same population, finds the correlation coefficient of x and y if x and y have the same length.
one_two_sample(x, y = NULL, mu = c(Inf, Inf), sigma = c(-1, -1),
var.equal = FALSE, ratio = 1, side = 0, alpha = 0.05)
x |
A numeric vector. |
y |
A numeric vector. |
mu |
If |
sigma |
If |
var.equal |
A logical variable indicating whether to treat the two variances as being equal. If |
ratio |
The hypothesized ratio of the population variances of |
side |
If |
alpha |
The significance level, a real number in [0, 1]. Default to 0.05. 1-alpha is the degree of confidence. |
A list with the following components:
one_sample_x |
It contains the results by |
one_sample_y |
It contains the results by |
mu1_mu2_interval |
It contains the results of interval estimation of |
mu1_mu2_hypothesis |
It contains the results of test of hypothesis of |
sigma_ratio_interval |
It contains the results of interval estimation of |
sigma_ratio_hypothesis |
It contains the results of test of hypothesis of |
res.ks |
It contains the results of |
res.binom |
It contains the results of |
res.wilcox |
It contains the results of |
cor.pearson |
It contains the results of |
cor.kendall |
It contains the results of |
cor.spearman |
It contains the results of |
Ying-Ying Zhang (Robert) robertzhangyying@qq.com
Zhang, Y. Y., Wei, Y. (2013), One and two samples using only an R funtion, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2991/asshm-13.2013.29")}.
## One sample
x=rnorm(10, mean = 1, sd = 0.2); x
## one_sample(x, ...) == one_two_sample(x, ...)
one_sample(x, mu = 1, sigma = 0.2, side = 1)
one_two_sample(x, mu = 1, sigma = 0.2, side = 1)
one_sample(x, sigma = 0.2, side = 1)
one_two_sample(x, sigma = 0.2, side = 1)
one_sample(x, mu = 1, side = 1)
one_two_sample(x, mu = 1, side = 1)
one_sample(x)
one_two_sample(x)
## Two samples
set.seed(1)
x=rnorm(10, mean = 1, sd = 0.2); x
y=rnorm(20, mean = 2, sd = 0.3); y
y2=rnorm(20, mean = 2, sd = 0.2); y2
## sigma1, sigma2 known; mu1, mu2 known
one_two_sample(x, y, sigma = c(0.2, 0.3), mu = c(1, 2))
## sigma1 = sigma2 unknown; mu1, mu2 known
one_two_sample(x, y2, var.equal = TRUE, mu = c(1, 2))
## sigma1 != sigma2 unknown; mu1, mu2 known
one_two_sample(x, y, mu = c(1, 2))
## sigma1, sigma2 known; mu1, mu2 unknown
one_two_sample(x, y, sigma = c(0.2, 0.3))
## sigma1 = sigma2 unknown; mu1, mu2 unknown
one_two_sample(x, y2, var.equal = TRUE)
## sigma1 != sigma2 unknown; mu1, mu2 unknown
one_two_sample(x, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.