Compute the Average Shifted Histogram for Weighted Data

Share:

Description

This function computes the average shifted histogram (ASH) for weighted data.

Usage

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

Arguments

x

vector of data to be used to estimate 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 vector containing the ASH density estimate.

Author(s)

Tony Olsen Olsen.Tony@epa.gov

Examples

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

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.