Description Usage Arguments Details Value Examples
This function produces 5 plots which should help to judge the goodness of an 'lmvar' fit.
1 2 3 |
x |
Object of class 'lmvar' |
which |
Integer vector slecting which of the 5 plots is produced |
id.n |
Integer, the number of 'extreme' observations that are labelled in the plots |
cex.id |
Numeric, scale-factor for the size of the observation labels in the plots |
show |
Boolean, if TRUE the number of the plot is shown in the plot-title and the name
of |
... |
for compatibility with |
The plots are intended to be a quick and easy way to get an impression of the goodness-of-fit. The function is intended for an interactive R-session and users must hit <enter> before each plot is deplayed. The following plots can be produced.
A plot of the residuals y - μ versus the fitted values μ.
A QQ-plot, showing the z-score (y - μ) / σ resulting from the fit versus
the z-score calculated from the sample quantiles. The sample quantiles are calculated as
ppoints
(n) with n the number of obervations in x
.
A histogram of the distribution of the quantiles of the response values. The quantiles are calculated under the assumption that the response values are normally distributed with expected values μ and standard deviations σ.
A plot of the z-scores versus the fitted values.
A scale-location plot showing the square root of the absolute z-scores versus the fitted values.
If relevant, plots show the average y-value as a red line. This line is created by the function
panel.smooth
.
If relevant, plots show the expected average y-value as a dotted gray line.
To suppress labelling of observations in the plots, set id.n
to zero or a negative
value. If id.n
is set to a value equal to or larger than the number of observations
in x
, all points in the plots are labelled.
There is no return value. The function only shows plots in the graphics output device.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | if (interactive()){
# As example we use the dataset 'cats' from the library 'MASS'.
library(MASS)
# We regress the cats heart weight 'Hwt' onto its body weight 'Bwt'
X = model.matrix(~ Bwt - 1, cats)
fit = lmvar(cats$Hwt, X_mu = X, X_sigma = X)
# Display all plots
plot(fit)
# Display two plots that focus on the shape of the distribution
plot(fit, which = c(2, 3))
# Suppress plot number and name of the 'lmvar' object being plot in plot 3
plot(fit, which = 3, show = FALSE)
# Label the 5 observations with the most extreme residuals in plot 1
plot(fit, which = 1, id.n = 5)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.