distfree.cr: distfree.cr

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/distfree.cr.R

Description

Constructs empirical confidence regions for bivariate data based on the method proposed by Zhiqiu Hu and Rong-cai Yang(2013) <doi:10.1371/journal.pone.0081179.g001>.

Usage

1
2
3
distfree.cr(x, y, alpha = 0.05, alpha.min.diff = 0.5/NROW(x), nknots = 40, 
            xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), 
            col = c("red", "black", "gray"), draw = T)

Arguments

x

numeric vector, of dimensions nobs * 1. If a data frame or a two-column numeric matrix of x and y is supplied here, the second option y of the function needs to be ignored.

y

numeric vector, of dimensions nobs * 1. This option needs to be ignored if users provided both x and y in the first option of the function.

alpha

Significant level. By default alpha is set to be 0.05.

alpha.min.diff

minimum difference is allowed for calculating confidence region. This option is not suggested for most users. The default value is set to be alpha/10.

nknots

number of knots that will be used to enclose the confidence region. The default value nknots=40 is recommended for all users.

xlab

define the label of x axis of the plot.

ylab

define the label of y axis of the plot.

col

define colors of the scatter points and lines of the plot. The default setting col=("red", "black", "gray") are the colors for the lines enclosed the region, the points within the region and the points outside of the region, respectively.

draw

a logical indicator. Users may disable plotting by setting the option to FALSE

Details

This function constructs a distribution-free confidence region based on the method proposed by Zhiqiu Hu and Rong-cai Yang.

Value

alpha.realized

Realized-alpha, which is defined as the proportion of the total points outside the confidence region.

polygon

'data.frame' of x,y providing the apexes of the lines.

polygon.smooth1

'data.frame' of x,y providing the apexes of the smoothed polygon 1.

polygon.smooth2

'data.frame' of x,y providing the apexes of the smoothed polygon 2.

data

'data.frame', of dimension nobs * 3, the first two columns are input data of x and y values and the third column data$pip are indicators of whether the points are within (1) or outside (0) the confidence region.

alpha,xlab,ylab,col

values assigned by users.

Note

A smooth confidence region can be achieved by setting up a big number for input variable nknots, and this in turn requires large sample sizes.

Author(s)

Zhiqiu Hu and Rong-cai Yang

Examples

1
2
3
4
5
6
library(distfree.cr)
dat=data.frame(x=c(rnorm(3000), rnorm(3000, mean=1, sd=2.5)), 
               y=c(rnorm(3000), rnorm(3000, mean=1, sd=2.5)))
pt=distfree.cr(dat, draw=TRUE, alpha=0.05)
pt=distfree.cr(x=dat$x, y=dat$y, draw=FALSE)
plot(pt)

distfree.cr documentation built on May 2, 2019, 11:02 a.m.