qqplot2: QQplot for the Residuals of a LVM Object

qqplot2R Documentation

QQplot for the Residuals of a LVM Object

Description

QQplot for the residuals of a lvm object.

Usage

qqplot2(object, ...)

## S3 method for class 'lvmfit'
qqplot2(
  object,
  variables = NULL,
  residuals = NULL,
  plot = TRUE,
  mfrow = NULL,
  mar = c(2, 2, 2, 2),
  qq.type = "qqtest",
  name.model = "",
  centralPercents = 0.95,
  ...
)

## S3 method for class 'list'
qqplot2(
  object,
  plot = TRUE,
  mfrow = NULL,
  mar = c(2, 2, 2, 2),
  qq.type = "qqtest",
  name.model = "",
  centralPercents = 0.95,
  ...
)

## S3 method for class 'multigroupfit'
qqplot2(object, residuals = NULL, name.model = NULL, plot = TRUE, ...)

Arguments

object

a lvm model.

...

additional arguments to be passed to qqtest.

variables

the variable for which the residuals should be displayed.

residuals

[matrix] the residuals relative to each endogenous variable.

plot

[logical] should the graphic be displayed?

mfrow

how to divide the window. See par.

mar

[numeric vector] the number of lines of margin to be specified on the four sides of the plot (bottom, left, top, right).

qq.type

the function used to display the qqplot. Can be qqtest or qqnorm.

name.model

[character vector] character string to be displayed before the variable name in the title of the plot. If NULL and object is a list, the names of the list will be used to define the title of the plots.

centralPercents

argument passed to qqtest. See the help of qqtest.

Details

Simulation is based on a multivariate truncated normal law (even though it is not satifying for the variance components)

Value

a data frame/cvlvm object containing the convergence status (by default 0 indicates successful convergence, see ?optim), the value of the log-likelihood and the estimated parameters (in columns) for each initialization (in rows)

Examples

#### lvm object ####
library(lava)
m <- lvm(list(y~v1+v2+v3+v4,c(v1,v2,v3,v4)~x))
latent(m) <- ~ x

set.seed(10)
dd <- sim(m,100) ## Simulate 100 observations from model
e <- estimate(m, dd) ## Estimate parameters

qqplot2(e)

#### multigroup object ####
e2 <- estimate(list(m1=m,m2=m), split(dd, dd$v1>0)) ## Estimate parameters

qqplot2(e2)


bozenne/butils documentation built on Oct. 14, 2023, 6:19 a.m.