Learn R Programming

QBAsyDist (version 0.1.2)

NLRTest: Nonparametric likelihood ratio test to test for symmetry.

Description

The nonparametric likelihood ratio test to test for symmetry is discussed in Gijbels et al. (2019d).

Usage

NLRTest(y, f = NULL, F = NULL, QF = NULL, method = c("smooth",
  "parametric"), nboot = 500)

Arguments

y

This is a vector of quantiles.

f

This is the reference density function \(f\) which is a standard version of a unimodal and symmetric around 0 density.

F

This is the cumulative distribution function \(F\) of a unimodal and symmetric around 0 reference density function \(f\).

QF

This is the quantile function of the reference density \(f\).

method

The method to be used for drawing bootstrap samples. The default method is a smooth bootstrap procedure. The density function \(f\), the cumulative distribution function \(F\) and the quantile function \(QF\) are required for parametric bootstrap procedure. If \(QF\) is not given, then the numerical \(QF\) will be used.

nboot

The number of bootstrap samples desired. The default number is 500.

Value

The nonparametric likelihood ratio test statistic with bootstrap \(P\)-value.

References

Gijbels, I., Karim, R. and Verhasselt, A. (2019d). Test of symmetry and a quantile-based asymmetric family of densities, Manuscript.

Examples

Run this code
# NOT RUN {
# Example 1: Let F be a standard normal cumulative distribution function then
f_N<-function(s){dnorm(s, mean = 0,sd = 1)} # density function of N(0,1)
F_N<-function(s){pnorm(s, mean = 0,sd = 1)} # distribution function of N(0,1)
QF_N<-function(beta){qnorm(beta, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)}
# Example: STRength dataset
my.sample<-c(1.901,2.132,2.203,2.228,2.257,2.350,2.361,2.396,2.397,
             2.445,2.454,2.474,2.518,2.522,2.525,2.532,2.575,2.614,2.616,
             2.618,2.624,2.659,2.675,2.738,2.740,2.856,2.917,2.928,2.937,
             2.937,2.977,2.996,3.030,3.125,3.139,3.145,3.220,3.223,3.235,
            3.243,3.264,3.272,3.294,3.332,3.346,3.377,3.408,3.435,3.493,
             3.501,3.537,3.554,3.562,3.628,3.852,3.871,3.886,3.971,4.024,
             4.027,4.225,4.395,5.020)


NLRTest(my.sample,f=NULL,F=NULL,QF=NULL,method=c("smooth"),nboot=500)
NLRTest(my.sample,f=f_N,F=F_N,QF=QF_N,method=c("parametric"),nboot=500)
NLRTest(my.sample,f=f_N,F=F_N,QF=NULL,method=c("parametric"),nboot=500)
# }

Run the code above in your browser using DataLab