mvar1.LRT: One-sample Simultaneous Likelihood Ratio Test of Mean and... In SHT: Statistical Hypothesis Testing Toolbox

 mvar1.LRT R Documentation

One-sample Simultaneous Likelihood Ratio Test of Mean and Variance

Description

Given two univariate samples x and y, it tests

H_0 : μ_x = μ_0, σ_x^2 = σ_0^2 \quad vs \quad H_1 : \textrm{ not } H_0

using likelihood ratio test.

Usage

mvar1.LRT(x, mu0 = 0, var0 = 1)


Arguments

 x a length-n data vector. mu0 hypothesized mean μ_0. var0 hypothesized variance σ_0^2.

Value

a (list) object of S3 class htest containing:

statistic

a test statistic.

p.value

p-value under H_0.

alternative

alternative hypothesis.

method

name of the test.

data.name

name(s) of provided sample data.

Examples

## CRAN-purpose small example
mvar1.LRT(rnorm(10))

## Not run:
## 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.LRT(x)\$p.value < 0.05, 1, 0)
}

## print the result
cat(paste("\n* Example for 'mvar1.LRT'\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=""))

## End(Not run)



SHT documentation built on Nov. 3, 2022, 9:06 a.m.