xdistResdiff | R Documentation |
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.
xdistResdiff(object, perc = c(3, 10, 80), trim = 0.1,
nmax = 100, out = "aggregate")
xdistResscale(x, perc = c(3, 10, 90), trim = 1/6)
object |
an object containing the result of fitting a linear
model by |
x |
an object produced by |
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 |
See package vignette.
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 |
xd.classlim |
the actual class limits corresponding to
|
trim |
given argument |
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 |
.
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
.
Werner A. Stahel, ETH Zurich
See package vignette.
plot.xdistResscale
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.