makelogtransformation: constructs a log transformation for use with functions from...

Description Usage Arguments Details Value Author(s) Examples

View source: R/LogEstimation.R

Description

When we are dealing with a transformation of the latent Poisson mean Lambda, we need various useful functions. This function computes the necessary functions for the log transformation, and returns a list of the required functions.

Usage

1
makelogtransformation(a,N,uselog=6,unbiassed=TRUE)

Arguments

a

The point about which to expand the Taylor series (see details)

N

The number of terms in the Taylor series to expand (see details)

uselog

Value above which we use the logarithm to approximate g(x). Typically should not be larger than 2a.

unbiassed

Indicates that the recommended unbiassed method should be used.

Details

The logarithmic transformation is fundamentally unestimable. There is no estimator which is an unbiassed estimator for log(Lambda). This is because the logarithm function has a singularity at zero, so has no globally convergent Taylor series expansion. Instead, we aim to use an approximately unbiassed estimator. For large enough X, g(X)=log(X) is a reasonable estimator. For smaller X, we need to compute a Taylor series for exp(-Lambda)log(Lambda). We do this from the equation log(x)=log(a)+log(x/a) and the Taylor expansion log(1+y)=y-y^2/2+y^3/3-... where y=x/a-1. This has radius of convergence 1, so will converge provided 0<x<2a. However, if we try to convert it to a polynomial in x, the coefficients will diverge. Instead, we truncate this Taylor series in y at a chosen number N terms. If the x is close to a, this truncated Taylor series should give an approximately unbiassed estimator for log(Lambda). Choice of N can have some effect. Larger values of N reduce the bias of g(X) but increase the variance. Experimentally, a=3 and N=6 seem to produce reasonable results, with g(X)=log(X) for X>6.

Value

type

="log"

f

function which evaluates the transformation

g

an estimator for the transformation of a latent Poisson mean

solve

function which computes the inverse transformation (often used for simulations)

ECVar

an estimator for the average conditional variance of g(X)

Author(s)

Toby Kenney tkenney@mathstat.dal.ca and Tianshu Huang

Examples

1
2
3
4
5
6
7
8
9
logtrans<-makelogtransformation(5,6)
X<-rpois(100,exp(1.4))
gX<-X
for(i in 1:100){
gX[i]<-logtrans$g(X[i])
}
mean(gX)
var(gX)
logtrans$ECVar(X)

PoissonPCA documentation built on Aug. 17, 2021, 5:09 p.m.