refit.sgdgmf | R Documentation |
Refine the estimated latent scores of a GMF model via IRWLS
## S3 method for class 'sgdgmf'
refit(
object,
...,
normalize = TRUE,
verbose = FALSE,
parallel = FALSE,
nthreads = 1
)
object |
an object of class |
... |
further arguments passed to or from other methods |
normalize |
if |
verbose |
if |
parallel |
if |
nthreads |
number of cores to be used in the |
An sgdgmf
object containing the re-fitted model.
sgdgmf.fit
# Load the sgdGMF package
library(sgdGMF)
# Generate data from a Poisson model
data = sim.gmf.data(n = 100, m = 20, ncomp = 5, family = poisson())
# Fit a GMF model using SGD
gmf_old = sgdgmf.fit(data$Y, ncomp = 3, family = poisson(), method = "sgd")
# Refine the score matrix estimate
gmf_new = refit(gmf_old)
# Get the fitted values in the link and response scales
mu_hat_old = fitted(gmf_old, type = "response")
mu_hat_new = fitted(gmf_new, type = "response")
# Compare the results
oldpar = par(no.readonly = TRUE)
par(mfrow = c(2,2), mar = c(1,1,3,1))
image(data$Y, axes = FALSE, main = expression(Y))
image(data$mu, axes = FALSE, main = expression(mu))
image(mu_hat_old, axes = FALSE, main = expression(hat(mu)[old]))
image(mu_hat_new, axes = FALSE, main = expression(hat(mu)[new]))
par(oldpar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.