xdistResdiff {plgraphics}R Documentation

Residual Differences for Near Replicates: Tabulate and Test

Description

A test for the completeness of a linear regression model can be performed based on comparing the differences of residuals for pairs of observations that are close to each other to the estimated standard deviation of the model.

Usage

xdistResdiff(object, perc = c(3, 10, 80), trim = 0.1,
  nmax = 100, out = "aggregate")
xdistResscale(x, perc = c(3, 10, 90), trim = 1/6)

Arguments

object

an object containing the result of fitting a linear model by regr

x

an object produced by xdistResdiff

perc

Percentage points to define distance classes

trim

Trimming proportion for calculating means of absolute residual differences

nmax

maximal number of observations to form pairs

out

determines the value of xdistResdiff: if =="aggregate" (the default), the value will be produced by calling xdistResscale, otherwise, all x distances and respective residual differences will be returned.

Details

See package vignette.

Value

For xdistResdiff with out="aggregate" and xdistResscale, a matrix is returned with a row for each class of x distances and the columns

xdist

mean x distance

rdiff.mean

absolute differences of residuals for pairs of observations in the distance class, averaged over the class

rdiff.simmean

mean of (trimmed) means for simulated data

rdiff.se

standard error of (trimmed) means as obtained from simulation

The matrix carries along the following attributes:

perc

given argument perc

xd.classlim

the actual class limits corresponding to perc

trim

given argument trim

rdiff.grandmean

overall mean of absolute residual differences

p-values

p values for the classes as obtained from simulation, and p-value for the sum of squares statistic

class

The value has S3 class xdistResscale and matrix

.

If xdistResdiff with out different from "aggregate", then a data.frame is returned containing a row for each pair of observations and the columns

id1, id2

the labels of the two observations

xdist

the x distance between the two observations

resdiff

the difference of residuals for the two observations

The value has S3 class xdistResdiff and data.frame.

Author(s)

Werner A. Stahel, ETH Zurich

References

See package vignette.

See Also

plot.xdistResscale

Examples

data(d.blast)
rr <- lm(tremor~distance+charge, data=d.blast)
## an inadequate model!
xdrs <- xdistResdiff(rr)
xdrd <- xdistResdiff(rr, out="all")
showd(xdrd)
xdrs <- xdistResscale(xdrd)
## same as first call of  xdiffResdiff
plot(xdrs)

[Package plgraphics version 1.2 Index]