Learn R Programming

MOM (version 0.1.0)

sim_mp_test: Most Powerful Test by Neyman-Pearson Lemma

Description

It can be used to check whether a data comes from null distribution or from the alternative distribution

Usage

sim_mp_test(
  data,
  null.dist = c("uniform", "normal", "lognormal", "gamma", "cauchy", "pareto", "weibull",
    "rayleigh", "laplace", "beta", "binomial", "poisson", "negativebinomial",
    "geometric", "t", "f", "logarithmic"),
  null.par,
  alter.dist = c("uniform", "normal", "lognormal", "gamma", "cauchy", "pareto",
    "weibull", "rayleigh", "laplace", "beta", "binomial", "poisson", "negativebinomial",
    "geometric", "t", "f", "logarithmic"),
  alter.par,
  test.level = 0.95,
  sim.size = 1,
  power = TRUE
)

Value

A list of class "momtest" will be returned having the following components:

Method

The Method's Name

Data

The first 6 elements of input data

Null.Distrbution

The family of null distribution

Null.Parameter

The parameter values of the null distribution

Alternative.Distrbution

The family of alternative distribution

Alternative.Parameter

The parameter values of the alternative distribution

Sample.Size

The sample size

Significance.level

The level of the significance of the test

Decision

The Test Result, wheter the null hypotheis is rejected or not

Power

Power of the Test

Arguments

data

A numeric vector

null.dist

The family of null distribution

null.par

The parameter values of the null distribution

alter.dist

The family of alternative distribution

alter.par

The parameter values of the alternative distribution

test.level

The level of significance of the test

sim.size

simulation size, increasing it will gives more accuracy.

power

A loogical vector, whether power of the test will be calculated.

Details

This function mainly test whether data comes from the null distribution or alternative distribution. It uses the theory of the Most Powerful (MP) test. It basically uses simulation to get the p value and make the decision. Increasing sim.size give more accuracy as well as test can be failed if you increase it heavily.

Examples

Run this code
sim_mp_test(rnorm(100),null.dist="normal",null.par=c(0,1),alter.dist="cauchy",alter.par=c(0,1))
sim_mp_test(rnorm(100),null.dist="nor",null.par=c(2,1),alter.dist="nor",alter.par=c(0,1))

Run the code above in your browser using DataLab