R/mvar1.1998AS.R
mvar1.1998AS.Rd
Given two univariate samples \(x\) and \(y\), it tests $$H_0 : \mu_x = \mu_0, \sigma_x^2 = \sigma_0^2 \quad vs \quad H_1 : \textrm{ not } H_0$$ using asymptotic likelihood ratio test.
mvar1.1998AS(x, mu0 = 0, var0 = 1)
a length-\(n\) data vector.
hypothesized mean \(\mu_0\).
hypothesized variance \(\sigma_0^2\).
a (list) object of S3
class htest
containing:
a test statistic.
\(p\)-value under \(H_0\).
alternative hypothesis.
name of the test.
name(s) of provided sample data.
Arnold BC, Shavelle RM (1998). “Joint Confidence Sets for the Mean and Variance of a Normal Distribution.” The American Statistician, 52(2), 133--140.
## CRAN-purpose small example
mvar1.1998AS(rnorm(10))
#>
#> One-sample Simultaneous Test of Mean and Variance by Arnold and
#> Shavelle (1998).
#>
#> data: rnorm(10)
#> statistic = 3.7261, p-value = 0.1552
#> alternative hypothesis: true mean and variance of x are different from mu0 and var0.
#>
if (FALSE) {
## empirical Type 1 error
niter = 1000
counter = rep(0,niter) # record p-values
for (i in 1:niter){
x = rnorm(100) # sample x from N(0,1)
counter[i] = ifelse(mvar1.1998AS(x)$p.value < 0.05, 1, 0)
}
## print the result
cat(paste("\n* Example for 'mvar1.1998AS'\n","*\n",
"* number of rejections : ", sum(counter),"\n",
"* total number of trials : ", niter,"\n",
"* empirical Type 1 error : ",round(sum(counter/niter),5),"\n",sep=""))
}