R Under development (unstable) (2023-11-13 r85520 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > require(DoE.base) Loading required package: DoE.base Loading required package: grid Loading required package: conf.design Registered S3 method overwritten by 'DoE.base': method from factorize.factor 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 > > set.seed(12445) > > ## NA > plan1 <- fac.design(4,nlevels=2) creating full factorial with 16 runs ... > lm(rnorm(16)~., plan1) Call: lm.default(formula = rnorm(16) ~ ., data = plan1) Coefficients: (Intercept) A1 B1 C1 D1 -0.11740 -0.08133 -0.28827 -0.03103 -0.12843 > > plan2 <- oa.design(nlevels=c(2,6,2)) > lm(rnorm(12)~., plan2) Call: lm.default(formula = rnorm(12) ~ ., data = plan2) Coefficients: (Intercept) A1 B.L B.Q B.C B^4 -0.2449 -0.2228 0.2518 0.2710 0.5159 0.1192 B^5 C1 -0.2398 0.1565 > > ### NA to quantitative > quantplan1 <- qua.design(plan1, quantitative="all") > lm(rnorm(16)~., quantplan1) Call: lm.default(formula = rnorm(16) ~ ., data = quantplan1) Coefficients: (Intercept) A B C D 1.3742 0.5702 -0.2762 -0.9142 -0.3722 > > quantplan2 <- qua.design(plan2, quantitative="all") > lm(rnorm(12)~., quantplan2) Call: lm.default(formula = rnorm(12) ~ ., data = quantplan2) Coefficients: (Intercept) A B C -2.23470 0.42525 0.01226 1.12207 > > ### NA to qualitative, no contrasts given > ### (does not change anything) > qualplan1 <- qua.design(plan1, quantitative="none") > lm(rnorm(16)~., qualplan1) Call: lm.default(formula = rnorm(16) ~ ., data = qualplan1) Coefficients: (Intercept) A1 B1 C1 D1 0.4206 -0.1961 0.2109 0.0421 -0.3669 > > qualplan2 <- qua.design(plan2, quantitative="none") > lm(rnorm(12)~., qualplan2) Call: lm.default(formula = rnorm(12) ~ ., data = qualplan2) Coefficients: (Intercept) A1 B.L B.Q B.C B^4 0.4318 -0.2860 -0.2512 -0.5228 -0.1567 -0.1318 B^5 C1 -0.1644 -0.1849 > > ### quantitative to qualitative, no contrasts given > qualplan1 <- qua.design(quantplan1, quantitative="none") > lm(rnorm(16)~., qualplan1) Call: lm.default(formula = rnorm(16) ~ ., data = qualplan1) Coefficients: (Intercept) A1 B1 C1 D1 0.08637 -0.08877 -0.12604 0.06130 0.09677 > > qualplan2 <- qua.design(quantplan2, quantitative="none") > lm(rnorm(12)~., qualplan2) Call: lm.default(formula = rnorm(12) ~ ., data = qualplan2) Coefficients: (Intercept) A1 B.L B.Q B.C B^4 0.17733 0.32924 -0.58679 0.30097 0.09089 1.83673 B^5 C1 -1.14949 -0.28709 > > ### quantitative to NA, no contrasts given > qualplan1 <- qua.design(quantplan1, quantitative=NA) > lm(rnorm(16)~., qualplan1) Call: lm.default(formula = rnorm(16) ~ ., data = qualplan1) Coefficients: (Intercept) A1 B1 C1 D1 0.4828 -0.1930 0.2588 0.2847 -0.1807 > > qualplan2 <- qua.design(quantplan2, quantitative=NA) > lm(rnorm(12)~., qualplan2) Call: lm.default(formula = rnorm(12) ~ ., data = qualplan2) Coefficients: (Intercept) A1 B.L B.Q B.C B^4 0.15458 0.08519 -0.53518 -0.50471 0.26082 0.61298 B^5 C1 -1.37019 0.03103 > > ### quantitative to NA, contrasts given > ### contrasts are ignored > qualplan1 <- qua.design(quantplan1, quantitative=NA, contrasts=c(B="contr.treatment")) > lm(rnorm(16)~., qualplan1) Call: lm.default(formula = rnorm(16) ~ ., data = qualplan1) Coefficients: (Intercept) A1 B1 C1 D1 -0.13264 0.09860 -0.07119 0.23841 -0.28915 > > qualplan2 <- qua.design(quantplan2, quantitative=NA, contrasts=c(B="contr.treatment")) > lm(rnorm(12)~., qualplan2) Call: lm.default(formula = rnorm(12) ~ ., data = qualplan2) Coefficients: (Intercept) A1 B.L B.Q B.C B^4 -0.25699 -0.22455 -1.18618 0.35592 0.15653 -0.23783 B^5 C1 -0.02433 0.38949 > > ### NA to qualitative, contrasts given > qualplan1 <- qua.design(plan1, quantitative="none", contrasts=c(B="contr.treatment")) > lm(rnorm(16)~., qualplan1) Call: lm.default(formula = rnorm(16) ~ ., data = qualplan1) Coefficients: (Intercept) A1 B2 C1 D1 -0.20253 -0.15904 0.22433 -0.06183 0.34642 > > qualplan2 <- qua.design(plan2, quantitative="none", contrasts=c(B="contr.treatment")) > lm(rnorm(12)~., qualplan2) Call: lm.default(formula = rnorm(12) ~ ., data = qualplan2) Coefficients: (Intercept) A1 B2 B3 B4 B5 0.1342 0.2872 -0.2177 -0.4469 0.1863 -1.1298 B6 C1 0.0877 0.4213 > > ### quantitative to qualitative, contrasts given > qualplan1 <- qua.design(quantplan1, quantitative="none", contrasts=c(B="contr.treatment")) > lm(rnorm(16)~., qualplan1) Call: lm.default(formula = rnorm(16) ~ ., data = qualplan1) Coefficients: (Intercept) A1 B2 C1 D1 -0.29378 0.08827 0.51176 0.21541 0.38188 > > qualplan2 <- qua.design(quantplan2, quantitative="none", contrasts=c(B="contr.treatment")) > lm(rnorm(12)~., qualplan2) Call: lm.default(formula = rnorm(12) ~ ., data = qualplan2) Coefficients: (Intercept) A1 B2 B3 B4 B5 0.3614 0.0620 -0.7152 0.1557 -0.8698 -1.2646 B6 C1 -0.8600 0.1265 > > plan3 <- oa.design(factor.names=list(X=c(1,2),Y=c(1,2),Z=c(1,2)), ID=L4.2.3) > desnum(qua.design(qua.design(cross.design(plan1,plan3),quantitative="all"))) A1 B1 C1 D1 X1 Y1 Z1 54 1 1 1 -1 1 1 -1 50 -1 -1 -1 -1 1 1 -1 11 -1 1 1 1 -1 1 1 13 -1 -1 -1 1 1 -1 1 34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1 -1 1 44 1 1 -1 1 -1 -1 -1 30 -1 1 -1 -1 1 1 -1 17 -1 -1 1 -1 1 -1 1 46 1 -1 -1 1 1 1 -1 24 -1 1 1 -1 -1 -1 -1 29 -1 1 -1 -1 1 -1 1 23 -1 1 1 -1 -1 1 1 > > desnum(change.contr(quantplan1, "contr.helmert")) A1 B1 C1 D1 1 1 1 -1 -1 2 -1 1 -1 1 3 -1 1 1 1 4 -1 -1 -1 1 5 -1 -1 1 -1 6 -1 1 1 -1 7 1 -1 1 1 8 -1 1 -1 -1 9 1 -1 -1 -1 10 -1 -1 1 1 11 1 1 -1 1 12 1 -1 -1 1 13 -1 -1 -1 -1 14 1 1 1 -1 15 1 1 1 1 16 1 -1 1 -1 > desnum(change.contr(quantplan2, "contr.helmert")) A1 B1 B2 B3 B4 B5 C1 1 -1 0 2 -1 -1 -1 -1 2 1 0 0 3 -1 -1 -1 3 1 0 0 0 4 -1 1 4 1 -1 -1 -1 -1 -1 1 5 1 1 -1 -1 -1 -1 -1 6 1 0 0 0 0 5 -1 7 -1 1 -1 -1 -1 -1 1 8 -1 -1 -1 -1 -1 -1 -1 9 1 0 2 -1 -1 -1 1 10 -1 0 0 0 0 5 1 11 -1 0 0 3 -1 -1 1 12 -1 0 0 0 4 -1 -1 > > proc.time() user system elapsed 0.53 0.15 0.68