smoothqpois {cir} | R Documentation |
Provide linearly-interpolated and somewhat modified quantile functions for the binomial and Poisson (as an approximation to the binomial) distributions, for use in interval estimation via 'cir.upndown'. All functions are used to approximate the binomial.
smoothqpois(p, size, prob, add = FALSE) smoothqbinom(p, size, prob, add = TRUE,half=FALSE)
p |
The inteval-cutoff quantile points (between 0 and 1). Could be a vector. |
size |
Sample size (for the original binomial problem) |
prob |
True probabilty (center of the interval) |
add |
Whether to add a 'padding' to the output in order to account for randomness in sample size (defaults to FALSE, since it is already accounted for in using Poisson) |
half |
(only for 'smoothqbinom') Should the final outcome shifted by half a unit, for symmetry? Defaults to FALSE |
These functions are utilities for 'cir.upndown'. They are tailored to help provide realistic interval estimation for percentile-finding binary experiments in which the treatment allocation is *random*. They make little sense outside this context. See example for how the functions look. For theoretical details, see Oron (2007), Section 3.3.
A vector of the same length as p
Assaf P. Oron
Oron A.P., Up-and-Down and the Percentile-Finding Problem. Doctoral Dissertation, University of Washington. 2007
pvec=seq(0,1,.01) n=10 ##### This is for a median-targeting application targ=0.5 ### Plain vanilla binomial (does not account for random allocation, and ### is asymmetric in location of vertical jumps) plot(100*pvec,qbinom(pvec,size=n,prob=targ),xlab="Cutoff point for Confidence Interval (percent)",ylab="Confidence Quantile Estimate",type='l') ### Binomial, but linearly interpolated and 'padded' lines(100*pvec,smoothqbinom(pvec,size=n,prob=targ),col=4) ### Poisson (the preferred approach since it has heavy tails) lines(100*pvec,smoothqpois(pvec,size=n,prob=targ),col=2) ########## Now the whole thing when the target is 20th percentile targ=0.2 plot(100*pvec,qbinom(pvec,size=n,prob=targ),xlab="Cutoff point for Confidence Interval (percent)",ylab="Confidence Quantile Estimate",type='l',ylim=c(-2,10)) lines(100*pvec,smoothqbinom(pvec,size=n,prob=targ),col=4) lines(100*pvec,smoothqpois(pvec,size=n,prob=targ),col=2) ### A negative value here may seem counter-intuitive, but it makes sense ###in a random-allocation setting