Description Usage Arguments Details Value Author(s) Examples
This function is based on principal component analysis of a transformation of latent Poisson means of a sample. Given the estimated principal components of the latent Poisson means, this function estimates scores using a combination of likelihood and mean squared error.
1 2 | get_scores(X,V,d,k,transformation,mu)
get_scores_log(X,V,d,k,mu)
|
X |
The data matrix |
V |
Vector of all principal components of the transformed latent means |
d |
Eigenvalues corresponding to the principal components |
k |
Number of principal components to project onto |
transformation |
The transformation to be applied to the latent means |
mu |
The mean of the transformed latent means |
This function estimates the latent transformed Poisson means in order
to minimise a combination of the log-likelihood plus the squared
residuals of the projection of these latent means onto the first k
principal components. Note that for transformed Poisson PCA, the
scores are not nested, so the choice of k will have an impact on the
projection. The get_scores_log
function deals with the special
case where the transformation is the log function.
scores |
The principal scores |
means |
The corresponding estimated latent Poisson means |
Toby Kenney tkenney@mathstat.dal.ca and Tianshu Huang
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | n<-20 #20 observations
p<-5 #5 dimensions
r<-2 #rank 2
mean<-10*c(1,3,2,1,1)
set.seed(12345)
Z<-rnorm(n*r)
dim(Z)<-c(n,r)
U<-rnorm(p*r)
dim(U)<-c(r,p)
Latent<-Z%*%U+rep(1,n)%*%t(mean)
X<-rpois(n*p,as.vector(Latent))
dim(X)<-c(n,p)
Sigma<-LinearCorrectedVariance(X[-n,])
eig<-eigen(Sigma)
get_scores(X[n,],eig$vectors,eig$values,r,"linear",colMeans(X[-n,]))
Xlog<-rpois(n*p,exp(as.vector(Latent)+3))
dim(Xlog)<-c(n,p)
logtrans<-makelogtransformation(3,4)
Sigmalog<-TransformedVarianceECV(X[-n,],logtrans$g,logtrans$ECVar)
eiglog<-eigen(Sigmalog)
gX<-X[-n,]
if(!is.null(logtrans)){
for(i in 1:(n-1)){
for(j in 1:p){
gX[i,j]<-logtrans$g(X[i,j])
}
}
}
mu<-colMeans(gX)
get_scores_log(X[n,],eiglog$vectors,eiglog$values,r,mu)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.