forsearch_lme {forsearch} | R Documentation |
Create Statistics Of Forward Search For a Linear Mixed Effects Database
Description
Prepares summary statistics at each stage of forward search for subsequent plotting. Forward search is conducted in four steps: Step 0 to set up accounting for group structure, Step 1 to identify minimal set of observations to estimate unknown fixed parameters, Step 2 to identify the order of the remaining observations, and a final stage to extract the intermediate statistics based on increasing sample size.
Usage
forsearch_lme(fixedform, alldata, randomform, initial.sample=1000, n.obs.per.level=1,
skip.step1=NULL, unblinded=TRUE, begin.diagnose = 100, verbose = TRUE)
Arguments
fixedform |
2-sided formula for fixed effects |
alldata |
data frame, first column of which must be "Observation" |
randomform |
1-sided formula for random effects |
initial.sample |
Number of observations in Step 1 of forward search |
n.obs.per.level |
Number of observations per level of (possibly crossed) factor levels |
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 indicator of place in coding to begin printing diagnostic information. 0 prints all information, 100 prints none. |
verbose |
TRUE causes function identifier to display before and after run |
Details
data will be grouped within the function, regardless of initial layout. Step 2 is determined by the results of Step 1, which itself is random. So, it is possible to reproduce the entire run by using the skip.step1 argument. Variables in the randomform formula must be character variables, but *not* factors
Value
LIST
Number of observations in Step 1 |
Number of observations included in Step 1 |
Step 1 observation numbers |
Observation numbers useful in skipping step 1 |
Rows by outer subgroup |
List of row numbers, by outer subgroup |
Rows by outer-inner subgroups |
List of row numbers, by outer-inner subgroup |
Rows in stage |
Observation numbers of rows included at each stage |
Sigma |
Estimate of random error at final stage; used to standardize all residuals |
Standardized residuals |
Matrix of errors at each stage |
Fixed parameter estimates |
Matrix of parameter estimates at each stage |
Random parameter estimates |
Matrix of parameter estimates 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 |
Dims |
Dims from fit of lme function |
t statistics |
t statistics for each fixed parameter |
Fit statistics |
AIC, BIC, and log likelihood |
Call |
Call to this function |
Author(s)
William R. Fairweather
References
Atkinson, A and M Riani. Robust Diagnostic Regression Analysis, Springer, New York, 2000. Pinheiro, JC and DM Bates. Mixed-Effects Models in S and S-Plus, Springer, New York, 2000. https://CRAN.R-project.org/package=nlme
Examples
# Multiple regression in grouped data
Observation <- 1:16
y <- runif(16)
x1 <- runif(16)
x2 <- runif(16)
x3 <- runif(16)
group <- as.factor(rep(c("G1","G2"),each=8))
lmetest1 <- data.frame(Observation,y,x1,x2,x3,group)
forsearch_lme(fixedform=y~x1+x2+x3, alldata=lmetest1, randomform= ~1|group,
n.obs.per.level=1, initial.sample=200)
## Not run:
# Analysis of variance in grouped data
Observation <- 1:60
y <- runif(60)
AN1 <- as.factor(c(rep("A1",5),rep("A2",5),rep("A3",5)))
AN1 <- c(AN1,AN1,AN1,AN1)
AN2 <- as.factor(c(rep("B1",15),rep("B2",15)))
AN2 <- c(AN2,AN2)
group <- as.factor(rep(c("G1","G2"),each=30))
lmetest2 <- data.frame(Observation,y,AN1,AN2,group)
forsearch_lme(fixedform=y~AN1*AN2, alldata=lmetest2, randomform= ~1|group,
initial.sample=500)
# Analysis of covariance in grouped data
Observation <- 1:120
y <- runif(120)
AN1 <- as.factor(c(rep("A1",10),rep("A2",10),rep("A3",10)))
AN1 <- c(AN1,AN1,AN1,AN1)
AN2 <- as.factor(c(rep("B1",10),rep("B2",10)))
AN2 <- c(AN2,AN2,AN2,AN2,AN2,AN2)
COV <- runif(120)
group <- as.factor(rep(c("G1","G2"),each=30))
group <- c(group,group)
lmetest3 <- data.frame(Observation,y,AN1,AN2,COV,group)
forsearch_lme(fixedform=y~AN1*AN2+COV, alldata=lmetest3, randomform= ~ 1 | group,
initial.sample=500)
## End(Not run)