residplot: Plot the Residuals of a LVM Object

residplotR Documentation

Plot the Residuals of a LVM Object

Description

Plot the residuals for each outcome of a lvm object.

Usage

residplot(object, ...)

## S3 method for class 'lvmfit'
residplot(
  object,
  res.variables = endogenous(object),
  obs.variables = res.variables,
  sd.kernel = 0.5,
  kernel = "dnorm",
  plot.weights = FALSE,
  ncol = NULL,
  smooth.mean = TRUE,
  smooth.sd = TRUE,
  plot = TRUE,
  ...
)

Arguments

object

a lvm model.

...

additional arguments.

res.variables

the endogenous variable for which the residuals should be displayed.

obs.variables

same as res.variables or a variable present in the model

sd.kernel

the standard deviation of the kernel used to smooth the variance.

kernel

the type of kernel used to smooth the variance.

plot.weights

should the weights used to compute the variance be displayed?

ncol

the number of columns in the graphical display.

smooth.mean

should the mean be displayed across the obs.variables values?

smooth.sd

should the variance be displayed across the obs.variables values?

plot

should the fit be displayed in a graphical window.

Value

a list containing:

  • plot the display of the fit

  • data the dataset used to make the display

Examples

m <- lvm(y1~eta+x1,y2~eta,y3~eta+x3)
latent(m) <- ~ eta
dd <- lava::sim(m,100) ## Simulate 100 observations from model
e <- estimate(m, dd) ## Estimate parameters

res <- residplot(e)
residplot(e, obs.variables = "x1")

m <- lvm(y~x)
distribution(m,~y) <- function(n,mean,x) rnorm(n,mean,exp(x)^.5)
d <- lava::sim(m,1e3)

e <- estimate(m,data = d)

residplot(e)
# residplot(e, plot.weights = TRUE)
residplot(e, res.variables = "y", obs.variables = "x")

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