HierAFS: RSM forward regression keeping model hierarchy

Description Usage Arguments Value Author(s) Examples

View source: R/HierAFS.R

Description

This function performs a hierarchical forward stepwise regression. If an interaction or quadratic term is entered in the model, the parent main effects are also entered into the model.

Usage

1
HierAFS(y,x,m,c,step) 

Arguments

y

input - this is a vector containing a single numeric column of response data.

x

input - this is a data frame containing the numeric columns of the candidate independent variables. The m three-level factors always preceed the c two-level factors in the design. The factor names or colnames(x) should always be of length (for example letters of the alphabet "A", "B", etc.)

m

input - this is an integer equal to the number of three-level factors in the design

c

input - this is an integer equal to the number of two-level factors in the design. Note m+c must be equal to the number of columns of des.

step

input - this is a single numeric value containing the n umber of steps requested.

Value

returned data frame the first column is a factor variable containing the formula for the model fit at each step, the second numeric column is the R-square statistic for the model fit with each formula.

Author(s)

Gerhard Krennrich, and modified by John Lawson

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#Definitive Screening Design
library(daewr)
set.seed(1234)
x <- DefScreen(m=5,c=0)
x$y <- 3*x$A + 2*x$B + 3*x$A*x$B + 2*x$A^2 + 2*x$C+rnorm(nrow(x),0,.5) 
HierAFS(x$y,x[,-6],m=5,c=0,step=3)
# Alternate Screening Example
library(daewr)
Design<-Altscreen(nfac=6,randomize=FALSE)
Thickness<-c(4494,4592,4357,4489,4513,4483,4288,4448,4691,4671,4219,4271,4530,4632,4337,4391)
HierAFS(Thickness,Design,m=0,c=6,step=3)

Example output

Registered S3 method overwritten by 'DoE.base':
  method           from       
  factorize.factor conf.design
             formula    R2
1          y~A+B+A:B 0.871
2        y~C+A+B+A:B 0.955
3 y~I(A^2)+A+C+B+A:B 0.998
        formula    R2
1           y~A 0.660
2         y~B+A 0.791
3 y~C+E+C:E+B+A 0.953

daewr documentation built on March 13, 2021, 3:01 a.m.