binhf (version 1.0-3)

afgen: NN and Anscombe samples

Description

Samples binomial Fisz and Anscombe transformed random variables on a grid of binomial probabilities.

Usage

afgen(xgrid = seq(0, 1, length = 21), ygrid = seq(0, 1, length = 21), samples = 1000, 
binsize = 32)

Arguments

xgrid

vector of x co-ordinate probabilities.

ygrid

vector of x co-ordinate probabilities.

samples

the number of samples to draw from each random variable.

binsize

the binomial size of the binomial random variables.

Value

a

an array of dimensions length(xgrid)xlength(ygrid)xsamples of values of binomial Haar-Fisz random variable.

b

an array of dimensions length(xgrid)xlength(ygrid)xsamples of values of A.

Details

The function produces sampled values from the random variable: \(\zeta(X_1,X_2)=\frac{X_1-X_2}{ \sqrt{ (X_1+X_2)(2*binsize-X_1-X_2)/ 2*binsize }} \), where \(X_i\) are Bin(binsize,\(p_i\)) random variables, for all combinations of values of \(p_1\) in xgrid and \(p_2\) in ygrid. For Anscombe's transformation, \(A=sin^{-1}\sqrt{(x+3/8)/(binsize+3/4)}\), the values correspond to the random variable with the larger binomial probability.

References

Anscombe, F.J. (1948) The transformation of poisson, binomial and negative binomial Data, Biometrika,35, 246--254. Nunes, M. and Nason, G.P. (2009) A multiscale variance stabilization for binomial sequence proportion estimation. Statistica Sinica, 19 (1491--1510).

See Also

ansc

Examples

Run this code
# NOT RUN {
##
varvalues<-afgen(xgrid=seq(0,1,length=21),ygrid=seq(0,1,length=21),samples=1000,binsize=32)

##creates 1000 samples of the two random variables zeta_B and A for each point 
##(x,y) for x and y regularly-spaced probability vectors of length 21.
##
# }

Run the code above in your browser using DataCamp Workspace