ash1.wgt: Compute the Average Shifted Histogram (ASH) for Weighted Data

Description Usage Arguments Value Author(s) References Examples

View source: R/ash1.wgt.R

Description

Calculate the average shifted histogram estimate of a density based on data from a survey design with weights.

Usage

1
2
ash1.wgt(x, wgt = rep(1, length(x)), m = 5, nbin = 50, ab = NULL,
  support = "Continuous")

Arguments

x

Vector of data used to estimate the density. NAs are allowed

wgt

Vector of Weights for each observation from a probability sample. The default is equal weights (equal probability).

m

The number of empty bins to add to the ends when the range is not completely specified. The default is 5.

nbin

The number of bins for density estimation. The default is 50.

ab

Optional range for support associated with the density. Both values may be equal to NA. If equal to NA, then corresponding limit will be based on nicerange(). The default is NULL.

support

The type of support. If equal to "Continuous", then data are from a continuous distribution. If equal to "Ordinal", then data are from a discrete distribution defined for integers only. The default is "Continuous".

Value

A list containing the ASH density estimate. List consists of

Author(s)

Tony Olsen Olsen.tony@epa.gov

References

Scott, D. W. (1985). "Averaged shifted histograms: effective nonparametric density estimators in several dimensions." The Annals of Statistics 13(3): 1024-1040.

Examples

1
2
3
4
x <- rnorm(100, 10, sqrt(10))
wgt <- runif(100, 10, 100)
rslt <- ash1.wgt(x, wgt)
plot(rslt)

mhweber/spsurvey documentation built on Sept. 17, 2020, 4:24 a.m.