Package 'distfree.cr'

Title: Distribution-Free Confidence Region
Description: Constructs confidence regions without the need to know the sampling distribution of bivariate data. The method was proposed by Zhiqiu Hu & Rong-cai Yang (2013) <doi:10.1371/journal.pone.0081179.g001>.
Authors: Zhiqiu Hu, Rong-cai Yang
Maintainer: Zhiqiu Hu <[email protected]>
License: GPL (>= 2)
Version: 1.5.1
Built: 2024-11-16 06:25:44 UTC
Source: CRAN

Help Index


Distribution-free confidence region (distfree.cr)

Description

The disfree.cr package was developed to implement a novel geometry-based method introduced by Zhiqiu Hu and Rong-cai Yang for constructing confidence regions without the need to know the sampling distribution of estimated parameters for two or more variables.

Details

Package: distfree.cr
Type: Package
Version: 1.0
Date: 2012-11-23
License: GPL (>2.0)

Author(s)

Zhiqiu Hu and Rong-cai Yang

Maintainer: Zhiqiu Hu <[email protected]>


distfree.cr

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

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

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)

plot.distfree.cr

Description

Plot an object that is returned by the distfree.cr function.

Usage

## S3 method for class 'distfree.cr'
plot(x, show.points = T, ...)

Arguments

x

An object returned by the distfree.cr function.

show.points

A logical indicator of whether or not the original data are plotted.

...

Other parameters that can be passed to the plot function.