Learn R Programming

sgdGMF (version 1.0)

plot.initgmf: Plot diagnostics for an initialized GMF model

Description

Plots (one of) six diagnostics to graphically analyze the marginal and conditional distribution of the residuals of a GMF model. Currently, the following plots are available: residuals against observation indices, residuals agains fitted values, absolute square-root residuals against fitted values, histogram of the residuals, residual QQ-plot, residual ECDF-plot.

Usage

# S3 method for initgmf
plot(
  x,
  ...,
  type = c("res-idx", "res-fit", "std-fit", "hist", "qq", "ecdf"),
  resid = c("deviance", "pearson", "working", "response", "link"),
  subsample = FALSE,
  sample.size = 500,
  partial = FALSE,
  normalize = FALSE,
  fillna = FALSE
)

Value

A ggplot object showing the selected diagnostic plot.

Arguments

x

an object of class initgmf

...

further arguments passed to or from other methods

type

the type of plot which should be returned

resid

the type of residuals which should be used

subsample

if TRUE, computes the residuals over o small fraction of the data

sample.size

the dimension of the sub-sample which should be used

partial

if TRUE, computes the partial residuals

normalize

if TRUE, standardizes the residuals column-by-column

fillna

if TRUE, fills the NA values with 0

See Also

plot.sgdgmf.

Examples

Run this code
# 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
init = sgdgmf.init(data$Y, ncomp = 3, family = poisson())

# Plot the residual-based GMF diagnostics
plot(init, type = "res-fit") # Residuals vs fitted values
plot(init, type = "std-fit") # Abs-sqrt-transformed residuals vs fitted values
plot(init, type = "qq") # Residual QQ-plot
plot(init, type = "hist") # Residual histogram

Run the code above in your browser using DataLab