find_h_disc {LPsmooth} | R Documentation |
Finding optimal instrumental mass function.
Description
Finds the optimal probability mass function h
to be used in the bidirectional acceptance sampling.
Usage
find_h_disc(data,g,dhat,lattice=NULL,M_0=NULL,size,par0=NULL,check.plot=TRUE,
ylim.f=c(0,2),ylim.d=c(0,2),global=FALSE)
Arguments
data |
A data vector. |
g |
Function corresponding to the parametric start or postulated model. See details. |
dhat |
Function corresponding to the estimated comparison density in the |
lattice |
Support of the discrete data distribution. |
size |
A postive value corresponding to the target for number of successful trials. |
M_0 |
Starting point for optimization. See details. |
par0 |
A vector of starting values of the parameters to be estimated. See details. |
check.plot |
A logical argument indicating if the plot comparing the densities involved should be displayed or not. The default is TRUE. |
ylim.f |
If check.plot=TRUE, the range of the y-axis of the plot for the probability density functions. |
ylim.d |
If check.plot=TRUE, the range of the y-axis of the plot for the comparison densities. |
global |
A logical argument indicating if a global optimization is needed to find the instrumental probability function |
Details
The parametric start specified in g
is assumed to be fully specified and takes x
as only argument. The argument dhat
is the estimated comparison density in the x
domain. We usually get the argument dhat
by means of the function d_hat
within our package.
The value M_0
and the vector par0
are used for the optimization process for finding the optimal instrumental density h. Usually, we could choose the M_0
to be the central point of the lattice
. For example, if the range is from 0
to 30
, we could choose 15
as the starting point. The choice of M_0
is not expected to affect substantially the accuracy of the solution. The vector par0
collects initial values for the parameters which characterize the instrumental probability mass function. For instance, if h
is a mixuture of p
negative binomials, the first p-1
elements of pis
correspond to the starting values
for the first p-1
mixture weights. The following p
elements are the initial values for the probablities of success of the p
negative binomials contributing to the mixture. The argument global
controls whether to use a global optimization or not. A local method allows to reduce the optimization time but the solution is particularly sensible to the choice of par0
. Conversely, setting global=TRUE
leads to more accurate result.
Value
Mstar |
The reciprocal of the acceptance rate. |
pis |
The optimal set of mixture weights. |
probs |
The optimal set of probabilities of success. |
h |
Function corresponding to the optimal instrumental probability mass function. |
Author(s)
Xiangyu Zhang and Sara Algeri
References
Algeri S. and Zhang X. (2020). Smoothed inference and graphics via LP modeling, arXiv:2005.13011.
See Also
d_hat
, find_h_cont
, rmixtruncnorm
, dmixtruncnorm
Examples
lattice=seq(0,20,length=21)
n=200
data<-rbinom(n,size=20,prob=0.5)
g<-function(x)dpois(x,10)/(ppois(20,10)-ppois(0,10))
ddhat<-d_hat(data,m=1,g=g,lattice=lattice,selection=TRUE)$dx
find_h_disc(data=data,g=g,dhat=ddhat,lattice,M_0=10,size=15,par0=c(0.3,0.5,0.6),
check.plot=TRUE,ylim.f=c(0,0.4),ylim.d=c(-3,2.5),global=FALSE)