# afgen: NN and Anscombe samples In binhf: Haar-Fisz functions for binomial data

## Description

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

## Usage

 1 2 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.

## Details

The function produces sampled values from the random variable:

ζ(X_1,X_2)=\frac{X_1-X_2}{ √{ (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}√{(x+3/8)/(binsize+3/4)}, the values correspond to the random variable with the larger binomial probability.

## 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.

## Author(s)

Matt Nunes ([email protected])

## 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).

ansc
 1 2 3 4 5 6 ## 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. ##