predict.gmf: Predict generalized PCA scores or reconstruction on new data

Description Usage Arguments Examples

Description

Predict generalized PCA scores or reconstruction on new data

Usage

1
2
3
## S3 method for class 'gmf'
predict(object, newdata, type = c("PCs", "link", "response"),
  quiet = TRUE, max_iters = 1000, conv_criteria = 1e-05, start_A, ...)

Arguments

object

generalized MF object

newdata

matrix of the same exponential family as covariates in object. If missing, will use the data that object was fit on

type

the type of fitting required. type = "PCs" gives matrix of principal components of x, type = "link" gives a matrix on the natural parameter scale, and type = "response" gives a matrix on the response scale

quiet

logical; whether the calculation should show progress

max_iters

maximum number of iterations

conv_criteria

convergence criteria

start_A

initial value for A

...

Additional arguments

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# construct a low rank matrices in the natural parameter space
rows = 100
cols = 10
set.seed(1)
loadings = rnorm(cols)
mat_np = outer(rnorm(rows), rnorm(cols))
mat_np_new = outer(rnorm(rows), loadings)

# generate a count matrices
mat = matrix(rpois(rows * cols, c(exp(mat_np))), rows, cols)
mat_new = matrix(rpois(rows * cols, c(exp(mat_np_new))), rows, cols)

# run Poisson PCA on it
gmf = generalizedMF(mat, k = 1, family = "poisson")

A = predict(gmf, mat_new)

andland/generalizedPCA documentation built on May 12, 2019, 2:42 a.m.