Learn R Programming

alR (version 2.2.0)

alEdist: Arc length estimation.

Description

Goodness-of-fit using arc lengths.

Usage

alEdist(n, bootstraps, mu, sigma, q1, q2, quantile, dc, type)

alEtest(X, mu, sigma, q1, q2, type, bootstraps, ...)

# S3 method for default alEtest(X, mu, sigma, q1, q2, type, bootstraps, ...)

# S3 method for alEtest print(x, ...)

Arguments

n

An integer specifying the sample size.

bootstraps

An integer specifying the size of the parametric bootstrap.

mu

A real value specifying the mean of the normal distribution.

sigma

A positive real number specifying the scale parameter of the normal distribution.

q1, q2

Vectors specifying the quantiles (or points if quantile=FALSE) over which arc length segments are to be computed.

quantile

TRUE/FALSE whether q1 and q2 are quantiles, or elements of the domain of x.

dc

TRUE/FALSE: Should the discrete or continuous sample statistic be used.

type

The type of bandwidth estimator for the underlying KDE; see bw.

X

A vector of sample values.

...

Additional arguments passed to alEtest (not currently used).

x

An alEtest object.

Value

alEdist: A vector (matrix) of arc lengths over the specified interval(s), i.e. the simulated distribution for the chosen sample arc length statistic.

alEtest: A generic S3 object with class alEtest.

alEtest.default: A list with the following components:

  • q1, q2: The segment over which the arc length was calculated.

  • mu: A real value specifying the mean of the normal distribution.

  • sigma: A positive real number specifying the scale parameter of the normal distribution.

  • bw: The bandwidth for the kernel density estimator.

  • dist: A numeric matrix whose columns represent a bootstrap distribution for the corresponding sample arc length statistic.

  • statistic: The value of the observed sample statistic.

  • pvalue: The p-value for the test based on a parametric bootstrap sample.

  • bootstraps: Number of bootstrap samples.

Methods (by class)

  • default: default method for alEtest.

  • alEtest: print method for alEtest.

Details

First the distributional parameters of a sample is estimated using the continuous arc length sample statistic (see alE). The calculated sample arc length statistic is then compared to the distribution of that particular sample statistic, obtained by a parametric bootstrap, using the estimated parameters (see alEdist). This finally leads to the calculation of a p-value for a goodness-of-fit test, based on the simulated distribution.

This method is currently only implemented for the normal distribution, and for a single arc length segment.

Examples

Run this code
# NOT RUN {
alEdist(50, 100, 2, 3.5, 0.025, 0.975, TRUE, TRUE, -1)
alEdist(50, 100, 2, 3.5, c(0.025,0.5), c(0.5,0.975), TRUE, TRUE, -1)
alEdist(50, 100, 2, 3.5, 0.025, 0.975, TRUE, FALSE, -1)
alEdist(50, 100, 2, 3.5, c(0.025,0.5), c(0.5,0.975), TRUE, FALSE, -1)
alEdist(50, 100, 2, 3.5, qnorm(0.025,2,3.5),
qnorm(0.975, 2, 3.5), FALSE, FALSE, -1)
alEdist(50, 100, 2, 3.5, c(qnorm(0.025, 2, 3.5),2),
c(2,qnorm(0.975, 2, 3.5)), FALSE, FALSE, -1)
# }
# NOT RUN {
x <- rnorm(1000)
s1 <- alE(x, 0.025, 0.975, TRUE, -1)
alEtest(x, mu=s1$par[1], sigma=s1$par[2], q1=0.025, q2=0.975,
type=-1, bootstraps=50)
s2 <- alE(x, 0.025, 0.975, FALSE, -1)
alEtest(x, mu=s2$par[1], sigma=s2$par[2], q1=0.025, q2=0.975,
type=-1, bootstraps=50)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab