Description Usage Arguments Value Examples
Dimension reduction for exponential family data by extending Pearson's PCA formulation
1 2 3 4 5 | generalizedPCA(x, k = 2, M = 4, family = c("gaussian", "binomial",
"poisson", "multinomial"), weights, quiet = TRUE, majorizer = c("row",
"all"), partial_decomp = FALSE, max_iters = 1000, conv_criteria = 1e-05,
random_start = FALSE, start_U, start_mu, main_effects = TRUE,
normalize = FALSE, validation, val_weights)
|
x |
matrix of either binary, proportions, count, or continuous data |
k |
number of principal components to return |
M |
value to approximate the saturated model |
family |
exponential family distribution of data |
weights |
an optional matrix of the same size as the |
quiet |
logical; whether the calculation should give feedback |
majorizer |
how to majorize the deviance. |
partial_decomp |
logical; if |
max_iters |
number of maximum iterations |
conv_criteria |
convergence criteria. The difference between average deviance in successive iterations |
random_start |
logical; whether to randomly inititalize the parameters. If |
start_U |
starting value for the orthogonal matrix |
start_mu |
starting value for mu. Only used if |
main_effects |
logical; whether to include main effects in the model |
normalize |
logical; whether to weight the variables to they all have equal influence |
validation |
a validation dataset to select |
val_weights |
weights associated with validation data |
An S3 object of class gpca
which is a list with the
following components:
mu |
the main effects |
U |
a |
PCs |
the princial component scores |
M |
the parameter inputed |
family |
the exponential family used |
iters |
number of iterations required for convergence |
loss_trace |
the trace of the average deviance of the algorithm. Should be non-increasing |
prop_deviance_expl |
the proportion of deviance explained by this model.
If |
1 2 3 4 5 6 7 8 9 10 11 | # construct a low rank matrix in the natural parameter space
rows = 100
cols = 10
set.seed(1)
mat_np = outer(rnorm(rows), rnorm(cols))
# generate a count matrix
mat = matrix(rpois(rows * cols, c(exp(mat_np))), rows, cols)
# run Poisson PCA on it
gpca = generalizedPCA(mat, k = 1, M = 4, family = "poisson")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.