find_h_cont

0th

Percentile

Finding optimal instrumental density.

Finds the optimal instrumental density h to be used in the bidirectional acceptance sampling.

Keywords
Optimal instrumental density for bidirectional acceptance sampling
Usage
find_h_cont(data,g,dhat,range=NULL,M_0=NULL,par0=NULL,lbs,ubs,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 x domain. See details.

range

Interval corresponding to the support of the continuous data distribution.

M_0

Starting point for optimization. See details.

par0

A vector of starting values of the parameters to be estimated. See details.

lbs

A vector of the lower bounds of the parameters to be estimated.

ubs

A vector of the upper bounds of the parameters to be estimated.

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 h. See details.

Details

The parametric start specified in g is assumed to be fully specified and takes x as the 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 choose M_0 to be the central point of the range. For example, if the range is from 0 to 30, we choose 15 as 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 density. For instance, if h is a mixuture of p truncated normals, 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 means of the p truncated normals contributing to the mixture. Finally, the last p elements of par0 correspond to the starting values for the standard deviations of the p truncated normals 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.

means

The optimal mean vector.

sds

The optimal set of standard deviations.

h

Function corresponding to the optimal instrumental density.

References

Algeri S. and Zhang X. (2020). Exhaustive goodness-of-fit via smoothed inference and graphics. arXiv:2005.13011.

d_hat, find_h_disc, rmixtruncnorm, dmixtruncnorm

• find_h_cont
Examples
# NOT RUN {
library("truncnorm")
library("LPBkg")
L=0
U=30
range=c(L,U)
set.seed(12395)
meant=-15
sdt=15
n=300
data<-rtruncnorm(n,a=L,b=U,mean=meant,sd=sdt)
poly2_num<-function(x){4.576-0.317*x+0.00567*x^2}
poly2_den<-integrate(poly2_num,lower=L,upper=U)$value g<-function(x){poly2_num(x)/poly2_den} ddhat<-d_hat(data,m=2,g, range=c(L,U), selection=FALSE)$dx
lb=c(0,-20,0,0,0)
ub=c(1,10,rep(30,3))
par0=c(0.3,-17,1,10,15)
range=c(L,U)
find_h_cont(data,g,ddhat,range,M_0=10,par0,lb,ub,ylim.f=c(0,0.25),ylim.d=c(-1,2))
# }

Documentation reproduced from package LPsmooth, version 0.1.0, License: GPL-3

Community examples

Looks like there are no examples yet.