forsearch_lm | R Documentation |
Prepares summary statistics at each stage of forward search for subsequent plotting. Forward search is conducted in two steps: Step 1 to identify minimal set of observations to estimate unknown parameters, and Step 2 to add one observation at each stage such that observations in the set are best fitting at that stage.
forsearch_lm(formula, nofactform, data, initial.sample=1000,
skip.step1 = NULL, unblinded = TRUE, begin.diagnose = 100,
verbose = TRUE)
formula |
Fixed effects formula as described in help(lm). The only permitted operators are +, : , and * . Terms must be found in data or as constructed by I(xxx) where xxx is found in data |
nofactform |
2-sided formula omitting all factors |
data |
Name of database |
initial.sample |
Number of observations in Step 1 of forward search |
skip.step1 |
NULL or a vector of integers for observations to be included in Step 1 |
unblinded |
TRUE causes printing of presumed analysis structure |
begin.diagnose |
Numeric. Indicates where in code to begin printing diagnostics. 0 prints all; 100 prints none |
verbose |
TRUE causes function identifier to display before and after run |
LIST
Rows in stage |
Observation numbers of rows included at each stage |
Standardized residuals |
Matrix of errors at each stage |
Number of model parameters |
Rank of model |
Sigma |
Estimate of random error at final stage; used to standardize all residuals |
Fixed parameter estimates |
Vector of parameter estimates at each stage |
s^2 |
Estimate of random error at each stage |
Leverage |
Matrix of leverage of each observation at each stage |
Modified Cook distance |
Estimate of sum of squared changes in parameter estimates at each stage |
Call |
Call to this function |
William R. Fairweather
Atkinson, A and M Riani. Robust Diagnostic Regression Analysis, Springer, New York, 2000.
## Not run:
# Multiple regression
Observation <- 1:16
y <- runif(16)
x1 <- runif(16)
x2 <- runif(16)
x3 <- runif(16)
lmtest1 <- data.frame(Observation,y,x1,x2,x3)
test1 <- forsearch_lm(formula=y~x1+x2+x3, nofactform=y~x1+x2+x3, data=lmtest1,
initial.sample=200,begin.diagnose=100)
# Analysis of variance
Observation <- 1:30
y <- runif(30)
AN1 <- as.factor(c(rep("A1",5),rep("A2",5),rep("A3",5)))
AN1 <- c(AN1,AN1)
AN2 <- as.factor(c(rep("B1",15),rep("B2",15)))
lmtest2 <- data.frame(Observation,y,AN1,AN2)
test2 <- forsearch_lm(formula=y~AN1*AN2, nofactform=y~1, data=lmtest2,
initial.sample=200, begin.diagnose=100)
# Analysis of covariance
Observation <- 1:60
y <- runif(60)
AN1 <- as.factor(c(rep("A1",10),rep("A2",10),rep("A3",10)))
AN1 <- c(AN1,AN1)
AN2 <- as.factor(c(rep("B1",30),rep("B2",30)))
COV <- runif(60)
lmtest3 <- data.frame(Observation,y,AN1,AN2,COV)
test3 <- forsearch_lm(formula=y~AN1*AN2+COV, nofactform=y~COV, data=lmtest3,
initial.sample=200,begin.diagnose=100)
# Polynomial regression
C1 <- 7*runif(60) + 1
y <- 4 + C1 - 6*C1^2 + 9*C1^3 + rnorm(60)
Observation <- 1:60
dfpoly <- data.frame(Observation,C1,y)
test4 <- forsearch_lm(formula = y ~ C1 + I(C1^2) + I(C1^3), data = dfpoly,
nofactform=y ~ C1 + I(C1^2) + I(C1^3),initial.sample = 200,
begin.diagnose=100)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.