expect_mean_equal {EstimDiagnostics} | R Documentation |
Test a mean-value using t-test
Description
Expectation checking whether values from a given sample have a certain mean or that two samples have the same mean. The underlying procedure is Student's t-test t.test
.
The expectation throws an error when the test's p-value is smaller than the threshold p-value.
Usage
expect_mean_equal(p_value = 0.001, ...)
Arguments
p_value |
threshold p-value of the test |
... |
parameters to pass to t.test function including data sample(s) |
Value
Invisibly returns a p-value of the test
Examples
# This test doesn't pass
## Not run:
x<-1:1e3
expect_mean_equal(x=x)
## End(Not run)
# This one passes, but shouldn't
x<-rnorm(1e3) + 0.01
expect_mean_equal(x=x)
x<-rnorm(1e3)
expect_mean_equal(x=x)
# check if 2 samples have the same mean
x<-rnorm(1e3, mean=10)
y<-rnorm(1e3, mean=10)
expect_mean_equal(x=x, y=y)
[Package EstimDiagnostics version 0.0.3 Index]