pistar.uv | R Documentation |
pistar.uv
is used to estimate the pi* index of fit
for any user-supplied univariate distribution. The user must supply a
probability mass or density function that inputs the data as the first
argument and the parameters as the next arguments. See ‘Details’
for the estimation procedures.
Standard errors available via jackknife as suggested by Dayton (2003).
pistar.uv(data, dfn, n_par = NULL, inits = NULL, discrete = FALSE, freq = FALSE, lower = NULL, upper = NULL, jack = FALSE, method = "Nelder-Mead", control = list(maxit = 2000), verbose = TRUE, npk = 1e3, eps = .Machine$double.neg.eps^0.5)
data |
a vector or a frequency table. |
dfn |
function: probability mass or density function that inputs the data as the first argument and the parameters as the arguments that immediately follow it. |
n_par |
numeric: number of parameters. Either |
inits |
a vector or list of initial values of parameters supplied to |
discrete |
logical: is the distribution discrete? |
freq |
logical: is the supplied data a frequency table? Relevant only if
|
lower |
numeric: a vector of lower bounds for parameters. |
upper |
numeric: a vector of upper bounds for parameters. |
jack |
logical: perform jackknife? |
method |
|
control |
list supplied to |
verbose |
logical: print during estimation? |
npk |
an integer indicating the number of points for |
eps |
numeric: the smallest number practically indistinguishable from 0.
Used only if |
The general procedure for discrete and continuous distributions is the same: a general purpose optimization method is used to find such values of the parameters of the supplied distribution that minimize the following quantity: 1 minus the inverse of the ratio of the model and the observed density at the point of their supports where this ratio is highest. This quantity is pi*.
The procedure for discrete distributions differs from the one for the
continuous distributions in the method used to obtain the observed
density. In the discrete case the observed frequencies are used for the
observed density. In the continuous case a kernel density is estimated
using density
with gaussian kernel.
Object of class
"Pistar"
, and "PistarUV"
and
depending on the discrete
argument of the function
either "PistarDUV"
or "PistarCUV"
with the following slots:
call |
the matched call. |
pistar |
a list of estimated values of the mixture index of fit.
|
pred |
if
if |
data |
the supplied data. |
param |
a list of parameter estimates of interest:
|
meth |
|
conv |
a list of integer codes from
|
mess |
a list of messages pased from
|
The application of the mixture index of fit for discrete distributions was proposed by Dayton (2003).
Juraj Medzihorsky
Dayton, C. M. (2003) Applications and computational strategies for the two-point mixture index of fit. British Journal of Mathematical & Statistical Psychology, 56, 1-13.
optim
density
freq.table
# (1) discrete # simulate data set.seed(1989) e <- c(rpois(1e3, 2), rpois(2e2, 5)) # make a frequency table te <- freq.table(e) # define a funcion for a slice from Poisson md <- function(x, l, lo=0, up=5){ z <- dpois(x, l) z[x<lo] <- 0 z[x>up] <- 0 z <- z/sum(z) return(z) } # find pi* pe <- pistar(proc="uv", data=te, dfn=md, n_par=1, discrete=TRUE, freq=TRUE, jack=FALSE) pe summary(pe) plot(pe) # (2) continuous # simulate data set.seed(1989) y <- c(rnorm(1e2, 0, 2), runif(2e1, -1, 1)) # find pi* and parameters for normal dist. py <- pistar(proc="uv", data=y, dfn=dnorm, n_par=2, discrete=FALSE, jack=FALSE) py summary(py) plot(py)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.