Sometimes the researcher wants to test whether the treatment mean is greater than/equal to or less than a reference value. For example, I want to know if the average productivity of my treatment is higher than the average productivity of a given country. For this, this function allows comparing the means with a reference value using the t test.

tonetest(response, trat, mu = 0, alternative = "two.sided", conf.level = 0.95)

Arguments

response

Numerical vector containing the response of the experiment.

trat

Numerical or complex vector with treatments

mu

A number indicating the true value of the mean

alternative

A character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less"

conf.level

confidence level of the interval.

Value

returns a list with the mean per treatment, maximum, minimum, sample standard deviation, confidence interval, t-test statistic and its p-value.

Note

No treatment can have zero variability. Otherwise the function will result in an error.

Author

Gabriel Danilo Shimizu

Examples

library(AgroR)
data("pomegranate")
tonetest(resp=pomegranate$WL,
trat=pomegranate$trat,
mu=2,
alternative = "greater")
#> $mean.ref
#> [1] 2
#> 
#> $mean
#>     T1     T2     T3     T4     T5     T6 
#> 1.8425 1.6775 2.6175 2.6200 2.6375 2.1625 
#> 
#> $sd
#>         T1         T2         T3         T4         T5         T6 
#> 0.19939492 0.12284814 0.30619983 0.42669271 0.14244882 0.09429563 
#> 
#> $min
#>   T1   T2   T3   T4   T5   T6 
#> 1.68 1.54 2.24 2.21 2.44 2.04 
#> 
#> $max
#>   T1   T2   T3   T4   T5   T6 
#> 2.10 1.82 2.99 3.22 2.78 2.27 
#> 
#> $Statistic
#>        T1        T2        T3        T4        T5        T6 
#> -1.579779 -5.250385  4.033314  2.906073  8.950583  3.446607 
#> 
#> $p.value
#>          T1          T2          T3          T4          T5          T6 
#> 0.893858511 0.993272227 0.013703195 0.031097296 0.001471321 0.020518962 
#> 
#> $conf.inf
#>       T1       T2       T3       T4       T5       T6 
#> 1.607876 1.532947 2.257200 2.117918 2.469883 2.051544 
#> 
#> $conf.sup
#>  T1  T2  T3  T4  T5  T6 
#> Inf Inf Inf Inf Inf Inf 
#>