-- B + b * (predicted y). The "corrected" slope
can be thought of as shrinkage factor that takes into account
overfitting. 'validate.ols' can also be used when a model for a
continuous response is going to be applied to a binary response. A
Somers' D_{xy} for this case is computed for each resample by
dichotomizing 'y'. This can be used to obtain an ordinary receiver
operating characteristic curve area using the formula 0.5(D_{xy} +
1). The Nagelkerke-Maddala R^2 index for the dichotomized 'y' is
also given. See 'predab.resample' for the list of resampling
methods.
_U_s_a_g_e:
# fit <- fitting.function(formula=response ~ terms, x=TRUE, y=TRUE)
## S3 method for class 'ols':
validate(fit, method="boot", B=40,
bw=FALSE, rule="aic", type="residual", sls=0.05, aics=0,
pr=FALSE, u=NULL, rel=">", tolerance=1e-7, ...)
_A_r_g_u_m_e_n_t_s:
fit: a fit derived by 'ols'. The options 'x=TRUE' and 'y=TRUE'
must have been specified. See 'validate' for a description
of arguments 'method' - 'pr'.
method:
B:
bw:
rule:
type:
sls:
aics:
pr: see 'validate' and 'predab.resample'
u: If specifed, 'y' is also dichotomized at the cutoff 'u' for
the purpose of getting a bias-corrected estimate of D_{xy}.
rel: relationship for dichotomizing predicted 'y'. Defaults to
'">"' to use 'y>u'. 'rel' can also be '"<"', '">="', and
'"<="'.
tolerance: tolerance for singularity; passed to 'lm.fit.qr'.
...: other arguments to pass to 'predab.resample', such as
'group', 'cluster', and 'subset'
_V_a_l_u_e:
matrix with rows corresponding to R-square, MSE, intercept, slope,
and optionally D_{xy} and R^2, and columns for the original
index, resample estimates, indexes applied to whole or omitted
sample using model derived from resample, average optimism,
corrected index, and number of successful resamples.
_S_i_d_e _E_f_f_e_c_t_s:
prints a summary, and optionally statistics for each re-fit
_A_u_t_h_o_r(_s):
Frank Harrell
Department of Biostatistics, Vanderbilt University
f.harrell@vanderbilt.edu
_S_e_e _A_l_s_o:
'ols', 'predab.resample', 'fastbw', 'Design', 'Design.trans',
'calibrate'
_E_x_a_m_p_l_e_s:
set.seed(1)
x1 <- runif(200)
x2 <- sample(0:3, 200, TRUE)
x3 <- rnorm(200)
distance <- (x1 + x2/3 + rnorm(200))^2
f <- ols(sqrt(distance) ~ rcs(x1,4) + scored(x2) + x3, x=TRUE, y=TRUE)
#Validate full model fit (from all observations) but for x1 < .75
validate(f, B=20, subset=x1 < .75) # normally B=150
#Validate stepwise model with typical (not so good) stopping rule
validate(f, B=20, bw=TRUE, rule="p", sls=.1, type="individual")
./usr/lib/R/site-library/Design/help/validate.tree 0000644 0000000 0000000 00000010146 10763723645 020731 0 ustar root root validate.tree package:Design R Documentation
_D_x_y _a_n_d _M_e_a_n _S_q_u_a_r_e_d _E_r_r_o_r _b_y _C_r_o_s_s-_v_a_l_i_d_a_t_i_n_g _a _T_r_e_e _S_e_q_u_e_n_c_e
_D_e_s_c_r_i_p_t_i_o_n:
Uses 'xval'-fold cross-validation of a sequence of trees to derive
estimates of the mean squared error and Somers' 'Dxy' rank
correlation between predicted and observed responses. In the case
of a binary response variable, the mean squared error is the Brier
accuracy score. This function is a modification of 'cv.tree' which
should be consulted for details. There are 'print' and 'plot'
methods for objects created by 'validate.tree'.
_U_s_a_g_e:
# f <- tree(formula=y ~ x1 + x2 + ...) # or rpart
## S3 method for class 'tree':
validate(fit, method, B, bw, rule, type, sls, aics, pr=TRUE,
k, rand, xval=10, FUN, ...)
## S3 method for class 'rpart':
validate(fit, ...)
## S3 method for class 'validate.tree':
print(x, ...)
## S3 method for class 'validate.tree':
plot(x, what=c("mse","dxy"), legendloc=locator, ...)
_A_r_g_u_m_e_n_t_s:
fit: an object created by 'tree' or 'rpart' or having the same
attributes as one created by 'tree'. If it was created by
'rpart' you must have specified the 'model=TRUE' argument to
'rpart'.
method,B,bw,rule,type,sls,aics: are there only for consistency with the
generic 'validate' function; these are ignored
x: the result of 'validate.tree'
k: a sequence of cost/complexity values. By default these are
obtained from calling 'FUN' with no optional arguments (if
'tree') or from the 'rpart' 'cptable' object in the original
fit object. You may also specify a scalar or vector.
rand: see 'cv.tree'
xval: number of splits
FUN: the name of a function which produces a sequence of trees,
such as 'prune.tree' or 'shrink.tree' or 'prune.rpart'.
Default is 'prune.tree' for fits from 'tree' and
'prune.rpart' for fits from 'rpart'.
...: additional arguments to 'FUN' (ignored by 'print,plot'). For
'validate.rpart', ... can be the same arguments used in
'validate.tree'.
pr: set to 'FALSE' to prevent intermediate results for each 'k'
to be printed
what: a vector of things to plot. By default, 2 plots will be
done, one for 'mse' and one for 'Dxy'.
legendloc: a function that is evaluated with a single argument equal to
'1' to generate a list with components 'x, y' specifying
coordinates of the upper left corner of a legend, or a
2-vector. For the latter, 'legendloc' specifies the relative
fraction of the plot at which to center the legend.
_V_a_l_u_e:
a list of class '"validate.tree"' with components named 'k, size,
dxy.app', 'dxy.val, mse.app, mse.val, binary, xval'. 'size' is
the number of nodes, 'dxy' refers to Somers' 'D', 'mse' refers to
mean squared error of prediction, 'app' means apparent accuracy on
training samples, 'val' means validated accuracy on test samples,
'binary' is a logical variable indicating whether or not the
response variable was binary (a logical or 0/1 variable is
binary). 'size' will not be present if the user specifies 'k'.
_S_i_d_e _E_f_f_e_c_t_s:
prints if 'pr=TRUE'
_A_u_t_h_o_r(_s):
Frank Harrell
Department of Biostatistics
Vanderbilt University
f.harrell@vanderbilt.edu
_S_e_e _A_l_s_o:
'rpart', 'somers2', 'rcorr.cens', 'cv.tree', 'locator', 'legend'
_E_x_a_m_p_l_e_s:
## Not run:
n <- 100
set.seed(1)
x1 <- runif(n)
x2 <- runif(n)
x3 <- runif(n)
y <- 1*(x1+x2+rnorm(n) > 1)
table(y)
library(rpart)
f <- rpart(y ~ x1 + x2 + x3, model=TRUE)
v <- validate(f)
v # note the poor validation
par(mfrow=c(1,2))
plot(v, legendloc=c(.2,.5))
par(mfrow=c(1,1))
## End(Not run)
./usr/lib/R/site-library/Design/help/vif 0000644 0000000 0000000 00000002406 10763723645 016766 0 ustar root root vif package:Design R Documentation
_V_a_r_i_a_n_c_e _I_n_f_l_a_t_i_o_n _F_a_c_t_o_r_s
_D_e_s_c_r_i_p_t_i_o_n:
Computes variance inflation factors from the covariance matrix of
parameter estimates, using the method of Davis et al. (1986),
which is based on the correlation matrix from the information
matrix.
_U_s_a_g_e:
vif(fit)
_A_r_g_u_m_e_n_t_s:
fit: an object created by 'lrm', 'ols', 'psm', 'cph', or 'glm'
_V_a_l_u_e:
vector of vifs
_A_u_t_h_o_r(_s):
Frank Harrell
Department of Biostatistics
Vanderbilt University
f.harrell@vanderbilt.edu
_R_e_f_e_r_e_n_c_e_s:
Davis CE, Hyde JE, Bangdiwala SI, Nelson JJ: An example of
dependencies among variables in a conditional logistic
regression. In Modern Statistical Methods in Chronic Disease
Epidemiology, Eds SH Moolgavkar and RL Prentice, pp. 140-147. New
York: Wiley; 1986.
_S_e_e _A_l_s_o:
'Design.Misc' (for 'num.intercepts' and 'Varcov')
_E_x_a_m_p_l_e_s:
set.seed(1)
x1 <- rnorm(100)
x2 <- x1+.1*rnorm(100)
y <- sample(0:1, 100, TRUE)
f <- lrm(y ~ x1 + x2)
vif(f)
./usr/lib/R/site-library/Design/help/which.influence 0000644 0000000 0000000 00000005230 10763723645 021251 0 ustar root root which.influence package:Design R Documentation
_W_h_i_c_h _O_b_s_e_r_v_a_t_i_o_n_s _a_r_e _I_n_f_l_u_e_n_t_i_a_l
_D_e_s_c_r_i_p_t_i_o_n:
Creates a list with a component for each factor in the model. The
names of the components are the factor names. Each component
contains the observation identifiers of all observations that are
"overly influential" with respect to that factor, meaning that
|dfbetas| > u for at least one beta i associated with that factor,
for a given 'cutoff'. The default 'cutoff' is '.2'. The fit must
come from a function that has 'resid(fit, type="dfbetas")'
defined.
'show.influence', written by Jens Oehlschlaegel-Akiyoshi, applies
the result of 'which.influence' to a data frame, usually the one
used to fit the model, to report the results.
_U_s_a_g_e:
which.influence(fit, cutoff=.2)
show.influence(object, dframe, report=NULL, sig=NULL, id=NULL)
_A_r_g_u_m_e_n_t_s:
fit: fit object
object: the result of 'which.influence'
dframe: data frame containing observations pertinent to the model fit
cutoff: cutoff value
report: other columns of the data frame to report besides those
corresponding to predictors that are influential for some
observations
sig: runs results through 'signif' with 'sig' digits if 'sig' is
given
id: a character vector that labels rows of 'dframe' if
'row.names' were not used
_V_a_l_u_e:
'show.influence' returns a marked dataframe with the first column
being a count of influence values
_A_u_t_h_o_r(_s):
Frank Harrell
Department of Biostatistics, Vanderbilt University
f.harrell@vanderbilt.edu
Jens Oehlschlaegel-Akiyoshi
Center for Psychotherapy Research
Christian-Belser-Strasse 79a
D-70597 Stuttgart Germany
oehl@psyres-stuttgart.de
_S_e_e _A_l_s_o:
'residuals.lrm', 'residuals.cph', 'residuals.ols', 'Design',
'lrm', 'ols', 'cph'
_E_x_a_m_p_l_e_s:
#print observations in data frame that are influential,
#separately for each factor in the model
x1 <- 1:20
x2 <- abs(x1-10)
x3 <- factor(rep(0:2,length.out=20))
y <- c(rep(0:1,8),1,1,1,1)
f <- lrm(y ~ rcs(x1,3) + x2 + x3, x=TRUE,y=TRUE)
w <- which.influence(f, .55)
nam <- names(w)
d <- data.frame(x1,x2,x3,y)
for(i in 1:length(nam)) {
print(paste("Influential observations for effect of ",nam[i]),quote=FALSE)
print(d[w[[i]],])
}
show.influence(w, d) # better way to show results
./usr/lib/R/site-library/Design/html/ 0000755 0000000 0000000 00000000000 10763723645 016271 5 ustar root root ./usr/lib/R/site-library/Design/html/00Index.html 0000644 0000000 0000000 00000057031 10763723522 020366 0 ustar root root
R: Design Package
Design Package ![[R logo]](../../../doc/html/logo.jpg)
Documentation for package ‘Design’ version 2.1-1
Help Pages
A
B
C
D
E
F
G
H
I
L
M
N
O
P
Q
R
S
T
U
V
W