Description Usage Arguments Author(s) Examples
This function makes a colormap of the correlations of a design matrix stored in the data frame design
1 |
design |
input - a data frame containing columns of the numeric factor levels |
mod |
input - a number indicationg the model for the colormap 1 = linear model containing only the terms in the dataframe 2 = linear model plus two factor interactions 3 = linear model plus 2 and 3 factor interactions 4 = linear model plus 2, 3, and 4 factor interactions |
John Lawson
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # color map of 2^(4-1) design
library(FrF2)
design <- FrF2(8, 4, randomize = FALSE)
colormap(design, mod=3)
# Makes color map for saturated 2^(7-4) design in Figure 6.14 p. 197
library(FrF2)
design <-FrF2( 8, 7)
colormap(design, mod=2)
# Makes colormap of an Alternate Screening Design
library(daewr)
ascr<-Altscreen(7)
colormap(ascr, mod=2)
# Makes colormap of a Model Robust Design
library(daewr)
MR16 <- ModelRobust('MR16m7g5', randomize = FALSE)
colormap(MR16, mod=2)
## The function is currently defined as
function(design,mod) {
##################### Inputs ###########################################
# design - a data frame containing columns of the numeric factor levels
# mod - the model for the color plot of correlations
# 1 = Linear model containing only the terms in the data frame
# 2 = Linear model plus two factor interactions
# 3 = Linear model plus 2 and 3 factor interactions
# 4 = Linear model plus 2, 3 and 4 factor interactions
########################################################################
y<-runif(nrow(design),0,1)
if(mod==1) {test <- model.matrix(lm(y~(.),data=design))}
if(mod==2) {test <- model.matrix(lm(y~(.)^2,data=design))}
if(mod==3) {test <- model.matrix(lm(y~(.)^3,data=design))}
if(mod==4) {test <- model.matrix(lm(y~(.)^4,data=design))}
names<-colnames(test)
names<-gsub(':','',names)
names<-gsub('1','',names)
colnames(test)<-names
cmas<-abs(cor(test[,ncol(test):2]))
cmas<-cmas[c((ncol(cmas)):1), ]
rgb.palette <- colorRampPalette(c("white", "black"), space = "rgb")
levelplot(cmas, main="Map of absolute correlations", xlab="", ylab="", col.regions=rgb.palette(120),
cuts=100, at=seq(0,1,0.01),scales=list(x=list(rot=90))) }
|
Loading required package: DoE.base
Loading required package: grid
Loading required package: conf.design
Attaching package: 'DoE.base'
The following objects are masked from 'package:stats':
aov, lm
The following object is masked from 'package:graphics':
plot.design
The following object is masked from 'package:base':
lengths
sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
function (design, mod)
{
y <- runif(nrow(design), 0, 1)
if (mod == 1) {
test <- model.matrix(lm(y ~ (.), data = design))
}
if (mod == 2) {
test <- model.matrix(lm(y ~ (.)^2, data = design))
}
if (mod == 3) {
test <- model.matrix(lm(y ~ (.)^3, data = design))
}
if (mod == 4) {
test <- model.matrix(lm(y ~ (.)^4, data = design))
}
names <- colnames(test)
names <- gsub(":", "", names)
names <- gsub("1", "", names)
colnames(test) <- names
cmas <- abs(cor(test[, ncol(test):2]))
cmas <- cmas[c((ncol(cmas)):1), ]
rgb.palette <- colorRampPalette(c("white", "black"), space = "rgb")
levelplot(cmas, main = "Map of absolute correlations", xlab = "",
ylab = "", col.regions = rgb.palette(120), cuts = 100,
at = seq(0, 1, 0.01), scales = list(x = list(rot = 90)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.