polynomial_transformation {PoissonPCA} | R Documentation |
constructs a polynomial transformation for use with functions from the PoissoncorrectedPCA package.
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 a polynomial, and returns a list of the required functions.
Usage
polynomial_transformation(coeffs)
Arguments
coeffs |
A vector of coefficents of the polynomial. The constant term should not be included. |
Details
The coefficients of the polynomial should be given in order of
decreasing degree, and should not include the constant term. For
example "coeffs"=c(1,2,3)
refers to the polynomial
X^3+2*X^2+3*X. This function returns a list of functions for dealing
with this transformation.
Value
f |
evaluates the transformation |
g |
an estimator for the transformation of a latent Poisson mean |
solve |
computes the inverse transformation (often used for simulations) |
CVar |
an estimator for the conditional variance of g(X) |
Author(s)
Toby Kenney tkenney@mathstat.dal.ca and Tianshu Huang
Examples
cubic<-polynomial_transformation(c(1,0,0))
X<-rpois(100,1.8^3)
gX<-X
varX<-X
for(i in 1:100){
gX[i]<-cubic$g(X[i])
varX[i]<-cubic$CVar(X)
}
mean(gX)
var(gX)
mean(varX)