Title: | R6-Based Statistical Methods for Quality Science |
---|---|
Description: | A comprehensive suite of statistical tools for Quality Management, designed around the Define, Measure, Analyze, Improve, and Control (DMAIC) cycle used in Six Sigma methodology. Based on the discontinued CRAN package 'qualitytools', this package refactors its original design by incorporating 'R6' object-oriented programming for increased flexibility and performance. It replaces traditional graphics with modern, interactive visualizations using 'ggplot2' and 'plotly'. Built on 'tidyverse' principles, it simplifies data manipulation and visualization, offering an intuitive approach to quality science. |
Authors: | Andrea Barahona [aut], Fabian Encarnacion [aut, cre, cph], Miguel Flores [aut], Javier Tarrio-Saavedra [ctb], Salvador Naya [ctb] |
Maintainer: | Fabian Encarnacion <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.1.9000 |
Built: | 2025-03-03 05:19:16 UTC |
Source: | https://github.com/fabianenc/r6qualitytools |
Performs the Anderson-Darling test for univariate distributions with an option for bootstrap-based p-value determination. It also allows p-value determination using tabled critical values.
adSim(x, distribution = "normal", b = 10000)
adSim(x, distribution = "normal", b = 10000)
x |
A numeric vector. |
distribution |
A character string specifying the distribution to test. Recognized distributions include |
b |
A numeric value indicating the number of bootstraps to perform. Allowed values range from 1000 to 1,000,000. If |
The function first estimates the parameters for the tested distribution, typically using Maximum-Likelihood Estimation (MLE) via the FitDistr
function. For normal and log-normal distributions, parameters are estimated by the mean and standard deviation. Cauchy distribution parameters are fitted by the sums of the weighted order statistic when using tabled critical values. The Anderson-Darling statistic is then calculated based on these estimated parameters.
Parametric bootstrapping generates the distribution of the Anderson-Darling test statistic, which is used to determine the p-value. This simulation-based Anderson-Darling distribution and its corresponding critical values for selected quantiles can be printed. If simulation is not performed, a p-value is obtained from tabled critical values, although no exact expressions exist except for the log-normal, normal, and exponential distributions.
A list containing the following components:
distribution
The distribution for which the Anderson-Darling test was applied.
parameter_estimation
The estimated parameters for the distribution.
Anderson_Darling
The value of the Anderson-Darling test statistic.
p_value
The corresponding p-value, either simulated or from tabled values.
critical_values
The critical values corresponding to the 0.75, 0.90, 0.95, 0.975, and 0.99 quantiles, either simulated or from tables.
simAD
The bootstrap-based Anderson-Darling distribution.
x <- rnorm(25, 32, 2) adSim(x) adSim(x, "logistic", 2000) adSim(x, "cauchy", NA) adSim(x, "exponential", 2000) adSim(x, "gumbel", 2000)
x <- rnorm(25, 32, 2) adSim(x) adSim(x, "logistic", 2000) adSim(x, "cauchy", NA) adSim(x, "exponential", 2000) adSim(x, "gumbel", 2000)
This function generates an alias table for a factorial design object.
aliasTable(fdo, degree, print = TRUE)
aliasTable(fdo, degree, print = TRUE)
fdo |
An object of class |
degree |
Numeric value specifying the degree of interaction i.e. degree=3 means up to threeway interactions. |
print |
If |
The function aliasTable
returns a matrix indicating the aliased effects.
# Create a fractional factorial design dfrac <- fracDesign(k = 3, gen = "C = AB") # Display the alias table for the fractional factorial design aliasTable(dfrac)
# Create a fractional factorial design dfrac <- fracDesign(k = 3, gen = "C = AB") # Display the alias table for the fractional factorial design aliasTable(dfrac)
Converts an object of class facDesign.c
into a data frame.
as.data.frame_facDesign(dfac)
as.data.frame_facDesign(dfac)
dfac |
An object of class |
The function as.data.frame_facDesign
returns a data frame.
fdo <- fracDesign(k = 2, replicates = 3, centerCube = 4) as.data.frame_facDesign(fdo)
fdo <- fracDesign(k = 2, replicates = 3, centerCube = 4) as.data.frame_facDesign(fdo)
Blocks a given factorial or response surface design.
blocking(fdo, blocks, random.seed, useTable = "rsm", gen)
blocking(fdo, blocks, random.seed, useTable = "rsm", gen)
fdo |
An object of class |
blocks |
Numeric value giving the number of blocks. |
random.seed |
Numeric value to generate repeatable results for randomization within blocks. |
useTable |
Character indicating which table to use. The following options will be accepted:
|
gen |
Giving the generator that will be used. |
The function blocking
returns an object of class facDesign.c
with blocking structure.
# Example 1 #Create a 2^3 full factorial design fdo <- facDesign(k = 3) # Apply blocking to the design with 2 blocks blocking(fdo, 2) # Example 2 #Create a response surface design for 3 factors fdo <- rsmDesign(k = 3) # Apply blocking to the design with 3 blocks (1 block for star part and 2 blocks for the cube part) blocking(fdo, 3)
# Example 1 #Create a 2^3 full factorial design fdo <- facDesign(k = 3) # Apply blocking to the design with 2 blocks blocking(fdo, 2) # Example 2 #Create a response surface design for 3 factors fdo <- rsmDesign(k = 3) # Apply blocking to the design with 3 blocks (1 block for star part and 2 blocks for the cube part) blocking(fdo, 3)
Function visualize the given values of measurement in a run chart and in a histogram. Furthermore the centralized Gage potential index
Cg
and the non-centralized Gage Capability index
Cgk
are calculated and displayed.
cg( x, target, tolerance, ref.interval, facCg, facCgk, n = 0.2, col, pch, xlim, ylim, conf.level = 0.95 )
cg( x, target, tolerance, ref.interval, facCg, facCgk, n = 0.2, col, pch, xlim, ylim, conf.level = 0.95 )
x |
A vector containing the measured values. |
target |
A numeric value giving the expected target value for the x-values. |
tolerance |
Vector of length 2 giving the lower and upper specification limits. |
ref.interval |
Numeric value giving the confidence interval on which the calculation is based. By default it is based on 6 sigma methodology.
Regarding the normal distribution this relates to |
facCg |
Numeric value as a factor for the calculation of the gage potential index. The default value for |
facCgk |
Numeric value as a factor for the calculation of the gage capability index. The default value for |
n |
Numeric value between |
col |
Character or numeric value specifying the color of the curve in the run chart. Default is |
pch |
Numeric or character specifying the plotting symbol. Default is |
xlim |
Numeric vector of length 2 specifying the limits for the x-axis. Default is |
ylim |
Numeric vector of length 2 specifying the limits for the y-axis. Default is |
conf.level |
Confidence level for internal |
The calculation of the potential and actual gage capability are based on the following formula:
Cg = (facCg * tolerance[2]-tolerance[1])/ref.interval
Cgk = (facCgk * abs(target-mean(x))/(ref.interval/2)
If the usage of the historical process variation is preferred the values for the tolerance tolerance
must be adjusted manually. That means in case of the 6 sigma methodology for example, that tolerance = 6 * sigma[process]
.
The function cg
returns a list of numeric values. The first element contains the calculated centralized gage potential index Cg
and the second contains the non-centralized gage capability index Cgk
.
cg_RunChart
, cg_HistChart
, cg_ToleranceChart
.
x <- c(9.991, 10.013, 10.001, 10.007, 10.010, 10.013, 10.008,9.992, 10.017, 10.005, 10.005, 10.002, 10.017, 10.005, 10.002, 9.996, 10.011, 10.009, 10.006, 10.008, 10.003, 10.002, 10.006, 10.010, 10.013) cg(x = x, target = 10.003, tolerance = c(9.903, 10.103))
x <- c(9.991, 10.013, 10.001, 10.007, 10.010, 10.013, 10.008,9.992, 10.017, 10.005, 10.005, 10.002, 10.017, 10.005, 10.002, 9.996, 10.011, 10.009, 10.006, 10.008, 10.003, 10.002, 10.006, 10.010, 10.013) cg(x = x, target = 10.003, tolerance = c(9.903, 10.103))
Function visualize the given values of measurement in a histogram
cg_HistChart( x, target, tolerance, ref.interval, facCg, facCgk, n = 0.2, col, xlim, ylim, main, conf.level = 0.95, cgOut = TRUE )
cg_HistChart( x, target, tolerance, ref.interval, facCg, facCgk, n = 0.2, col, xlim, ylim, main, conf.level = 0.95, cgOut = TRUE )
x |
A vector containing the measured values. |
target |
A numeric value giving the expected target value for the x-values. |
tolerance |
Vector of length 2 giving the lower and upper specification limits. |
ref.interval |
Numeric value giving the confidence interval on which the calculation is based. By default it is based on 6 sigma methodology.
Regarding the normal distribution this relates to |
facCg |
Numeric value as a factor for the calculation of the gage potential index. The default Value for |
facCgk |
Numeric value as a factor for the calculation of the gage capability index. The default value for |
n |
Numeric value between |
col |
Character or numeric value specifying the color of the histogram. Default is |
xlim |
Numeric vector of length 2 specifying the limits for the x-axis. Default is |
ylim |
Numeric vector of length 2 specifying the limits for the y-axis. Default is |
main |
Character string specifying the title of the plot. Default is |
conf.level |
Confidence level for internal |
cgOut |
Logical value deciding whether the |
The calculation of the potential and actual gage capability are based on the following formulae:
Cg = (facCg * tolerance[2]-tolerance[1])/ref.interval
Cgk = (facCgk * abs(target-mean(x))/(ref.interval/2)
If the usage of the historical process variation is preferred the values for the tolerance tolerance
must be adjusted manually. That means in case of the 6 sigma methodology for example, that tolerance = 6 * sigma[process]
.
The function cg_HistChart
returns a list of numeric values. The first element contains the calculated centralized gage potential index Cg
and the second contains the non-centralized gage capability index Cgk
.
cg_RunChart
, cg_ToleranceChart
, cg
x <- c(9.991, 10.013, 10.001, 10.007, 10.010, 10.013, 10.008,9.992, 10.017, 10.005, 10.005, 10.002, 10.017, 10.005, 10.002, 9.996, 10.011, 10.009, 10.006, 10.008, 10.003, 10.002, 10.006, 10.010, 10.013) cg_HistChart(x = x, target = 10.003, tolerance = c(9.903, 10.103))
x <- c(9.991, 10.013, 10.001, 10.007, 10.010, 10.013, 10.008,9.992, 10.017, 10.005, 10.005, 10.002, 10.017, 10.005, 10.002, 9.996, 10.011, 10.009, 10.006, 10.008, 10.003, 10.002, 10.006, 10.010, 10.013) cg_HistChart(x = x, target = 10.003, tolerance = c(9.903, 10.103))
Function visualize the given values of measurement in a Run Chart
cg_RunChart( x, target, tolerance, ref.interval, facCg, facCgk, n = 0.2, col = "black", pch = 19, xlim = NULL, ylim = NULL, main = "Run Chart", conf.level = 0.95, cgOut = TRUE )
cg_RunChart( x, target, tolerance, ref.interval, facCg, facCgk, n = 0.2, col = "black", pch = 19, xlim = NULL, ylim = NULL, main = "Run Chart", conf.level = 0.95, cgOut = TRUE )
x |
A vector containing the measured values. |
target |
A numeric value giving the expected target value for the x-values. |
tolerance |
Vector of length 2 giving the lower and upper specification limits. |
ref.interval |
Numeric value giving the confidence interval on which the calculation is based. By default it is based on 6 sigma methodology.
Regarding the normal distribution this relates to |
facCg |
Numeric value as a factor for the calculation of the gage potential index. The default Value for |
facCgk |
Numeric value as a factor for the calculation of the gage capability index. The default value for |
n |
Numeric value between |
col |
Character or numeric value specifying the color of the curve in the run chart. Default is |
pch |
Numeric or character specifying the plotting symbol. Default is |
xlim |
Numeric vector of length 2 specifying the limits for the x-axis. Default is |
ylim |
Numeric vector of length 2 specifying the limits for the y-axis. Default is |
main |
Character string specifying the title of the plot. Default is |
conf.level |
Confidence level for internal |
cgOut |
Logical value deciding whether the |
The calculation of the potential and actual gage capability are based on the following formulae:
Cg = (facCg * tolerance[2]-tolerance[1])/ref.interval
Cgk = (facCgk * abs(target-mean(x))/(ref.interval/2)
If the usage of the historical process variation is preferred the values for the tolerance tolerance
must be adjusted manually. That means in case of the 6 sigma methodology for example, that tolerance = 6 * sigma[process]
.
The function cg_RunChart
returns a list of numeric values. The first element contains the calculated centralized gage potential index Cg
and the second contains the non-centralized gage capability index Cgk
.
cg_HistChart
, cg_ToleranceChart
, cg
x <- c(9.991, 10.013, 10.001, 10.007, 10.010, 10.013, 10.008,9.992, 10.017, 10.005, 10.005, 10.002, 10.017, 10.005, 10.002, 9.996, 10.011, 10.009, 10.006, 10.008, 10.003, 10.002, 10.006, 10.010, 10.013) cg_RunChart(x = x, target = 10.003, tolerance = c(9.903, 10.103))
x <- c(9.991, 10.013, 10.001, 10.007, 10.010, 10.013, 10.008,9.992, 10.017, 10.005, 10.005, 10.002, 10.017, 10.005, 10.002, 9.996, 10.011, 10.009, 10.006, 10.008, 10.003, 10.002, 10.006, 10.010, 10.013) cg_RunChart(x = x, target = 10.003, tolerance = c(9.903, 10.103))
Function visualize the given values of measurement in a Tolerance View.
cg_ToleranceChart( x, target, tolerance, ref.interval, facCg, facCgk, n = 0.2, col, pch, xlim, ylim, main, conf.level = 0.95, cgOut = TRUE )
cg_ToleranceChart( x, target, tolerance, ref.interval, facCg, facCgk, n = 0.2, col, pch, xlim, ylim, main, conf.level = 0.95, cgOut = TRUE )
x |
A vector containing the measured values. |
target |
A numeric value giving the expected target value for the x-values. |
tolerance |
Vector of length 2 giving the lower and upper specification limits. |
ref.interval |
Numeric value giving the confidence interval on which the calculation is based. By default it is based on 6 sigma methodology.
Regarding the normal distribution this relates to |
facCg |
Numeric value as a factor for the calculation of the gage potential index. The default value for |
facCgk |
Numeric value as a factor for the calculation of the gage capability index. The default value for |
n |
Numeric value between |
col |
Character or numeric value specifying the color of the line and points in the tolerance view. Default is |
pch |
Numeric or character specifying the plotting symbol. Default is |
xlim |
Numeric vector of length 2 specifying the limits for the x-axis. Default is |
ylim |
Numeric vector of length 2 specifying the limits for the y-axis. Default is |
main |
Character string specifying the title of the plot. Default is |
conf.level |
Confidence level for internal |
cgOut |
Logical value deciding whether the |
The calculation of the potential and actual gage capability are based on the following formulae:
Cg = (facCg * tolerance[2]-tolerance[1])/ref.interval
Cgk = (facCgk * abs(target-mean(x))/(ref.interval/2)
If the usage of the historical process variation is preferred the values for the tolerance tolerance
must be adjusted manually. That means in case of the 6 sigma methodology for example, that tolerance = 6 * sigma[process]
.
The function cg_ToleranceChart
returns a list of numeric values. The first element contains the calculated centralized gage potential index Cg
and the second contains the non-centralized gage capability index Cgk
.
x <- c(9.991, 10.013, 10.001, 10.007, 10.010, 10.013, 10.008,9.992, 10.017, 10.005, 10.005, 10.002, 10.017, 10.005, 10.002, 9.996, 10.011, 10.009, 10.006, 10.008, 10.003, 10.002, 10.006, 10.010, 10.013) cg_ToleranceChart(x = x, target = 10.003, tolerance = c(9.903, 10.103))
x <- c(9.991, 10.013, 10.001, 10.007, 10.010, 10.013, 10.008,9.992, 10.017, 10.005, 10.005, 10.002, 10.017, 10.005, 10.002, 9.996, 10.011, 10.009, 10.006, 10.008, 10.003, 10.002, 10.006, 10.010, 10.013) cg_ToleranceChart(x = x, target = 10.003, tolerance = c(9.903, 10.103))
Function to calculate the real value of a coded value.
code2real(low, high, codedValue)
code2real(low, high, codedValue)
low |
Numeric value giving the lower boundary. |
high |
Numeric value giving the higher boundary. |
codedValue |
Numeric value giving the coded value that will be calculated. |
The function return a real value of a coded value
code2real(160, 200, 0)
code2real(160, 200, 0)
Function to display confounded effects of a fractional factorial design in a human readable way.
confounds(x, depth = 2)
confounds(x, depth = 2)
x |
An object of class |
depth |
numeric value - up to depth-way confounded interactions are printed |
The function returns a summary of the factors confounded.
vp.frac = fracDesign(k = 4, gen = "D=ABC") confounds(vp.frac,depth=5)
vp.frac = fracDesign(k = 4, gen = "D=ABC") confounds(vp.frac,depth=5)
Creates a contour diagram for an object of class facDesign.c
.
contourPlot( x, y, z, data = NULL, xlim, ylim, main, xlab, ylab, form = "fit", col = 1, steps, fun, plot = TRUE, show.scale = TRUE )
contourPlot( x, y, z, data = NULL, xlim, ylim, main, xlab, ylab, form = "fit", col = 1, steps, fun, plot = TRUE, show.scale = TRUE )
x |
Name providing the Factor A for the plot. |
y |
Name providing the Factor B for the plot. |
z |
Name giving the Response variable. |
data |
Needs to be an object of class |
xlim |
Vector giving the range of the x-axis. |
ylim |
Vector giving the range of the y-axis. |
main |
Character string: title of the plot. |
xlab |
Character string: label for the x-axis. |
ylab |
Character string: label for the y-axis. |
form |
A character string or a formula with the syntax 'y~ x+y + x*y'. If form is a character it has to be one out of the following:
|
col |
A predefined (1, 2, 3 or 4) or self defined colorRampPalette or color to be used (i.e. |
steps |
Number of grid points per factor. By default |
fun |
Function to be applied to z |
plot |
Logical value indicating whether to display the plot. Default is |
show.scale |
Logical value indicating whether to display the color scale on the plot. Default is |
The function contourPlot
returns an invisible list containing:
x - locations of grid lines for x at which the values in z are measured.
y - locations of grid lines for y at which the values in z are measured.
z - a matrix containing the values of z to be plotted.
plot - The generated plot.
fdo = rsmDesign(k = 3, blocks = 2) fdo$.response(data.frame(y = rnorm(fdo$nrow()))) #I - display linear fit contourPlot(A,B,y, data = fdo, form = "linear") #II - display full fit (i.e. effect, interactions and quadratic effects contourPlot(A,B,y, data = fdo, form = "full") #III - display a fit specified before fdo$set.fits(fdo$lm(y ~ B + I(A^2))) contourPlot(A,B,y, data = fdo, form = "fit") #IV - display a fit given directly contourPlot(A,B,y, data = fdo, form = "y ~ A*B + I(A^2)") #V - display a fit using a different colorRamp contourPlot(A,B,y, data = fdo, form = "full", col = 2) #VI - display a fit using a self defined colorRamp myColour = colorRampPalette(c("green", "gray","blue")) contourPlot(A,B,y, data = fdo, form = "full", col = myColour)
fdo = rsmDesign(k = 3, blocks = 2) fdo$.response(data.frame(y = rnorm(fdo$nrow()))) #I - display linear fit contourPlot(A,B,y, data = fdo, form = "linear") #II - display full fit (i.e. effect, interactions and quadratic effects contourPlot(A,B,y, data = fdo, form = "full") #III - display a fit specified before fdo$set.fits(fdo$lm(y ~ B + I(A^2))) contourPlot(A,B,y, data = fdo, form = "fit") #IV - display a fit given directly contourPlot(A,B,y, data = fdo, form = "y ~ A*B + I(A^2)") #V - display a fit using a different colorRamp contourPlot(A,B,y, data = fdo, form = "full", col = 2) #VI - display a fit using a self defined colorRamp myColour = colorRampPalette(c("green", "gray","blue")) contourPlot(A,B,y, data = fdo, form = "full", col = myColour)
This function creates a ternary plot (contour plot) for mixture designs (i.e. object of class mixDesign
).
contourPlot3( x, y, z, response, data = NULL, main, xlab, ylab, zlab, form = "linear", col = 1, col.text, axes = TRUE, steps, plot = TRUE, show.scale = TRUE )
contourPlot3( x, y, z, response, data = NULL, main, xlab, ylab, zlab, form = "linear", col = 1, col.text, axes = TRUE, steps, plot = TRUE, show.scale = TRUE )
x |
Factor 1 of the |
y |
Factor 2 of the |
z |
Factor 3 of the |
response |
the response of the |
data |
The |
main |
Character string specifying the main title of the plot. |
xlab |
Character string specifying the label for the x-axis. |
ylab |
Character string specifying the label for the y-axis. |
zlab |
Character string specifying the label for the z-axis. |
form |
A character string or a formula with the syntax 'y ~ A + B + C'. If form is a character string, it has to be one of the following:
How the form influences the output is described in the reference listed below.
By default, |
col |
A predefined value (1, 2, 3, or 4) or a self-defined |
col.text |
A character string specifying the color of the axis labels.
The default value |
axes |
A logical value specifying whether the axes should be plotted.
By default, |
steps |
A numeric value specifying the resolution of the plot, i.e., the number of rows for the square matrix, which also represents the number of grid points per factor.
By default, |
plot |
Logical value indicating whether to display the plot. Default is |
show.scale |
Logical value indicating whether to display the color scale on the plot. Default is |
The function contourPlot3
returns an invisible list containing:
mat - A matrix containing the response values as NA's and numerics.
plot - The generated plot.
mixDesign.c
, mixDesign
, wirePlot3
.
mdo = mixDesign(3,2, center = FALSE, axial = FALSE, randomize = FALSE, replicates = c(1,1,2,3)) mdo$names(c("polyethylene", "polystyrene", "polypropylene")) mdo$units("percent") elongation = c(11.0, 12.4, 15.0, 14.8, 16.1, 17.7, 16.4, 16.6, 8.8, 10.0, 10.0, 9.7, 11.8, 16.8, 16.0) mdo$.response(elongation) contourPlot3(A, B, C, elongation, data = mdo, form = "linear") contourPlot3(A, B, C, elongation, data = mdo, form = "quadratic", col = 2) contourPlot3(A, B, C, elongation, data = mdo, form = "elongation ~ I(A^2) - B:A + I(C^2)", col = 3, axes = FALSE) contourPlot3(A, B, C, elongation, data = mdo, form = "quadratic", col = c("yellow", "white", "red"), axes = FALSE)
mdo = mixDesign(3,2, center = FALSE, axial = FALSE, randomize = FALSE, replicates = c(1,1,2,3)) mdo$names(c("polyethylene", "polystyrene", "polypropylene")) mdo$units("percent") elongation = c(11.0, 12.4, 15.0, 14.8, 16.1, 17.7, 16.4, 16.6, 8.8, 10.0, 10.0, 9.7, 11.8, 16.8, 16.0) mdo$.response(elongation) contourPlot3(A, B, C, elongation, data = mdo, form = "linear") contourPlot3(A, B, C, elongation, data = mdo, form = "quadratic", col = 2) contourPlot3(A, B, C, elongation, data = mdo, form = "elongation ~ I(A^2) - B:A + I(C^2)", col = 3, axes = FALSE) contourPlot3(A, B, C, elongation, data = mdo, form = "quadratic", col = c("yellow", "white", "red"), axes = FALSE)
Creates desirability functions for use in the optimization of multiple responses.
desirability( response, low, high, target = "max", scale = c(1, 1), importance = 1 )
desirability( response, low, high, target = "max", scale = c(1, 1), importance = 1 )
response |
Name of the response. |
low |
Lowest acceptable value for the response. |
high |
Highest acceptable value for the response. |
target |
Desired target value of the response. |
scale |
Numeric value giving the scaling factors for one and two-sided transformations. Default is |
importance |
A value ranging from 0.1 to 10, used to calculate a weighted importance, i.e., with importances 1, 2, and 4, D = [(d1)^1, (d2)^2, (d3)^4]^(1/7). Default is '1'. |
For a product to be developed, different values of responses are desired, leading to multiple response optimization. Minimization, maximization, as well as a specific target value, are defined using desirability functions. A desirability function transforms the values of a response into [0,1], where 0 stands for a non-acceptable value of the response and 1 for values where higher/lower (depending on the direction of the optimization) values of the response have little merit. This function builds upon the desirability functions specified by Harrington (1965) and the modifications by Derringer and Suich (1980) and Derringer (1994). Castillo, Montgomery, and McCarville (1996) further extended these functions, but these extensions are not implemented in this version.
This function returns a desirability.c
object.
# Example 1: Maximization of a response # Define a desirability for response y where higher values of y are better # as long as the response is smaller than high d = desirability(y, low = 6, high = 18, target = "max") # Show and plot the desirability function d plot(d) # Example 2: Minimization of a response including a scaling factor # Define a desirability for response y where lower values of y are better # as long as the response is higher than low d = desirability(y, low = 6, high = 18, scale = c(2), target = "min") # Show and plot the desirability function d plot(d) # Example 3: Specific target of a response is best including a scaling factor # Define a desirability for response y where desired value is at 8 and # values lower than 6 as well as values higher than 18 are not acceptable d = desirability(y, low = 6, high = 18, scale = c(0.5, 2), target = 12) # Show and plot the desirability function d plot(d) # Example 4: y1 <- c(102, 120, 117, 198, 103, 132, 132, 139, 102, 154, 96, 163, 116, 153, 133, 133, 140, 142, 145, 142) y2 <- c(470, 410, 570, 240, 640, 270, 410, 380, 590, 260, 520, 380, 520, 290, 380, 380, 430, 430, 390, 390) d1 <- desirability(y1, 120, 170, scale = c(1, 1), target = "max") d3 <- desirability(y2, 400, 600, target = 500) d1 plot(d1) d3 plot(d3)
# Example 1: Maximization of a response # Define a desirability for response y where higher values of y are better # as long as the response is smaller than high d = desirability(y, low = 6, high = 18, target = "max") # Show and plot the desirability function d plot(d) # Example 2: Minimization of a response including a scaling factor # Define a desirability for response y where lower values of y are better # as long as the response is higher than low d = desirability(y, low = 6, high = 18, scale = c(2), target = "min") # Show and plot the desirability function d plot(d) # Example 3: Specific target of a response is best including a scaling factor # Define a desirability for response y where desired value is at 8 and # values lower than 6 as well as values higher than 18 are not acceptable d = desirability(y, low = 6, high = 18, scale = c(0.5, 2), target = 12) # Show and plot the desirability function d plot(d) # Example 4: y1 <- c(102, 120, 117, 198, 103, 132, 132, 139, 102, 154, 96, 163, 116, 153, 133, 133, 140, 142, 145, 142) y2 <- c(470, 410, 570, 240, 640, 270, 410, 380, 590, 260, 520, 380, 520, 290, 380, 380, 430, 430, 390, 390) d1 <- desirability(y1, 120, 170, scale = c(1, 1), target = "max") d3 <- desirability(y2, 400, 600, target = 500) d1 plot(d1) d3 plot(d3)
A class representing the desirability metrics for responses in a design.
response
A numeric vector specifying the responses for which desirability is calculated.
low
A numeric vector representing the lower bounds of the desirable range for each response.
high
A numeric vector representing the upper bounds of the desirable range for each response.
target
A numeric vector or character string indicating the target values or goals for each response.
scale
A numeric vector specifying the scaling factors used in the desirability calculation.
importance
A numeric vector indicating the importance of each response in the desirability calculation.
new()
Initializes a new desirability.c
object with specified parameters.
desirability.c$new( response = NULL, low = NULL, high = NULL, target = NULL, scale = NULL, importance = NULL )
response
A numeric or character vector specifying the responses for which desirability is calculated.
low
A numeric vector representing the lower bounds of the desirable range for each response.
high
A numeric vector representing the upper bounds of the desirable range for each response.
target
A numeric vector or character string indicating the target values or goals for each response.
scale
A numeric vector specifying the scaling factors used in the desirability calculation.
importance
A numeric vector indicating the importance of each response in the desirability calculation.
print()
Prints the details of a desirability.c
object.
desirability.c$print()
plot()
Plots the desirability functions based on the specified parameters.
desirability.c$plot(scale, main, xlab, ylab, line.width, col, numPoints = 500)
scale
A numeric vector specifying the scaling factors used in the plot.
main
A character string specifying the main title of the plot.
xlab
A character string specifying the label for the x-axis.
ylab
A character string specifying the label for the y-axis.
line.width
A numeric value specifying the width of the plot lines.
col
A vector of colors for the plot lines.
numPoints
An integer specifying the number of points to plot (default is 500).
clone()
The objects of this class are cloneable with this method.
desirability.c$clone(deep = FALSE)
deep
Whether to make a deep clone.
desirability
, overall
, optimum
The desOpt
class represents an object that stores optimization results for factorial design experiments. It includes coded and real factors, responses, desirabilities, overall desirability, and the design object.
facCoded
A list containing the coded values for the factors in the design.
facReal
A list containing the real (actual) values for the factors in the design.
responses
A list of response variables obtained from the design.
desirabilities
A list of desirability scores for each response variable.
overall
Numeric value representing the overall desirability score.
all
A data frame containing all the relevant data from the design and optimization process.
fdo
The factorial design object used in the optimization process.
as.data.frame()
Convert the object to a data frame.
desOpt$as.data.frame()
print()
Print a summary of the object.
desOpt$print()
clone()
The objects of this class are cloneable with this method.
desOpt$clone(deep = FALSE)
deep
Whether to make a deep clone.
optimum
, facDesign
, desirability
Density function, distribution function, and quantile function for the Gamma distribution.
dgamma3(x, shape, scale, threshold)
dgamma3(x, shape, scale, threshold)
x |
A numeric vector of quantiles. |
shape |
The shape parameter, default is |
scale |
The scale parameter, default is |
threshold |
The threshold parameter, default is |
The Gamma distribution with scale
parameter alpha, shape
parameter c, and threshold
parameter zeta has a density given by:
The cumulative distribution function is given by:
dgamma3
gives the density, pgamma3
gives the distribution function, and qgamma3
gives the quantile function.
dgamma3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pgamma3(q = 1, scale = 1, shape = 5, threshold = 0) temp qgamma3(p = temp, scale = 1, shape = 5, threshold = 0)
dgamma3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pgamma3(q = 1, scale = 1, shape = 5, threshold = 0) temp qgamma3(p = temp, scale = 1, shape = 5, threshold = 0)
R6 Class for Distribution Objects
x
Numeric vector of data values.
name
Character string representing the name of the distribution.
parameters
List of parameters for the distribution.
sd
Numeric value representing the standard deviation of the distribution.
n
Numeric value representing the sample size.
loglik
Numeric value representing the log-likelihood.
new()
Initialize the fiels of the 'Distribution' object
Distr$new(x, name, parameters, sd, n, loglik)
x
Numeric vector of data values.
name
Character string representing the name of the distribution.
parameters
List of parameters for the distribution.
sd
Numeric value representing the standard deviation of the distribution.
n
Numeric value representing the sample size.
loglik
Numeric value representing the log-likelihood.
plot()
Plot the distribution with histogram and fitted density curve.
Distr$plot( main = NULL, xlab = NULL, xlim = NULL, xlim.t = TRUE, ylab = NULL, line.col = "red", fill.col = "lightblue", border.col = "black", box = TRUE, line.width = 1 )
main
Character string for the main title of the plot. Defaults to the name of the distribution.
xlab
Character string for the x-axis label. Defaults to "x".
xlim
Numeric vector specifying the x-axis limits.
xlim.t
Logical value specifyind to change the xlim default.
ylab
Character string for the y-axis label. Defaults to "Density".
line.col
Character string for the color of the plot line. Default is "red".
fill.col
Character string for the color of the fill histogram plot line. Default is "lightblue".
border.col
Character string for the color of the border of the fill histogram plot line. Default is "black".
box
Logical value indicating whether to draw a box with the parameters in the plot. Default is TRUE.
line.width
Numeric value specifying the width of the plot line. Default is 1.
clone()
The objects of this class are cloneable with this method.
Distr$clone(deep = FALSE)
deep
Whether to make a deep clone.
distribution
, FitDistr
, DistrCollection
# Normal set.seed(123) data1 <- rnorm(100, mean = 5, sd = 2) parameters1 <- list(mean = 5, sd = 2) distr1 <- Distr$new(x = data1, name = "normal", parameters = parameters1, sd = 2, n = 100, loglik = -120) distr1$plot() # Log-normal data2 <- rlnorm(100, meanlog = 1, sdlog = 0.5) parameters2 <- list(meanlog = 1, sdlog = 0.5) distr2 <- Distr$new(x = data2, name = "log-normal", parameters = parameters2, sd = 0.5, n = 100, loglik = -150) distr2$plot() # Geometric data3 <- rgeom(100, prob = 0.3) parameters3 <- list(prob = 0.3) distr3 <- Distr$new(x = data3, name = "geometric", parameters = parameters3, sd = sqrt((1 - 0.3) / (0.3^2)), n = 100, loglik = -80) distr3$plot() # Exponential data4 <- rexp(100, rate = 0.2) parameters4 <- list(rate = 0.2) distr4 <- Distr$new(x = data4, name = "exponential", parameters = parameters4, sd = 1 / 0.2, n = 100, loglik = -110) distr4$plot() # Poisson data5 <- rpois(100, lambda = 3) parameters5 <- list(lambda = 3) distr5 <- Distr$new(x = data5, name = "poisson", parameters = parameters5, sd = sqrt(3), n = 100, loglik = -150) distr5$plot() # Chi-square data6 <- rchisq(100, df = 5) parameters6 <- list(df = 5) distr6 <- Distr$new(x = data6, name = "chi-squared", parameters = parameters6, sd = sqrt(2 * 5), n = 100, loglik = -130) distr6$plot() # Logistic data7 <- rlogis(100, location = 0, scale = 1) parameters7 <- list(location = 0, scale = 1) distr7 <- Distr$new(x = data7, name = "logistic", parameters = parameters7, sd = 1 * sqrt(pi^2 / 3), n = 100, loglik = -140) distr7$plot() # Gamma data8 <- rgamma(100, shape = 2, rate = 0.5) parameters8 <- list(shape = 2, rate = 0.5) distr8 <- Distr$new(x = data8, name = "gamma", parameters = parameters8, sd = sqrt(2 / (0.5^2)), n = 100, loglik = -120) distr8$plot() # f data9 <- rf(100, df1 = 5, df2 = 10) parameters9 <- list(df1 = 5, df2 = 10) df1 <- 5 df2 <- 10 distr9 <- Distr$new(x = data9, name = "f", parameters = parameters9, sd = sqrt(((df2^2 * (df1 + df2 - 2)) / (df1 * (df2 - 2)^2 * (df2 - 4)))), n = 100, loglik = -150) distr9$plot() # t data10 <- rt(100, df = 10) parameters10 <- list(df = 10) distr10 <- Distr$new(x = data10, name = "t", parameters = parameters10, sd = sqrt(10 / (10 - 2)), n = 100, loglik = -120) distr10$plot() # negative binomial data11 <- rnbinom(100, size = 5, prob = 0.3) parameters11 <- list(size = 5, prob = 0.3) distr11 <- Distr$new(x = data11, name = "negative binomial", parameters = parameters11, sd = sqrt(5 * (1 - 0.3) / (0.3^2)), n = 100, loglik = -130) distr11$plot()
# Normal set.seed(123) data1 <- rnorm(100, mean = 5, sd = 2) parameters1 <- list(mean = 5, sd = 2) distr1 <- Distr$new(x = data1, name = "normal", parameters = parameters1, sd = 2, n = 100, loglik = -120) distr1$plot() # Log-normal data2 <- rlnorm(100, meanlog = 1, sdlog = 0.5) parameters2 <- list(meanlog = 1, sdlog = 0.5) distr2 <- Distr$new(x = data2, name = "log-normal", parameters = parameters2, sd = 0.5, n = 100, loglik = -150) distr2$plot() # Geometric data3 <- rgeom(100, prob = 0.3) parameters3 <- list(prob = 0.3) distr3 <- Distr$new(x = data3, name = "geometric", parameters = parameters3, sd = sqrt((1 - 0.3) / (0.3^2)), n = 100, loglik = -80) distr3$plot() # Exponential data4 <- rexp(100, rate = 0.2) parameters4 <- list(rate = 0.2) distr4 <- Distr$new(x = data4, name = "exponential", parameters = parameters4, sd = 1 / 0.2, n = 100, loglik = -110) distr4$plot() # Poisson data5 <- rpois(100, lambda = 3) parameters5 <- list(lambda = 3) distr5 <- Distr$new(x = data5, name = "poisson", parameters = parameters5, sd = sqrt(3), n = 100, loglik = -150) distr5$plot() # Chi-square data6 <- rchisq(100, df = 5) parameters6 <- list(df = 5) distr6 <- Distr$new(x = data6, name = "chi-squared", parameters = parameters6, sd = sqrt(2 * 5), n = 100, loglik = -130) distr6$plot() # Logistic data7 <- rlogis(100, location = 0, scale = 1) parameters7 <- list(location = 0, scale = 1) distr7 <- Distr$new(x = data7, name = "logistic", parameters = parameters7, sd = 1 * sqrt(pi^2 / 3), n = 100, loglik = -140) distr7$plot() # Gamma data8 <- rgamma(100, shape = 2, rate = 0.5) parameters8 <- list(shape = 2, rate = 0.5) distr8 <- Distr$new(x = data8, name = "gamma", parameters = parameters8, sd = sqrt(2 / (0.5^2)), n = 100, loglik = -120) distr8$plot() # f data9 <- rf(100, df1 = 5, df2 = 10) parameters9 <- list(df1 = 5, df2 = 10) df1 <- 5 df2 <- 10 distr9 <- Distr$new(x = data9, name = "f", parameters = parameters9, sd = sqrt(((df2^2 * (df1 + df2 - 2)) / (df1 * (df2 - 2)^2 * (df2 - 4)))), n = 100, loglik = -150) distr9$plot() # t data10 <- rt(100, df = 10) parameters10 <- list(df = 10) distr10 <- Distr$new(x = data10, name = "t", parameters = parameters10, sd = sqrt(10 / (10 - 2)), n = 100, loglik = -120) distr10$plot() # negative binomial data11 <- rnbinom(100, size = 5, prob = 0.3) parameters11 <- list(size = 5, prob = 0.3) distr11 <- Distr$new(x = data11, name = "negative binomial", parameters = parameters11, sd = sqrt(5 * (1 - 0.3) / (0.3^2)), n = 100, loglik = -130) distr11$plot()
R6 Class for Managing a Collection of Distribution Objects
distr
List of Distr
objects.
new()
Initialize the fields of the DistrCollection
object.
DistrCollection$new()
add()
Add a Distr
object to the collection.
DistrCollection$add(distr)
distr
A Distr
object to add to the collection.
get()
Get a Distr
object from the collection by its index.
DistrCollection$get(i)
i
Integer index of the Distr
object to retrieve.
A Distr
object.
print()
Print the summary of all distributions in the collection.
DistrCollection$print()
summary()
Summarize the goodness of fit for all distributions in the collection.
DistrCollection$summary()
A data frame with distribution names, Anderson-Darling test statistics, and p-values.
plot()
Plot all distributions in the collection.
DistrCollection$plot( xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, line.col = "red", fill.col = "lightblue", border.col = "black", line.width = 1, box = TRUE )
xlab
Character string for the x-axis label.
ylab
Character string for the y-axis label.
xlim
Numeric vector specifying the x-axis limits.
ylim
Numeric vector specifying the y-axis limits.
line.col
Character string for the color of the plot line. Default is "red".
fill.col
Character string for the color of the histogram fill. Default is "lightblue".
border.col
Character string for the color of the histogram border. Default is "black".
line.width
Numeric value specifying the width of the plot line. Default is 1.
box
Logical value indicating whether to draw a box with the parameters in the plot. Default is TRUE.
clone()
The objects of this class are cloneable with this method.
DistrCollection$clone(deep = FALSE)
deep
Whether to make a deep clone.
set.seed(123) data1 <- rnorm(100, mean = 5, sd = 2) parameters1 <- list(mean = 5, sd = 2) distr1 <- Distr$new(x = data1, name = "normal", parameters = parameters1, sd = 2, n = 100, loglik = -120) data2 <- rpois(100, lambda = 3) parameters2 <- list(lambda = 3) distr2 <- Distr$new(x = data2, name = "poisson", parameters = parameters2, sd = sqrt(3), n = 100, loglik = -150) collection <- DistrCollection$new() collection$add(distr1) collection$add(distr2) collection$summary() collection$plot()
set.seed(123) data1 <- rnorm(100, mean = 5, sd = 2) parameters1 <- list(mean = 5, sd = 2) distr1 <- Distr$new(x = data1, name = "normal", parameters = parameters1, sd = 2, n = 100, loglik = -120) data2 <- rpois(100, lambda = 3) parameters2 <- list(lambda = 3) distr2 <- Distr$new(x = data2, name = "poisson", parameters = parameters2, sd = sqrt(3), n = 100, loglik = -150) collection <- DistrCollection$new() collection$add(distr1) collection$add(distr2) collection$summary() collection$plot()
Calculates the most likely parameters for a given distribution.
distribution(x = NULL, distrib = "weibull", ...)
distribution(x = NULL, distrib = "weibull", ...)
x |
Vector of distributed values from which the parameter should be determined. |
distrib |
Character string specifying the distribution of x. The function
By default, |
... |
Additional arguments to be passed to the fitting function. |
distribution()
returns an object of class DistrCollection
.
data1 <- rnorm(100, mean = 5, sd = 2) distribution(data1, distrib = "normal")
data1 <- rnorm(100, mean = 5, sd = 2) distribution(data1, distrib = "normal")
Density function, distribution function, and quantile function for the Lognormal distribution.
dlnorm3(x, meanlog, sdlog, threshold)
dlnorm3(x, meanlog, sdlog, threshold)
x |
A numeric vector of quantiles. |
meanlog , sdlog
|
The mean and standard deviation of the distribution on the log scale with default values of |
threshold |
The threshold parameter, default is |
The Lognormal distribution with meanlog
parameter zeta, sdlog
parameter sigma, and threshold
parameter theta has a density given by:
The cumulative distribution function is given by:
where is the cumulative distribution function of the standard normal distribution.
dlnorm3
gives the density, plnorm3
gives the distribution function, and qlnorm3
gives the quantile function.
dlnorm3(x = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp <- plnorm3(q = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp qlnorm3(p = temp, meanlog = 0, sdlog = 1/8, threshold = 1)
dlnorm3(x = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp <- plnorm3(q = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp qlnorm3(p = temp, meanlog = 0, sdlog = 1/8, threshold = 1)
An R6 class representing a factor in a design of experiments (DOE).
low
Numeric value specifying the lower bound of the factor. Default is '-1'.
high
Numeric value specifying the upper bound of the factor. Default is '1'.
name
Character string specifying the name of the factor. Default is an empty string ``
.
unit
Character string specifying the unit of measurement for the factor. Default is an empty string ``
.
type
Character string specifying the type of the factor. Can be either `numeric`
or `categorical`
. Default is `numeric`
.
attributes()
Get the attributes of the factor.
doeFactor$attributes()
.low()
Get and set the lower bound for the factor.
doeFactor$.low(value)
value
Numeric value to set as the lower bound. If missing, the current lower bound is returned.
.high()
Get and set the upper bound for the factor.
doeFactor$.high(value)
value
Numeric value to set as the upper bound. If missing, the current upper bound is returned.
.type()
Get and set the type of the factor.
doeFactor$.type(value)
value
Character string specifying the type of the factor. Can be '"numeric"' or '"categorical"'. If missing, the current type is returned.
.unit()
Get and set the unit of measurement for the factor.
doeFactor$.unit(value)
value
Character string specifying the unit of measurement. If missing, the current unit is returned.
names()
Get and set the name of the factor.
doeFactor$names(value)
value
Character string specifying the name of the factor. If missing, the current name is returned.
print()
Print the characteristics of the factors.
doeFactor$print()
clone()
The objects of this class are cloneable with this method.
doeFactor$clone(deep = FALSE)
deep
Whether to make a deep clone.
Creates a dot plot. For data in groups, the dot plot can be displayed stacked or in separate regions.
dotPlot( x, group, xlim, ylim, col, xlab, ylab, pch, cex, breaks, stacked = TRUE, main, showPlot = TRUE )
dotPlot( x, group, xlim, ylim, col, xlab, ylab, pch, cex, breaks, stacked = TRUE, main, showPlot = TRUE )
x |
A numeric vector containing the values to be plotted. |
group |
(Optional) A vector for grouping the values. This determines the grouping of the data points in the dot plot. |
xlim |
A numeric vector of length 2 specifying the limits of the x-axis (lower and upper limits). |
ylim |
A numeric vector of length 2 specifying the limits of the y-axis (lower and upper limits). |
col |
A vector containing numeric values or strings specifying the colors for the different groups in the dot plot. |
xlab |
A title for the x-axis. |
ylab |
A title for the y-axis. |
pch |
A vector of integers specifying the symbols or a single character to be used for plotting points for the different groups in the dot plot. |
cex |
The amount by which points and symbols should be magnified relative to the default. |
breaks |
A numeric vector specifying the breakpoints for binning the values in |
stacked |
A logical value indicating whether the groups should be plotted in a stacked dot plot (default is |
main |
A title for the plot. |
showPlot |
A logical value indicating whether to display the plot. Default is |
Values in x
are assigned to the bins defined by breaks
. The binning is performed using hist
.
A list cointaining:
An invisible matrix containing NA
s and numeric values representing values in a bin. The number of bins is given by the number of columns of the matrix.
The graphic.
# Create some data and grouping set.seed(1) x <- rnorm(28) g <- rep(1:2, 14) # Dot plot with groups and no stacking dotPlot(x, group = g, stacked = FALSE, pch = c(19, 20), main = "Non stacked dot plot") # Dot plot with groups and stacking dotPlot(x, group = g, stacked = TRUE, pch = c(19, 20), main = "Stacked dot plot")
# Create some data and grouping set.seed(1) x <- rnorm(28) g <- rep(1:2, 14) # Dot plot with groups and no stacking dotPlot(x, group = g, stacked = FALSE, pch = c(19, 20), main = "Non stacked dot plot") # Dot plot with groups and stacking dotPlot(x, group = g, stacked = TRUE, pch = c(19, 20), main = "Stacked dot plot")
Density function, distribution function, and quantile function for the Weibull distribution with a threshold parameter.
dweibull3(x, shape, scale, threshold)
dweibull3(x, shape, scale, threshold)
x |
A numeric vector of quantiles. |
shape |
The shape parameter of the Weibull distribution. Default is 1. |
scale |
The scale parameter of the Weibull distribution. Default is 1. |
threshold |
The threshold (or location) parameter of the Weibull distribution. Default is 0. |
The Weibull distribution with the scale
parameter alpha, shape
parameter c, and threshold
parameter zeta has a density function given by:
The cumulative distribution function is given by:
dweibull3
returns the density, pweibull3
returns the distribution function, and qweibull3
returns the quantile function for the Weibull distribution with a threshold.
dweibull3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pweibull3(q = 1, scale = 1, shape = 5, threshold = 0) temp qweibull3(p = temp, scale = 1, shape = 5, threshold = 0)
dweibull3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pweibull3(q = 1, scale = 1, shape = 5, threshold = 0) temp qweibull3(p = temp, scale = 1, shape = 5, threshold = 0)
Generates a 2^k full factorial design.
facDesign( k = 3, p = 0, replicates = 1, blocks = 1, centerCube = 0, random.seed = 1234 )
facDesign( k = 3, p = 0, replicates = 1, blocks = 1, centerCube = 0, random.seed = 1234 )
k |
Numeric value giving the number of factors. By default k is set to '3'. |
p |
Numeric integer between '0' and '7'. p is giving the number of additional factors in the response surface design by aliasing effects. For further information see fracDesign and fracChoose. By default p is set to '0'. |
replicates |
Numeric value giving the number of |
blocks |
Numeric value giving the number of blocks. By default blocks is set to '1'. Blocking is only performed for k greater 2. |
centerCube |
Numeric value giving the number of centerpoints within the 2^k design. By default |
random.seed |
Numeric value for setting the random seed for reproducibility. |
The function facDesign
returns an object of class facDesign.c
.
fracDesign
, fracChoose
, rsmDesign
, pbDesign
, taguchiDesign
# Example 1 vp.full <- facDesign(k = 3) vp.full$.response(rnorm(2^3)) vp.full$summary() # Example 2 vp.rep <- facDesign(k = 2, replicates = 3, centerCube = 4) vp.rep$names(c("Name 1", "Name 2")) vp.rep$unit(c("min", "F")) vp.rep$lows(c(20, 40, 60)) vp.rep$highs(c(40, 60, 80)) vp.rep$summary() # Example 3 dfac <- facDesign(k = 3, centerCube = 4) dfac$names(c('Factor 1', 'Factor 2', 'Factor 3')) dfac$names() dfac$lows(c(80, 120, 1)) dfac$lows() dfac$highs(c(120, 140, 2)) dfac$highs() dfac$summary()
# Example 1 vp.full <- facDesign(k = 3) vp.full$.response(rnorm(2^3)) vp.full$summary() # Example 2 vp.rep <- facDesign(k = 2, replicates = 3, centerCube = 4) vp.rep$names(c("Name 1", "Name 2")) vp.rep$unit(c("min", "F")) vp.rep$lows(c(20, 40, 60)) vp.rep$highs(c(40, 60, 80)) vp.rep$summary() # Example 3 dfac <- facDesign(k = 3, centerCube = 4) dfac$names(c('Factor 1', 'Factor 2', 'Factor 3')) dfac$names() dfac$lows(c(80, 120, 1)) dfac$lows() dfac$highs(c(120, 140, 2)) dfac$highs() dfac$summary()
The facDesign.c
class is used to represent factorial designs, including their factors, responses, blocks, and design matrices. This class supports various experimental designs and allows for the storage and manipulation of data related to the design and analysis of factorial experiments.
name
Character string representing the name of the factorial design.
factors
List of factors involved in the factorial design, including their levels and settings.
cube
Data frame containing the design matrix for the cube portion of the factorial design.
star
Data frame containing the design matrix for the star portion of the factorial design.
centerCube
Data frame containing the center points within the cube portion of the factorial design.
centerStar
Data frame containing the center points within the star portion of the factorial design.
generator
List of generators used to create the fractional factorial design.
response
Data frame containing the responses or outcomes measured in the design.
block
Data frame specifying the block structures if the design is blocked.
blockGen
Data frame specifying the block generators for the design.
runOrder
Data frame specifying the order in which runs are performed.
standardOrder
Data frame specifying the standard order of the runs.
desireVal
List of desired values or targets for the response variables.
desirability
List of desirability scores or metrics based on the desired values.
fits
Data frame containing the fitted model parameters and diagnostics for the responses in the design.
nrow()
Get the number of rows Design.
facDesign.c$nrow()
ncol()
Get the number of columns Design.
facDesign.c$ncol()
print()
Prints a formatted representation of the factorial design object, including design matrices and responses.
facDesign.c$print()
.clear()
Clears the factorial design object.
facDesign.c$.clear()
names()
Get or set the names of the factors in the factorial design.
facDesign.c$names(value)
value
Character vector with new names for the factors. If missing, retrieves the current names.
as.data.frame()
Converts the factorial design object to a data frame.
facDesign.c$as.data.frame()
get()
Retrieves elements from the factorial design object.
facDesign.c$get(i, j)
i
Row index.
j
Column index.
lows()
Get or set the lower bounds of the factors in the factorial design.
facDesign.c$lows(value)
value
Numeric vector with new lower bounds. If missing, retrieves the current lower bounds.
highs()
Get or set the upper bounds of the factors in the factorial design.
facDesign.c$highs(value)
value
Numeric vector with new upper bounds. If missing, retrieves the current upper bounds.
.nfp()
Prints a summary of the factors attributes including their low, high, name, unit, and type.
facDesign.c$.nfp()
identity()
Returns the factorial design object itself, used to verify or return the object.
facDesign.c$identity()
summary()
Summarizes the factorial design object.
facDesign.c$summary()
.response()
Get or set the response data in the factorial design object.
facDesign.c$.response(value)
value
Data frame or numeric vector with new responses. If missing, retrieves the current responses.
effectPlot()
Plots the effects of factors on the response variables.
facDesign.c$effectPlot( factors, fun = mean, response = NULL, lty, xlab, ylab, main, ylim )
factors
Factors to be plotted.
fun
Function applied to the response variables (e.g., mean).
response
Optional; specifies which response variables to plot.
lty
Line type for plotting.
xlab
Label for the x-axis.
ylab
Label for the y-axis.
main
Main title for the plot.
ylim
Limits for the y-axis.
lm()
Fits a linear model to the response data in the factorial design object.
facDesign.c$lm(formula)
formula
Formula specifying the model to be fitted.
desires()
Get or set the desirability values for the response variables.
facDesign.c$desires(value)
value
List of new desirability values. If missing, retrieves the current desirability values.
set.fits()
Set the fits for the response variables in the factorial design object.
facDesign.c$set.fits(value)
value
New fits.
types()
Get or set the types of designs used in the factorial design object.
facDesign.c$types(value)
value
New design types. If missing, retrieves the current types.
unit()
Get or set the units for the factors in the factorial design object.
facDesign.c$unit(value)
value
New units. If missing, retrieves the current units.
.star()
Get or set the star points in the factorial design object.
facDesign.c$.star(value)
value
New star points. If missing, retrieves the current star points.
.blockGen()
Get or set the block generators in the factorial design object.
facDesign.c$.blockGen(value)
value
New block generators. If missing, retrieves the current block generators.
.block()
Get or set the blocks in the factorial design object.
facDesign.c$.block(value)
value
New blocks. If missing, retrieves the current blocks.
.centerCube()
Get or set the center points in the cube portion of the factorial design.
facDesign.c$.centerCube(value)
value
New center points for the cube. If missing, retrieves the current center points.
.centerStar()
Get or set the center points in the star portion of the factorial design.
facDesign.c$.centerStar(value)
value
New center points for the star. If missing, retrieves the current center points.
.generators()
Get or set the generators for the factorial design.
facDesign.c$.generators(value)
value
New generators. If missing, retrieves the current generators.
clone()
The objects of this class are cloneable with this method.
facDesign.c$clone(deep = FALSE)
deep
Whether to make a deep clone.
Maximum-likelihood fitting of univariate distributions, allowing parameters to be held fixed if desired.
FitDistr(x, densfun, start, ...)
FitDistr(x, densfun, start, ...)
x |
A numeric vector of length at least one containing only finite values. Either a character string or a function returning a density evaluated at its first argument. |
densfun |
character string specifying the density function to be used for fitting the distribution. Distributions '"beta"', '"cauchy"', '"chi-squared"', '"exponential"', '"gamma"', '"geometric"', '"log-normal"', '"lognormal"', '"logistic"', '"negative binomial"', '"normal"', '"Poisson"', '"t"' and "weibull" are recognised, case being ignored. |
start |
A named list giving the parameters to be optimized with initial values. This can be omitted for some of the named distributions and must be for others (see Details). |
... |
Additional parameters, either for 'densfun' or for 'optim'. In particular, it can be used to specify bounds via 'lower' or 'upper' or both. If arguments of 'densfun' (or the density function corresponding to a character-string specification) are included they will be held fixed. |
For the Normal, log-Normal, geometric, exponential and Poisson distributions the closed-form MLEs (and exact standard errors) are used, and 'start' should not be supplied.
For all other distributions, direct optimization of the log-likelihood is performed using 'optim'. The estimated standard errors are taken from the observed information matrix, calculated by a numerical approximation. For one-dimensional problems the Nelder-Mead method is used and for multi-dimensional problems the BFGS method, unless arguments named 'lower' or 'upper' are supplied (when 'L-BFGS-B' is used) or 'method' is supplied explicitly.
For the '"t"' named distribution the density is taken to be the location-scale family with location 'm' and scale 's'.
For the following named distributions, reasonable starting values will be computed if 'start' is omitted or only partially specified: '"cauchy"', '"gamma"', '"logistic"', '"negative binomial"' (parametrized by mu and size), '"t"' and '"weibull"'. Note that these starting values may not be good enough if the fit is poor: in particular they are not resistant to outliers unless the fitted distribution is long-tailed.
There are 'print', 'coef', 'vcov' and 'logLik' methods for class '"FitDistr"'.
The function 'FitDistr' returns an object of class 'fitdistr', which is a list containing:
estimate |
a named vector of parameter estimates. |
sd |
a named vector of the estimated standard errors for the parameters. |
vcov |
the estimated variance-covariance matrix of the parameter estimates. |
loglik |
the log-likelihood of the fitted model. |
n |
length vector. |
distribution
, Distr
, DistrCollection
.
set.seed(123) x = rgamma(100, shape = 5, rate = 0.1) FitDistr(x, "gamma") # Now do this directly with more control. FitDistr(x, dgamma, list(shape = 1, rate = 0.1), lower = 0.001) set.seed(123) x2 = rt(250, df = 9) FitDistr(x2, "t", df = 9) # Allow df to vary: not a very good idea! FitDistr(x2, "t") # Now do fixed-df fit directly with more control. mydt = function(x, m, s, df) dt((x-m)/s, df)/s FitDistr(x2, mydt, list(m = 0, s = 1), df = 9, lower = c(-Inf, 0)) set.seed(123) x3 = rweibull(100, shape = 4, scale = 100) FitDistr(x3, "weibull")
set.seed(123) x = rgamma(100, shape = 5, rate = 0.1) FitDistr(x, "gamma") # Now do this directly with more control. FitDistr(x, dgamma, list(shape = 1, rate = 0.1), lower = 0.001) set.seed(123) x2 = rt(250, df = 9) FitDistr(x2, "t", df = 9) # Allow df to vary: not a very good idea! FitDistr(x2, "t") # Now do fixed-df fit directly with more control. mydt = function(x, m, s, df) dt((x-m)/s, df)/s FitDistr(x2, mydt, list(m = 0, s = 1), df = 9, lower = c(-Inf, 0)) set.seed(123) x3 = rweibull(100, shape = 4, scale = 100) FitDistr(x3, "weibull")
Designs displayed are the classic minimum abberation designs. Choosing a design is done by clicking with the mouse into the appropriate field.
fracChoose()
fracChoose()
fracChoose
returns an object of class facDesign.c
.
fracDesign
, facDesign
, rsmChoose
, rsmDesign
fracChoose()
fracChoose()
Generates a 2^k-p fractional factorial design.
fracDesign( k = 3, p = 0, gen = NULL, replicates = 1, blocks = 1, centerCube = 0, random.seed = 1234 )
fracDesign( k = 3, p = 0, gen = NULL, replicates = 1, blocks = 1, centerCube = 0, random.seed = 1234 )
k |
Numeric value giving the number of factors. By default |
p |
Numeric integer between '0' and '7'. p is giving the number of additional factors in the response surface design by aliasing effects.
A 2^k-p factorial design will be generated and the generators of the standard designs available in fracChoose() will be used.
By default p is set to '0'. Any other value will cause the function to omit the argument gen given by the user and replace it by the one out of the table of standard designs (see: |
gen |
One or more defining relations for a fractional factorial design, for example: |
replicates |
Numeric value giving the number of replicates per factor combination. By default |
blocks |
Numeric value giving the number of blocks. By default blocks is set to '1'. |
centerCube |
Numeric value giving the number of center points within the 2^k design. By default |
random.seed |
Seed for randomization of the design |
The function fracDesign
returns an object of class facDesign.c
.
facDesign
, fracChoose
, rsmDesign
, pbDesign
, taguchiDesign
#Example 1 #Returns a 2^4-1 fractional factorial design. Factor D will be aliased with vp.frac = fracDesign(k = 4, gen = "D=ABC") #the three-way-interaction ABC (i.e. I = ABCD) vp.frac$.response(rnorm(2^(4-1))) # summary of the fractional factorial design vp.frac$summary() #Example 2 #Returns a full factorial design with 3 replications per factor combination and 4 center points vp.rep = fracDesign(k = 3, replicates = 3, centerCube = 4) #Summary of the replicated fractional factorial design vp.rep$summary()
#Example 1 #Returns a 2^4-1 fractional factorial design. Factor D will be aliased with vp.frac = fracDesign(k = 4, gen = "D=ABC") #the three-way-interaction ABC (i.e. I = ABCD) vp.frac$.response(rnorm(2^(4-1))) # summary of the fractional factorial design vp.frac$summary() #Example 2 #Returns a full factorial design with 3 replications per factor combination and 4 center points vp.rep = fracDesign(k = 3, replicates = 3, centerCube = 4) #Summary of the replicated fractional factorial design vp.rep$summary()
Function visualize the linearity of a gage by plotting the single and mean bias in one plot and intercalate them with a straight line. Furthermore the function deliver some characteristic values of linearity studies according to MSA (Measurement System Analysis).
gageLin( object, conf.level = 0.95, ylim, col, pch, lty = c(1, 2), stats = TRUE, plot = TRUE )
gageLin( object, conf.level = 0.95, ylim, col, pch, lty = c(1, 2), stats = TRUE, plot = TRUE )
object |
An object of class |
conf.level |
A numeric value between '0' and '1', giving the confidence intervall for the analysis. Default value: '0.95'. |
ylim |
A numeric vector of length 2 specifying the y-axis limits for the plot. If not specified, the limits are set automatically based on the data. |
col |
A vector with four numeric entries. The first gives the color of the single points, the second gives the color of the points for the mean bias, the third gives the color fo the straight interpolation line and the fourth gives the color for the lines representing the confidence interval. If one of the values is missing or negative the points or lines are not plotted. col is by default 'c(1,2,1,4)'. |
pch |
A vector with two numeric or single character entries giving the symbols for the single points (1st entry) and the mean bias (2nd entry). The default vector is 'c(20,18)' |
lty |
a vector with two entries giving the line-style for the interpolating line and the confidence interval lines. For detailed information to the entries please see par. The default value for lty is 'c(1,2)'. |
stats |
Logical value. If 'TRUE' (default) the function returns all calculated information. |
plot |
Logical value indicating whether to generate a plot of the linearity analysis. Default is |
The function returns an object of class MSALinearity
which can be used with e.g. plot
or summary
.
cg
, gageRR
, gageLinDesign
, MSALinearity
.
# Results of single runs A=c(2.7,2.5,2.4,2.5,2.7,2.3,2.5,2.5,2.4,2.4,2.6,2.4) B=c(5.1,3.9,4.2,5,3.8,3.9,3.9,3.9,3.9,4,4.1,3.8) C=c(5.8,5.7,5.9,5.9,6,6.1,6,6.1,6.4,6.3,6,6.1) D=c(7.6,7.7,7.8,7.7,7.8,7.8,7.8,7.7,7.8,7.5,7.6,7.7) E=c(9.1,9.3,9.5,9.3,9.4,9.5,9.5,9.5,9.6,9.2,9.3,9.4) # create Design test=gageLinDesign(ref=c(2,4,6,8,10),n=12) # create data.frame for results results=data.frame(rbind(A,B,C,D,E)) # enter results in Design test$response(results) test$summary() # no plot and no return MSALin=gageLin(test,stats=FALSE,plot=FALSE) # plot only plot(MSALin) MSALin$plot() # summary MSALin$summary()
# Results of single runs A=c(2.7,2.5,2.4,2.5,2.7,2.3,2.5,2.5,2.4,2.4,2.6,2.4) B=c(5.1,3.9,4.2,5,3.8,3.9,3.9,3.9,3.9,4,4.1,3.8) C=c(5.8,5.7,5.9,5.9,6,6.1,6,6.1,6.4,6.3,6,6.1) D=c(7.6,7.7,7.8,7.7,7.8,7.8,7.8,7.7,7.8,7.5,7.6,7.7) E=c(9.1,9.3,9.5,9.3,9.4,9.5,9.5,9.5,9.6,9.2,9.3,9.4) # create Design test=gageLinDesign(ref=c(2,4,6,8,10),n=12) # create data.frame for results results=data.frame(rbind(A,B,C,D,E)) # enter results in Design test$response(results) test$summary() # no plot and no return MSALin=gageLin(test,stats=FALSE,plot=FALSE) # plot only plot(MSALin) MSALin$plot() # summary MSALin$summary()
Function generates an object that can be used with the function gageLin
.
gageLinDesign(ref, n = 5)
gageLinDesign(ref, n = 5)
ref |
A vector and contains the reference values for each group. |
n |
A single value and gives the amount of runs.Default value: '5'.. |
The function returns an object of class MSALinearity
.
# results of run A-E A=c(2.7,2.5,2.4,2.5,2.7,2.3,2.5,2.5,2.4,2.4,2.6,2.4) B=c(5.1,3.9,4.2,5,3.8,3.9,3.9,3.9,3.9,4,4.1,3.8) C=c(5.8,5.7,5.9,5.9,6,6.1,6,6.1,6.4,6.3,6,6.1) D=c(7.6,7.7,7.8,7.7,7.8,7.8,7.8,7.7,7.8,7.5,7.6,7.7) E=c(9.1,9.3,9.5,9.3,9.4,9.5,9.5,9.5,9.6,9.2,9.3,9.4) # create Design test=gageLinDesign(ref=c(2,4,6,8,10),n=12) # create data.frame for results results=data.frame(rbind(A,B,C,D,E)) # enter results in Design test$response(results)
# results of run A-E A=c(2.7,2.5,2.4,2.5,2.7,2.3,2.5,2.5,2.4,2.4,2.6,2.4) B=c(5.1,3.9,4.2,5,3.8,3.9,3.9,3.9,3.9,4,4.1,3.8) C=c(5.8,5.7,5.9,5.9,6,6.1,6,6.1,6.4,6.3,6,6.1) D=c(7.6,7.7,7.8,7.7,7.8,7.8,7.8,7.7,7.8,7.5,7.6,7.7) E=c(9.1,9.3,9.5,9.3,9.4,9.5,9.5,9.5,9.6,9.2,9.3,9.4) # create Design test=gageLinDesign(ref=c(2,4,6,8,10),n=12) # create data.frame for results results=data.frame(rbind(A,B,C,D,E)) # enter results in Design test$response(results)
Performs a Gage R&R analysis for an object of class gageRR.c
.
gageRR( gdo, method = "crossed", sigma = 6, alpha = 0.25, tolerance = NULL, dig = 3, print = TRUE )
gageRR( gdo, method = "crossed", sigma = 6, alpha = 0.25, tolerance = NULL, dig = 3, print = TRUE )
gdo |
Needs to be an object of class |
method |
Character string specifying the Gage R&R method. |
sigma |
Numeric value giving the number of sigmas.
For |
alpha |
Alpha value for discarding the interaction Operator:Part and fitting a non-interaction model. By default |
tolerance |
Mumeric value giving the tolerance for the measured parts. This is required to calculate the Process to Tolerance Ratio.
By default |
dig |
numeric value giving the number of significant digits for |
print |
Print the summary of the perform of the Gage. |
The function gageRR
returns an object of class gageRR.c
and shows typical Gage Repeatability and Reproducibility Output including Process to Tolerance Ratios and the number of distinctive categories (i.e. ndc) the measurement system is able to discriminate with the tested setting.
gageRR.c
, gageRRDesign
, gageLin
, cg
.
# Create de gageRR Design design <- gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, method = "crossed", sigma = 6, randomize = TRUE) design$response(rnorm(nrow(design$X), mean = 10, sd = 2)) # Results of de Design result <- gageRR(gdo = design, method = "crossed", sigma = 6, alpha = 0.25) class(result) result$plot()
# Create de gageRR Design design <- gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, method = "crossed", sigma = 6, randomize = TRUE) design$response(rnorm(nrow(design$X), mean = 10, sd = 2)) # Results of de Design result <- gageRR(gdo = design, method = "crossed", sigma = 6, alpha = 0.25) class(result) result$plot()
R6 Class for Gage R&R (Repeatability and Reproducibility) Analysis
X
Data frame containing the measurement data.
ANOVA
List containing the results of the Analysis of Variance (ANOVA) for the gage study.
RedANOVA
List containing the results of the reduced ANOVA.
method
Character string specifying the method used for the analysis (e.g., `crossed`
, `nested`
).
Estimates
List of estimates including variance components, repeatability, and reproducibility.
Varcomp
List of variance components.
Sigma
Numeric value representing the standard deviation of the measurement system.
GageName
Character string representing the name of the gage.
GageTolerance
Numeric value indicating the tolerance of the gage.
DateOfStudy
Character string representing the date of the gage R&R study.
PersonResponsible
Character string indicating the person responsible for the study.
Comments
Character string for additional comments or notes about the study.
b
Factor levels for operator.
a
Factor levels for part.
y
Numeric vector or matrix containing the measurement responses.
facNames
Character vector specifying the names of the factors (e.g., `Operator`
, `Part`
).
numO
Integer representing the number of operators.
numP
Integer representing the number of parts.
numM
Integer representing the number of measurements per part-operator combination.
new()
Initialize the fiels of the gageRR
object
gageRR.c$new( X, ANOVA = NULL, RedANOVA = NULL, method = NULL, Estimates = NULL, Varcomp = NULL, Sigma = NULL, GageName = NULL, GageTolerance = NULL, DateOfStudy = NULL, PersonResponsible = NULL, Comments = NULL, b = NULL, a = NULL, y = NULL, facNames = NULL, numO = NULL, numP = NULL, numM = NULL )
X
Data frame containing the measurement data.
ANOVA
List containing the results of the Analysis of Variance (ANOVA) for the gage study.
RedANOVA
List containing the results of the reduced ANOVA.
method
Character string specifying the method used for the analysis (e.g., "crossed", "nested").
Estimates
List of estimates including variance components, repeatability, and reproducibility.
Varcomp
List of variance components.
Sigma
Numeric value representing the standard deviation of the measurement system.
GageName
Character string representing the name of the gage.
GageTolerance
Numeric value indicating the tolerance of the gage.
DateOfStudy
Character string representing the date of the gage R&R study.
PersonResponsible
Character string indicating the person responsible for the study.
Comments
Character string for additional comments or notes about the study.
b
Factor levels for operator.
a
Factor levels for part.
y
Numeric vector or matrix containing the measurement responses.
facNames
Character vector specifying the names of the factors (e.g., "Operator", "Part").
numO
Integer representing the number of operators.
numP
Integer representing the number of parts.
numM
Integer representing the number of measurements per part-operator combination.
print()
Return the data frame containing the measurement data (X
)
gageRR.c$print()
subset()
Return a subset of the data frame that containing the measurement data (X
)
gageRR.c$subset(i, j)
i
The i-position of the row of X
.
j
The j-position of the column of X
.
summary()
Summarize the information of the fields of the gageRR
object.
gageRR.c$summary()
get.response()
Get or get the response for a gageRRDesign
object.
gageRR.c$get.response()
response()
Set the response for a gageRRDesign
object.
gageRR.c$response(value)
value
New response vector.
names()
Methods for function names
in Package base
.
gageRR.c$names()
as.data.frame()
Methods for function as.data.frame
in Package base
.
gageRR.c$as.data.frame()
get.tolerance()
Get the tolerance
for an object of class gageRR
.
gageRR.c$get.tolerance()
set.tolerance()
Set the tolerance
for an object of class gageRR
.
gageRR.c$set.tolerance(value)
value
A data.frame or vector for the new value of tolerance.
get.sigma()
Get the sigma
for an object of class gageRR
.
gageRR.c$get.sigma()
set.sigma()
Set the sigma
for an object of class gageRR
.
gageRR.c$set.sigma(value)
value
Valor of sigma
plot()
This function creates a customized plot using the data from the gageRR.c
object.
gageRR.c$plot(main = NULL, xlab = NULL, ylab = NULL, col, lwd, fun = mean)
main
Character string specifying the title of the plot.
xlab
A character string for the x-axis label.
ylab
A character string for the y-axis label.
col
A character string or vector specifying the color(s) to be used for the plot elements.
lwd
A numeric value specifying the line width of plot elements
fun
Function to use for the calculation of the interactions (e.g., mean
, median
). Default is mean
.
# Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$plot()
errorPlot()
The data from an object of class gageRR
can be analyzed by running 'Error Charts' of the individual deviations from the accepted rference values. These 'Error Charts' are provided by the function errorPlot
.
gageRR.c$errorPlot(main, xlab, ylab, col, pch, ylim, legend = TRUE)
main
a main title for the plot.
xlab
A character string for the x-axis label.
ylab
A character string for the y-axis label.
col
Plotting color.
pch
An integer specifying a symbol or a single character to be used as the default in plotting points.
ylim
The y limits of the plot.
legend
A logical value specifying whether a legend is plotted automatically. By default legend is set to 'TRUE'.
# Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$errorPlot()
whiskersPlot()
In a Whiskers Chart, the high and low data values and the average (median) by part-by-operator are plotted to provide insight into the consistency between operators, to indicate outliers and to discover part-operator interactions. The Whiskers Chart reminds of boxplots for every part and every operator.
gageRR.c$whiskersPlot(main, xlab, ylab, col, ylim, legend = TRUE)
main
a main title for the plot.
xlab
A character string for the x-axis label.
ylab
A character string for the y-axis label.
col
Plotting color.
ylim
The y limits of the plot.
legend
A logical value specifying whether a legend is plotted automatically. By default legend is set to 'TRUE'.
# Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$whiskersPlot()
averagePlot()
averagePlot
creates all x-y plots of averages by size out of an object of class gageRR
. Therfore the averages of the multiple readings by each operator on each part are plotted with the reference value or overall part averages as the index.
gageRR.c$averagePlot(main, xlab, ylab, col, single = FALSE)
main
a main title for the plot.
xlab
A character string for the x-axis label.
ylab
A character string for the y-axis label.
col
Plotting color.
single
A logical value.If 'TRUE' a new graphic device will be opened for each plot. By default single
is set to 'FALSE'.
# Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$averagePlot()
compPlot()
compPlot
creates comparison x-y plots of an object of class gageRR
. The averages of the multiple readings by each operator on each part are plotted against each other with the operators as indices. This plot compares the values obtained by one operator to those of another.
gageRR.c$compPlot(main, xlab, ylab, col, cex.lab, fun = NULL)
main
a main title for the plot.
xlab
A character string for the x-axis label.
ylab
A character string for the y-axis label.
col
Plotting color.
cex.lab
The magnification to be used for x and y labels relative to the current setting of cex.
fun
Optional function that will be applied to the multiple readings of each part. fun should be an object of class function
like mean
,median
, sum
, etc. By default, fun
is set to 'NULL' and all readings will be plotted.
# Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$compPlot()
clone()
The objects of this class are cloneable with this method.
gageRR.c$clone(deep = FALSE)
deep
Whether to make a deep clone.
#create gageRR-object gdo <- gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) #vector of responses y <- c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) #appropriate responses gdo$response(y) # perform and gageRR gdo <- gageRR(gdo) # Using the plots gdo$plot() ## ------------------------------------------------ ## Method `gageRR.c$plot` ## ------------------------------------------------ # Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$plot() ## ------------------------------------------------ ## Method `gageRR.c$errorPlot` ## ------------------------------------------------ # Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$errorPlot() ## ------------------------------------------------ ## Method `gageRR.c$whiskersPlot` ## ------------------------------------------------ # Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$whiskersPlot() ## ------------------------------------------------ ## Method `gageRR.c$averagePlot` ## ------------------------------------------------ # Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$averagePlot() ## ------------------------------------------------ ## Method `gageRR.c$compPlot` ## ------------------------------------------------ # Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$compPlot()
#create gageRR-object gdo <- gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) #vector of responses y <- c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) #appropriate responses gdo$response(y) # perform and gageRR gdo <- gageRR(gdo) # Using the plots gdo$plot() ## ------------------------------------------------ ## Method `gageRR.c$plot` ## ------------------------------------------------ # Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$plot() ## ------------------------------------------------ ## Method `gageRR.c$errorPlot` ## ------------------------------------------------ # Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$errorPlot() ## ------------------------------------------------ ## Method `gageRR.c$whiskersPlot` ## ------------------------------------------------ # Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$whiskersPlot() ## ------------------------------------------------ ## Method `gageRR.c$averagePlot` ## ------------------------------------------------ # Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$averagePlot() ## ------------------------------------------------ ## Method `gageRR.c$compPlot` ## ------------------------------------------------ # Create gageRR-object gdo = gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, randomize = FALSE) # Vector of responses y = c(0.29,0.08, 0.04,-0.56,-0.47,-1.38,1.34,1.19,0.88,0.47,0.01,0.14,-0.80, -0.56,-1.46, 0.02,-0.20,-0.29,0.59,0.47,0.02,-0.31,-0.63,-0.46,2.26, 1.80,1.77,-1.36,-1.68,-1.49,0.41,0.25,-0.11,-0.68,-1.22,-1.13,1.17,0.94, 1.09,0.50,1.03,0.20,-0.92,-1.20,-1.07,-0.11, 0.22,-0.67,0.75,0.55,0.01, -0.20, 0.08,-0.56,1.99,2.12,1.45,-1.25,-1.62,-1.77,0.64,0.07,-0.15,-0.58, -0.68,-0.96,1.27,1.34,0.67,0.64,0.20,0.11,-0.84,-1.28,-1.45,-0.21,0.06, -0.49,0.66,0.83,0.21,-0.17,-0.34,-0.49,2.01,2.19,1.87,-1.31,-1.50,-2.16) # Appropriate responses gdo$response(y) # Perform and gageRR gdo <- gageRR(gdo) gdo$compPlot()
Function to Creates a Gage R&R design.
gageRRDesign( Operators = 3, Parts = 10, Measurements = 3, method = "crossed", sigma = 6, randomize = TRUE )
gageRRDesign( Operators = 3, Parts = 10, Measurements = 3, method = "crossed", sigma = 6, randomize = TRUE )
Operators |
Numeric value giving a number or a character vector defining the Operators.
By default |
Parts |
A number or character vector defining the Parts.
By default |
Measurements |
A number defining the measurements per part. By default |
method |
Character string specifying the Gage R&R method. |
sigma |
For |
randomize |
Logical value. |
The function gageRRDesign
returns an object of class gageRR
.
design <- gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, method = "crossed", sigma = 6, randomize = TRUE)
design <- gageRRDesign(Operators = 3, Parts = 10, Measurements = 3, method = "crossed", sigma = 6, randomize = TRUE)
Creates an interaction plot for the factors in a factorial design to visualize the interaction effects between them.
interactionPlot(dfac, response = NULL, fun = mean, main, col = 1:2)
interactionPlot(dfac, response = NULL, fun = mean, main, col = 1:2)
dfac |
An object of class |
response |
Response variable. If the response data frame of fdo consists of more then one responses, this variable can be used to choose just one column of the response data frame.
|
fun |
Function to use for the calculation of the interactions (e.g., |
main |
Character string: title of the plot. |
col |
Vector of colors for the plot. Single colors can be given as character strings or numeric values. Default is |
interactionPlot()
displays interactions for an object of class facDesign
(i.e. 2^k full or 2^k-p fractional factorial design).
Parts of the original interactionPlot were integrated.
Return an interaction plot for the factors in a factorial design.
# Example 1 # Create the facDesign object dfac <- facDesign(k = 3, centerCube = 4) dfac$names(c('Factor 1', 'Factor 2', 'Factor 3')) # Assign performance to the factorial design rend <- c(simProc(120,140,1), simProc(80,140,1), simProc(120,140,2), simProc(120,120,1), simProc(90,130,1.5), simProc(90,130,1.5), simProc(80,120,2), simProc(90,130,1.5), simProc(90,130,1.5), simProc(120,120,2), simProc(80,140,2), simProc(80,120,1)) dfac$.response(rend) # Create an interaction plot interactionPlot(dfac, fun = mean, col = c("purple", "red")) # Example 2 vp <- fracDesign(k=3, replicates = 2) y <- 4*vp$get(j=1) -7*vp$get(j=2) + 2*vp$get(j=2)*vp$get(j=1) + 0.2*vp$get(j=3) + rnorm(16) vp$.response(y) interactionPlot(vp)
# Example 1 # Create the facDesign object dfac <- facDesign(k = 3, centerCube = 4) dfac$names(c('Factor 1', 'Factor 2', 'Factor 3')) # Assign performance to the factorial design rend <- c(simProc(120,140,1), simProc(80,140,1), simProc(120,140,2), simProc(120,120,1), simProc(90,130,1.5), simProc(90,130,1.5), simProc(80,120,2), simProc(90,130,1.5), simProc(90,130,1.5), simProc(120,120,2), simProc(80,140,2), simProc(80,120,1)) dfac$.response(rend) # Create an interaction plot interactionPlot(dfac, fun = mean, col = c("purple", "red")) # Example 2 vp <- fracDesign(k=3, replicates = 2) y <- 4*vp$get(j=1) -7*vp$get(j=2) + 2*vp$get(j=2)*vp$get(j=1) + 0.2*vp$get(j=3) + rnorm(16) vp$.response(y) interactionPlot(vp)
Function to generate simplex lattice and simplex centroid mixture designs with optional center points and axial points.
mixDesign( p, n = 3, type = "lattice", center = TRUE, axial = FALSE, delta, replicates = 1, lower, total = 1, randomize, seed = 1234 )
mixDesign( p, n = 3, type = "lattice", center = TRUE, axial = FALSE, delta, replicates = 1, lower, total = 1, randomize, seed = 1234 )
p |
Numerical value giving the amount of factors. |
n |
Numerical value specifying the degree (ignored if type = 'centroid'). |
type |
Character string giving the type of design. |
center |
Logical value specifying whether (optional) center points will be added. By default 'center' is set to 'TRUE'. |
axial |
Logical value specifying whether (optional) axial points will be added. By default 'axial' is set to 'FALSE'. |
delta |
Numerical value giving the delta (see references) for axial runs. No default setting. |
replicates |
Vector with the number of replicates for the different design points i.e. c(center = 1, axial = 1, pureBlend = 1, BinaryBlend = 1, p-3 blend, p-2 blend, p-1 blend). By default 'replicates' is set to '1'. |
lower |
Numeric vector of lower-bound constraints on the component proportions (i.e. must be given in percent). |
total |
Numeric vector with
|
randomize |
Logical value. If 'TRUE' the RunOrder of the mixture design will be randomized (default). |
seed |
Nmerical value giving the input for set.seed. |
The function mixDesig()
returns an object of class mixDesig()
.
In this version the creation of (augmented) lattice, centroid mixture designs is fully supported. Getters and Setter methods for the mixDesign object exist just as for objects of class facDesign
(i.e. factorial designs).
The creation of constrained component proportions is partially supported but don't rely on it. Visualization (i.e. ternary plots) for some of these designs can be done with the help of the wirePlot3
and contourPlot3
function.
mixDesign.c
, facDesign.c
, facDesign
, fracDesign
, rsmDesign
, wirePlot3
, contourPlot3
.
# Example usage of mixDesign mdo <- mixDesign(3, 2, center = FALSE, axial = FALSE, randomize = FALSE, replicates = c(1, 1, 2, 3)) mdo$names(c("polyethylene", "polystyrene", "polypropylene")) elongation <- c(11.0, 12.4, 15.0, 14.8, 16.1, 17.7, 16.4, 16.6, 8.8, 10.0, 10.0, 9.7, 11.8, 16.8, 16.0) mdo$.response(elongation) mdo$units() mdo$summary()
# Example usage of mixDesign mdo <- mixDesign(3, 2, center = FALSE, axial = FALSE, randomize = FALSE, replicates = c(1, 1, 2, 3)) mdo$names(c("polyethylene", "polystyrene", "polypropylene")) elongation <- c(11.0, 12.4, 15.0, 14.8, 16.1, 17.7, 16.4, 16.6, 8.8, 10.0, 10.0, 9.7, 11.8, 16.8, 16.0) mdo$.response(elongation) mdo$units() mdo$summary()
mixDesign class for simplex lattice and simplex centroid mixture designs with optional center points and augmented points.
name
Character string representing the name of the design.
factors
List of factors involved in the mixture design, including their levels and settings.
total
Numeric value representing the total number of runs in the design.
lower
Numeric vector representing the lower bounds of the factors in the design.
design
Data frame containing the design matrix for the mixture design.
designType
Character string specifying the type of design (e.g., "simplex-lattice", "simplex-centroid").
pseudo
Data frame containing pseudo-experimental runs if applicable.
response
Data frame containing the responses or outcomes measured in the design.
Type
Data frame specifying the type of design used (e.g., "factorial", "response surface").
block
Data frame specifying block structures if the design is blocked.
runOrder
Data frame specifying the order in which runs are performed.
standardOrder
Data frame specifying the standard order of the runs.
desireVal
List of desired values or targets for the response variables.
desirability
List of desirability scores or metrics based on the desired values.
fits
Data frame containing the fitted model parameters and diagnostics.
.factors()
Get and set the factors
in an object of class mixDesign
mixDesign.c$.factors(value)
value
New factors, If missing value get the factors
.
names()
Get and set the names
in an object of class mixDesign
.
mixDesign.c$names(value)
value
New names, If missing value get the names
.
as.data.frame()
Methods for function as.data.frame
in Package base
.
mixDesign.c$as.data.frame()
print()
Methods for function print
in Package base
.
mixDesign.c$print()
.response()
Get and set the the response
in an object of class mixDesign
.
mixDesign.c$.response(value)
value
New response, If missing value get the response
.
.nfp()
Prints a summary of the factors attributes including their low, high, name, unit, and type.
mixDesign.c$.nfp()
summary()
Methods for function summary
in Package base
.
mixDesign.c$summary()
units()
Get and set the units
for the factors in an object of class mixDesign
.
mixDesign.c$units(value)
value
New units, If missing value get the units
.
lows()
Get and set the lows
for the factors in an object of class mixDesign
.
mixDesign.c$lows(value)
value
New lows, If missing value get the lows
.
highs()
Get and set the highs
for the factors in an object of class mixDesign
.
mixDesign.c$highs(value)
value
New highs, If missing value get the highs
.
clone()
The objects of this class are cloneable with this method.
mixDesign.c$clone(deep = FALSE)
deep
Whether to make a deep clone.
mixDesign
, contourPlot3
, wirePlot3
R6 class for performing Measurement System Analysis (MSA) Linearity studies.
X
A data frame containing the independent variable(s) used in the linearity study.
Y
A data frame containing the dependent variable(s) or responses measured in the linearity study.
model
The linear model object resulting from the linearity analysis.
conf.level
A numeric value specifying the confidence level for the linearity analysis. This should be between 0 and 1 (e.g., 0.95 for a 95% confidence level).
Linearity
A list or data frame containing the results of the linearity study, including the linearity value and associated statistics.
GageName
A character string specifying the name of the gage or measurement system under analysis.
GageTolerance
A numeric value specifying the tolerance of the gage or measurement system.
DateOfStudy
A character string or Date object indicating the date when the linearity study was conducted.
PersonResponsible
A character string specifying the name of the person responsible for the linearity study.
Comments
A character string for additional comments or notes about the linearity study.
facNames
A character vector specifying the names of the factors involved in the study, if any.
response()
Get and set the the response
in an object of class MSALinearity
.
MSALinearity$response(value)
value
New response, If missing value get the response
.
summary()
Methods for function summary
in Package base
.
MSALinearity$summary()
plot()
Plots the measurement system, including individual biases, mean bias, and a regression line with confidence intervals.
MSALinearity$plot(ylim, col, pch, lty = c(1, 2))
ylim
A numeric vector specifying the limits for the y-axis. If not provided, the limits are automatically calculated based on data.
col
A vector specifying the colors to be used for different plot elements.
pch
A numeric vector specifying the plotting characters (symbols) for individual data points and mean bias points.
lty
A numeric vector specifying the line types for the regression line and its confidence intervals. The default is c(1, 2)
.
print()
Methods for function print
in Package base
.
MSALinearity$print()
as.data.frame()
Return a data frame with the information of the object MSALinearity
.
MSALinearity$as.data.frame()
clone()
The objects of this class are cloneable with this method.
MSALinearity$clone(deep = FALSE)
deep
Whether to make a deep clone.
Creates a plot for visualizing the relationships between a response variable and multiple factors.
mvPlot( response, fac1, fac2, fac3, fac4, sort = TRUE, col, pch, labels = FALSE, quantile = TRUE, FUN = NA )
mvPlot( response, fac1, fac2, fac3, fac4, sort = TRUE, col, pch, labels = FALSE, quantile = TRUE, FUN = NA )
response |
The values of the |
fac1 |
Vector providing factor 1 as shown in the example. |
fac2 |
Vector providing factor 1 as shown in the example. |
fac3 |
Optional vector providing factor 3 as shown in the example. |
fac4 |
Optional vector providing factor 4 as shown in the example. |
sort |
Logical value indicating whether the sequence of the factors given by |
col |
Graphical parameter. Vector containing numerical values or character strings giving the colors for the different factors. By default |
pch |
Graphical parameter. Vector containing numerical values or single characters giving plotting points for the different factors. See |
labels |
Logical value indicating whether the single points should be labels with the row-number of the |
quantile |
A logical value indicating whether the quanitiles (0.00135, 0.5 & 0.99865) should be visualized for the single groups. By default |
FUN |
An optional function to be used for calculation of |
mvPlot
returns an invisible list cointaining: a data.frame in which all plotted points are listed and the final plot. The option labels can be used to plot the row-numbers at the single points and to ease the identification.
#Example I examp1 = expand.grid(c("Engine1","Engine2","Engine3"),c(10,20,30,40)) examp1 = as.data.frame(rbind(examp1, examp1, examp1)) examp1 = cbind(examp1, rnorm(36, 1, 0.02)) names(examp1) = c("factor1", "factor2", "response") mvPlot(response = examp1[,3], fac1 = examp1[,2],fac2 = examp1[,1],sort=FALSE,FUN=mean)
#Example I examp1 = expand.grid(c("Engine1","Engine2","Engine3"),c(10,20,30,40)) examp1 = as.data.frame(rbind(examp1, examp1, examp1)) examp1 = cbind(examp1, rnorm(36, 1, 0.02)) names(examp1) = c("factor1", "factor2", "response") mvPlot(response = examp1[,3], fac1 = examp1[,2],fac2 = examp1[,1],sort=FALSE,FUN=mean)
Creates a normal probability plot for the effects in a facDesign.c
object.
normalPlot( dfac, response = NULL, main, ylim, xlim, xlab, ylab, pch, col, border = "red" )
normalPlot( dfac, response = NULL, main, ylim, xlim, xlab, ylab, pch, col, border = "red" )
dfac |
An object of class |
response |
Response variable. If the response data frame of fdo consists of more then one responses, this variable can be used to choose just one column of the |
main |
Character string specifying the main title of the plot. |
ylim |
Graphical parameter. The y limits of the plot. |
xlim |
Graphical parameter. The x limits (x1, x2) of the plot. Note that x1 > x2 is allowed and leads to a 'reversed axis'. |
xlab |
Character string specifying the label for the x-axis. |
ylab |
Character string specifying the label for the y-axis. |
pch |
Graphical parameter. Vector containing numerical values or single characters giving plotting points for the different factors.
Accepts values from 0 to 25, each corresponding to a specific shape in |
col |
Graphical parameter. Single numerical value or character string giving the color for the points (e.g., 1: black, 2: red, 3: green). |
border |
Graphical parameter. Single numerical value or character string giving the color of the border line. |
If the given facDesign.c
object fdo
contains replicates this function will deliver a normal plot
i.e.: effects divided by the standard deviation (t-value) will be plotted against an appropriate probability
scaling (see: 'ppoints').
If the given facDesign.c
object fdo
contains no replications the standard error can not be calculated.
In that case the function will deliver an effect plot.
i.e.: the effects will be plotted against an appropriate probability scaling. (see: 'ppoints').
The function normalPlot
returns an invisible list containing:
effects |
a list of effects for each response in the |
plot |
The generated normal plot. |
facDesign
, paretoPlot
, interactionPlot
# Example 1: Create a normal probability plot for a full factorial design dfac <- facDesign(k = 3, centerCube = 4) dfac$names(c('Factor 1', 'Factor 2', 'Factor 3')) # Assign performance to the factorial design rend <- c(simProc(120,140,1), simProc(80,140,1), simProc(120,140,2), simProc(120,120,1), simProc(90,130,1.5), simProc(90,130,1.5), simProc(80,120,2), simProc(90,130,1.5), simProc(90,130,1.5), simProc(120,120,2), simProc(80,140,2), simProc(80,120,1)) dfac$.response(rend) normalPlot(dfac) # Example 2: Create a normal probability plot with custom colors and symbols normalPlot(dfac, col = "blue", pch = 4)
# Example 1: Create a normal probability plot for a full factorial design dfac <- facDesign(k = 3, centerCube = 4) dfac$names(c('Factor 1', 'Factor 2', 'Factor 3')) # Assign performance to the factorial design rend <- c(simProc(120,140,1), simProc(80,140,1), simProc(120,140,2), simProc(120,120,1), simProc(90,130,1.5), simProc(90,130,1.5), simProc(80,120,2), simProc(90,130,1.5), simProc(90,130,1.5), simProc(120,120,2), simProc(80,140,2), simProc(80,120,1)) dfac$.response(rend) normalPlot(dfac) # Example 2: Create a normal probability plot with custom colors and symbols normalPlot(dfac, col = "blue", pch = 4)
Shows a matrix of possible taguchi designs.
oaChoose(factors1, factors2, level1, level2, ia)
oaChoose(factors1, factors2, level1, level2, ia)
factors1 |
Number of factors on level1. |
factors2 |
Number of factors on level2. |
level1 |
Number of levels on level1. |
level2 |
Number of levels on level2. |
ia |
Number of interactions. |
oaChoose
returns possible taguchi designs. Specifying the number of factor1 factors with level1 levels (factors1 = 2, level1 = 3 means 2 factors with 3 factor levels) and factor2 factors with level2 levels and desired interactions one or more taguchi designs are suggested.
If all parameters are set to '0', a matrix of possible taguchi designs is shown.
oaChoose
returns an object of class taguchiDesign
.
facDesign
: for 2^k factorial designs.
rsmDesign
: for response surface designs.
fracDesign
: for fractional factorial design.
gageRRDesign
: for gage designs.
oaChoose()
oaChoose()
This function calculates the optimal factor settings based on defined desirabilities and constraints. It supports two approaches: (I) evaluating all possible factor settings via a grid search and (II) using optimization methods such as `optim`
or `gosolnp`
from the Rsolnp package. Using `optim`
initial values for the factors to be optimized over can be set via start.
The optimality of the solution depends critically on the starting parameters which is why it is recommended to use type=`gosolnp`
although calculation takes a while.
optimum(fdo, constraints, steps = 25, type = "grid", start)
optimum(fdo, constraints, steps = 25, type = "grid", start)
fdo |
An object of class |
constraints |
A list specifying the constraints for the factors, e.g., |
steps |
Number of grid points per factor if |
type |
The type of search to perform. Supported values are |
start |
A numeric vector providing the initial values for the factors when using |
The function allows you to optimize the factor settings either by evaluating a grid of possible settings (type = `grid`
) or by using optimization algorithms (type = `optim` or `gosolnp`
). The choice of optimization method may significantly affect the result, especially for desirability functions that lack continuous first derivatives. When using type = `optim`
, it is advisable to provide start
values to avoid local optima. The `gosolnp`
method is recommended for its robustness, although it may be computationally intensive.
Return an object of class desOpt
.
#Example 1: Simultaneous Optimization of Several Response Variables #Define the response surface design as given in the paper and sort via Standard Order fdo = rsmDesign(k = 3, alpha = 1.633, cc = 0, cs = 6) fdo = randomize(fdo, so = TRUE) #Attaching the 4 responses y1 = c(102, 120, 117, 198, 103, 132, 132, 139, 102, 154, 96, 163, 116, 153, 133, 133, 140, 142, 145, 142) y2 = c(900, 860, 800, 2294, 490, 1289, 1270, 1090, 770, 1690, 700, 1540, 2184, 1784, 1300, 1300, 1145, 1090, 1260, 1344) y3 = c(470, 410, 570, 240, 640, 270, 410, 380, 590, 260, 520, 380, 520, 290, 380, 380, 430, 430, 390, 390) y4 = c(67.5, 65, 77.5, 74.5, 62.5, 67, 78, 70, 76, 70, 63, 75, 65, 71, 70, 68.5, 68, 68, 69, 70) fdo$.response(data.frame(y1, y2, y3, y4)[c(5,2,3,8,1,6,7,4,9:20),]) #Setting names and real values of the factors fdo$names(c("silica", "silan", "sulfur")) fdo$highs(c(1.7, 60, 2.8)) fdo$lows(c(0.7, 40, 1.8)) #Setting the desires fdo$desires(desirability(y1, 120, 170, scale = c(1,1), target = "max")) fdo$desires(desirability(y2, 1000, 1300, target = "max")) fdo$desires(desirability(y3, 400, 600, target = 500)) fdo$desires(desirability(y4, 60, 75, target = 67.5)) #Setting the fits fdo$set.fits(fdo$lm(y1 ~ A + B + C + A:B + A:C + B:C + I(A^2) + I(B^2) + I(C^2))) fdo$set.fits(fdo$lm(y2 ~ A + B + C + A:B + A:C + B:C + I(A^2) + I(B^2) + I(C^2))) fdo$set.fits(fdo$lm(y3 ~ A + B + C + A:B + A:C + B:C + I(A^2) + I(B^2) + I(C^2))) fdo$set.fits(fdo$lm(y4 ~ A + B + C + A:B + A:C + B:C + I(A^2) + I(B^2) + I(C^2))) #Calculate the best factor settings using type = "optim" optimum(fdo, type = "optim") #Calculate the best factor settings using type = "grid" optimum(fdo, type = "grid")
#Example 1: Simultaneous Optimization of Several Response Variables #Define the response surface design as given in the paper and sort via Standard Order fdo = rsmDesign(k = 3, alpha = 1.633, cc = 0, cs = 6) fdo = randomize(fdo, so = TRUE) #Attaching the 4 responses y1 = c(102, 120, 117, 198, 103, 132, 132, 139, 102, 154, 96, 163, 116, 153, 133, 133, 140, 142, 145, 142) y2 = c(900, 860, 800, 2294, 490, 1289, 1270, 1090, 770, 1690, 700, 1540, 2184, 1784, 1300, 1300, 1145, 1090, 1260, 1344) y3 = c(470, 410, 570, 240, 640, 270, 410, 380, 590, 260, 520, 380, 520, 290, 380, 380, 430, 430, 390, 390) y4 = c(67.5, 65, 77.5, 74.5, 62.5, 67, 78, 70, 76, 70, 63, 75, 65, 71, 70, 68.5, 68, 68, 69, 70) fdo$.response(data.frame(y1, y2, y3, y4)[c(5,2,3,8,1,6,7,4,9:20),]) #Setting names and real values of the factors fdo$names(c("silica", "silan", "sulfur")) fdo$highs(c(1.7, 60, 2.8)) fdo$lows(c(0.7, 40, 1.8)) #Setting the desires fdo$desires(desirability(y1, 120, 170, scale = c(1,1), target = "max")) fdo$desires(desirability(y2, 1000, 1300, target = "max")) fdo$desires(desirability(y3, 400, 600, target = 500)) fdo$desires(desirability(y4, 60, 75, target = 67.5)) #Setting the fits fdo$set.fits(fdo$lm(y1 ~ A + B + C + A:B + A:C + B:C + I(A^2) + I(B^2) + I(C^2))) fdo$set.fits(fdo$lm(y2 ~ A + B + C + A:B + A:C + B:C + I(A^2) + I(B^2) + I(C^2))) fdo$set.fits(fdo$lm(y3 ~ A + B + C + A:B + A:C + B:C + I(A^2) + I(B^2) + I(C^2))) fdo$set.fits(fdo$lm(y4 ~ A + B + C + A:B + A:C + B:C + I(A^2) + I(B^2) + I(C^2))) #Calculate the best factor settings using type = "optim" optimum(fdo, type = "optim") #Calculate the best factor settings using type = "grid" optimum(fdo, type = "grid")
This function calculates the desirability for each response as well as the overall desirability. The resulting data.frame
can be used to plot the overall desirability as well as the desirabilities for each response. This function is designed to visualize the desirability approach for multiple response optimization.
overall(fdo, steps = 20, constraints, ...)
overall(fdo, steps = 20, constraints, ...)
fdo |
An object of class |
steps |
A numeric value indicating the number of points per factor to be evaluated, which also specifies the grid size. Default is '20'. |
constraints |
A list of constraints for the factors in coded values, such as |
... |
Further arguments passed to other methods. |
A data.frame
with a column for each factor, the desirability for each response, and a column for the overall desirability.
facDesign
, rsmDesign
, desirability
.
#Example 1: Arbitrary example with random data rsdo = rsmDesign(k = 2, blocks = 2, alpha = "both") rsdo$.response(data.frame(y = rnorm(rsdo$nrow()), y2 = rnorm(rsdo$nrow()))) rsdo$set.fits(rsdo$lm(y ~ A*B + I(A^2) + I(B^2))) rsdo$set.fits(rsdo$lm(y2 ~ A*B + I(A^2) + I(B^2))) rsdo$desires(desirability(y, -1, 2, scale = c(1, 1), target = "max")) rsdo$desires(desirability(y2, -1, 0, scale = c(1, 1), target = "min")) dVals = overall(rsdo, steps = 10, constraints = list(A = c(-0.5,1), B = c(0, 1)))
#Example 1: Arbitrary example with random data rsdo = rsmDesign(k = 2, blocks = 2, alpha = "both") rsdo$.response(data.frame(y = rnorm(rsdo$nrow()), y2 = rnorm(rsdo$nrow()))) rsdo$set.fits(rsdo$lm(y ~ A*B + I(A^2) + I(B^2))) rsdo$set.fits(rsdo$lm(y2 ~ A*B + I(A^2) + I(B^2))) rsdo$desires(desirability(y, -1, 2, scale = c(1, 1), target = "max")) rsdo$desires(desirability(y2, -1, 0, scale = c(1, 1), target = "min")) dVals = overall(rsdo, steps = 10, constraints = list(A = c(-0.5,1), B = c(0, 1)))
Function to create a Pareto chart, displaying the relative frequency of categories.
paretoChart( x, weight, main, col, border, xlab, ylab = "Frequency", percentVec, showTable = TRUE, showPlot = TRUE )
paretoChart( x, weight, main, col, border, xlab, ylab = "Frequency", percentVec, showTable = TRUE, showPlot = TRUE )
x |
A vector of qualitative values. |
weight |
A numeric vector of weights corresponding to each category in |
main |
A character string for the main title of the plot. |
col |
A numerical value or character string defining the fill-color of the bars. |
border |
A numerical value or character string defining the border-color of the bars. |
xlab |
A character string for the x-axis label. |
ylab |
A character string for the y-axis label. By default, |
percentVec |
A numerical vector giving the position and values of tick marks for percentage axis. |
showTable |
Logical value indicating whether to display a table of frequencies. By default, |
showPlot |
Logical value indicating whether to display the Pareto chart. By default, |
paretoChart
returns a Pareto chart along with a frequency table if showTable
is TRUE
.
Additionally, the function returns an invisible list containing:
plot |
The generated Pareto chart. |
table |
A data.frame with the frequencies and percentages of the categories. |
# Example 1: Creating a Pareto chart for defect types defects1 <- c(rep("E", 62), rep("B", 15), rep("F", 3), rep("A", 10), rep("C", 20), rep("D", 10)) paretoChart(defects1) # Example 2: Creating a Pareto chart with weighted frequencies defects2 <- c("E", "B", "F", "A", "C", "D") frequencies <- c(62, 15, 3, 10, 20, 10) weights <- c(1.5, 2, 0.5, 1, 1.2, 1.8) names(weights) <- defects2 # Assign names to the weights vector paretoChart(defects2, weight = frequencies * weights)
# Example 1: Creating a Pareto chart for defect types defects1 <- c(rep("E", 62), rep("B", 15), rep("F", 3), rep("A", 10), rep("C", 20), rep("D", 10)) paretoChart(defects1) # Example 2: Creating a Pareto chart with weighted frequencies defects2 <- c("E", "B", "F", "A", "C", "D") frequencies <- c(62, 15, 3, 10, 20, 10) weights <- c(1.5, 2, 0.5, 1, 1.2, 1.8) names(weights) <- defects2 # Assign names to the weights vector paretoChart(defects2, weight = frequencies * weights)
Display standardized effects and interactions of a facDesign.c
object in a pareto plot.
paretoPlot( dfac, abs = TRUE, decreasing = TRUE, alpha = 0.05, response = NULL, ylim, xlab, ylab, main, p.col, legend_left = TRUE )
paretoPlot( dfac, abs = TRUE, decreasing = TRUE, alpha = 0.05, response = NULL, ylim, xlab, ylab, main, p.col, legend_left = TRUE )
dfac |
An object of class facDesign. |
abs |
Logical. If |
decreasing |
Logical. If |
alpha |
The significance level used to calculate the critical value |
response |
Response variable. If the response data frame of fdo consists of more then one responses, this variable can be used to choose just one column of the response data frame. |
ylim |
Numeric vector of length 2: limits for the y-axis. If missing, the limits are set automatically. |
xlab |
Character string: label for the x-axis. |
ylab |
Character string: label for the y-axis. |
main |
Character string: title of the plot. |
p.col |
Character string specifying the color palette to use for the plot. Must be one of the following values from the
|
legend_left |
Logical value indicating whether to place the legend on the left side of the plot. Default is |
paretoPlot
displays a pareto plot of effects and interactions for an object of class facDesign (i.e. 2^k full or 2^k-p fractional factorial design). For a given significance level alpha, a critical value is calculated and added to the plot. Standardization is achieved by dividing estimates with their standard error. For unreplicated fractional factorial designs a Lenth Plot is generated.
The function paretoPlot
returns an invisible list containing:
effects |
a list of effects for each response in the |
plot |
The generated PP plot. |
# Create the facDesign object dfac <- facDesign(k = 3, centerCube = 4) dfac$names(c('Factor 1', 'Factor 2', 'Factor 3')) # Assign performance to the factorial design rend <- c(simProc(120,140,1), simProc(80,140,1), simProc(120,140,2), simProc(120,120,1), simProc(90,130,1.5), simProc(90,130,1.5), simProc(80,120,2), simProc(90,130,1.5), simProc(90,130,1.5), simProc(120,120,2), simProc(80,140,2), simProc(80,120,1)) dfac$.response(rend) paretoPlot(dfac) paretoPlot(dfac, decreasing = TRUE, abs = FALSE, p.col = "Pastel1")
# Create the facDesign object dfac <- facDesign(k = 3, centerCube = 4) dfac$names(c('Factor 1', 'Factor 2', 'Factor 3')) # Assign performance to the factorial design rend <- c(simProc(120,140,1), simProc(80,140,1), simProc(120,140,2), simProc(120,120,1), simProc(90,130,1.5), simProc(90,130,1.5), simProc(80,120,2), simProc(90,130,1.5), simProc(90,130,1.5), simProc(120,120,2), simProc(80,140,2), simProc(80,120,1)) dfac$.response(rend) paretoPlot(dfac) paretoPlot(dfac, decreasing = TRUE, abs = FALSE, p.col = "Pastel1")
Function to create a Plackett-Burman design.
pbDesign(n, k, randomize = TRUE, replicates = 1)
pbDesign(n, k, randomize = TRUE, replicates = 1)
n |
Integer value giving the number of trials. |
k |
Integer value giving the number of factors. |
randomize |
A logical value ( |
replicates |
An integer specifying the number of replicates for each run in the design. |
A pbDesign
returns an object of class pbDesign
.
This function creates Placket-Burman Designs down to n=26. Bigger Designs are not implemented because of lack in practicability. For the creation either the number of factors or the number of trials can be denoted. Wrong combinations will lead to an error message. Originally Placket-Burman-Design are applicable for number of trials divisible by 4. If n is not divisble by 4 this function will take the next larger Placket-Burman Design and truncate the last rows and columns.
facDesign
: for 2^k factorial designs.
rsmDesign
: for response surface designs.
fracDesign
: for fractional factorial design.
gageRRDesign
: for gage designs.
pbdo<- pbDesign(n=5) pbdo$summary()
pbdo<- pbDesign(n=5) pbdo$summary()
An R6 class representing a Plackett-Burman design.
name
A character string specifying the name of the design. Default is NULL
.
factors
A list of factors included in the Taguchi design. Each factor is typically an instance of the pbFactor
class.
design
A data.frame
representing the design matrix of the experiment. This includes the levels of each factor for every run of the experiment. Default is an empty data.frame
.
designType
A character string specifying the type of Taguchi design used. Default is NULL
.
replic
A data.frame
containing the replication information for the design. Default is an empty data.frame
.
response
A data.frame
storing the response values collected from the experiment. Default is an empty data.frame
.
Type
A data.frame
specifying the type of responses or factors involved in the design. Default is an empty data.frame
.
block
A data.frame
indicating any blocking factors used in the design. Default is an empty data.frame
.
runOrder
A data.frame
detailing the order in which the experimental runs were conducted. Default is an empty data.frame
.
standardOrder
A data.frame
detailing the standard order of the experimental runs. Default is an empty data.frame
.
desireVal
A list storing desired values for responses in the experiment. Default is an empty list.
desirability
A list storing desirability functions used to evaluate the outcomes of the experiment. Default is an empty list.
fits
A data.frame
containing model fits or other statistical summaries from the analysis of the experimental data. Default is an empty data.frame
.
values()
Get and set the values
for an object of class pbDesign
.
pbDesign.c$values(value)
value
New value, If missing value get the values
.
units()
Get and set the units
for an object of class pbDesign
.
pbDesign.c$units(value)
value
New units, If missing value get the units
.
.factors()
Get and set the factors
in an object of class pbDesign
.
pbDesign.c$.factors(value)
value
New factors, If missing value get the factors
.
names()
Get and set the names
in an object of class pbDesign
.
pbDesign.c$names(value)
value
New names, If missing value get the names
.
as.data.frame()
Return a data frame with the information of the object pbDesign
.
pbDesign.c$as.data.frame()
print()
Methods for function print
in Package base
.
pbDesign.c$print()
.response()
Get and set the the response
in an object of class pbDesign
.
pbDesign.c$.response(value)
value
New response, If missing value get the response
.
.nfp()
Prints a summary of the factors attributes including their low, high, name, unit, and type.
pbDesign.c$.nfp()
summary()
Methods for function summary
in Package base
.
pbDesign.c$summary()
clone()
The objects of this class are cloneable with this method.
pbDesign.c$clone(deep = FALSE)
deep
Whether to make a deep clone.
An R6 class representing a factor in a Plackett-Burman design.
values
A vector containing the levels or values associated with the factor. Default is NA
.
name
A character string specifying the name of the factor. Default is an empty string ``
.
unit
A character string specifying the unit of measurement for the factor. Default is an empty string ``
.
type
A character string specifying the type of the factor, which can be either `numeric`
or `categorical`
. Default is `numeric`
.
attributes()
Get the attributes of the factor.
pbFactor$attributes()
.values()
Get and set the values
for the factors in an object of class pbFactor
.
pbFactor$.values(value)
value
New values, If missing value get the values
.
.unit()
Get and set the units
for the factors in an object of class pbFactor
.
pbFactor$.unit(value)
value
New unit, If missing value get the units
.
names()
Get and set the names
in an object of class pbFactor
.
pbFactor$names(value)
value
New names, If missing value get the names
.
clone()
The objects of this class are cloneable with this method.
pbFactor$clone(deep = FALSE)
deep
Whether to make a deep clone.
Calculates the process capability cp
, cpk
, cpkL
(onesided) and cpkU
(onesided) for a given dataset and distribution.
A histogram with a density curve is displayed along with the specification limits and a Quantile-Quantile Plot for the specified distribution.
Lower-, upper and total fraction of nonconforming entities are calculated. Box-Cox Transformations are supported as well as the calculation of Anderson Darling Test Statistics.
pcr( x, distribution = "normal", lsl, usl, target, boxcox = FALSE, lambda = c(-5, 5), main, xlim, grouping = NULL, std.dev = NULL, conf.level = 0.9973002, bounds.lty = 3, bounds.col = "red", col.fill = "lightblue", col.border = "black", col.curve = "red", plot = TRUE, ADtest = TRUE )
pcr( x, distribution = "normal", lsl, usl, target, boxcox = FALSE, lambda = c(-5, 5), main, xlim, grouping = NULL, std.dev = NULL, conf.level = 0.9973002, bounds.lty = 3, bounds.col = "red", col.fill = "lightblue", col.border = "black", col.curve = "red", plot = TRUE, ADtest = TRUE )
x |
Numeric vector containing the values for which the process capability should be calculated. |
distribution |
Character string specifying the distribution of
By default |
lsl |
A numeric value specifying the lower specification limit. |
usl |
A numeric value specifying the upper specification limit. |
target |
(Optional) numeric value giving the target value. |
boxcox |
Logical value specifying whether a Box-Cox transformation should be performed or not. By default |
lambda |
(Optional) lambda for the transformation, default is to have the function estimate lambda. |
main |
A character string specifying the main title of the plot. |
xlim |
A numeric vector of length 2 specifying the x-axis limits for the plot. |
grouping |
(Optional) If grouping is given the standard deviation is calculated as mean standard deviation of the specified subgroups corrected by the factor |
std.dev |
An optional numeric value specifying the historical standard deviation (only provided for normal distribution). If |
conf.level |
Numeric value between |
bounds.lty |
graphical parameter. For further details see |
bounds.col |
A character string specifying the color of the capability bounds. Default is "red". |
col.fill |
A character string specifying the fill color for the histogram plot. Default is "lightblue". |
col.border |
A character string specifying the border color for the histogram plot. Default is "black". |
col.curve |
A character string specifying the color of the fitted distribution curve. Default is "red". |
plot |
A logical value indicating whether to generate a plot. Default is |
ADtest |
A logical value indicating whether to print the Anderson-Darling. Default is |
Distribution fitting is delegated to the function FitDistr
from this package, as well as the calculation of lambda for the Box-Cox Transformation. p-values for the Anderson-Darling Test are reported for the most important distributions.
The process capability indices are calculated as follows:
cpk: minimum of cpK
and cpL
.
pt: total fraction nonconforming.
pu: upper fraction nonconforming.
pl: lower fraction nonconforming.
cp: process capability index.
cpkL: lower process capability index.
cpkU: upper process capability index.
cpk: minimum process capability index.
For a Box-Cox transformation, a data vector with positive values is needed to estimate an optimal value of lambda for the Box-Cox power transformation of the values. The Box-Cox power transformation is used to bring the distribution of the data vector closer to normality. Estimation of the optimal lambda is delegated to the function boxcox
from the MASS
package. The Box-Cox transformation has the form for
, and
for
. The function
boxcox
computes the profile log-likelihoods for a range of values of the parameter lambda. The function boxcox.lambda
returns the value of lambda with the maximum profile log-likelihood.
In case no specification limits are given, lsl
and usl
are calculated to support a process capability index of 1.
The function returns a list with the following components:
The function pcr
returns a list with lambda
, cp
, cpl
, cpu
, ppt
, ppl
, ppu
, A
, usl
, lsl
, target
, asTest
, plot
.
set.seed(1234) data <- rnorm(20, mean = 20) pcr(data, "normal", lsl = 17, usl = 23) set.seed(1234) weib <- rweibull(20, shape = 2, scale = 8) pcr(weib, "weibull", usl = 20)
set.seed(1234) data <- rnorm(20, mean = 20) pcr(data, "normal", lsl = 17, usl = 23) set.seed(1234) weib <- rweibull(20, shape = 2, scale = 8) pcr(weib, "weibull", usl = 20)
Density function, distribution function, and quantile function for the Gamma distribution.
pgamma3(q, shape, scale, threshold)
pgamma3(q, shape, scale, threshold)
q |
A numeric vector of quantiles. |
shape |
The shape parameter, default is |
scale |
The scale parameter, default is |
threshold |
The threshold parameter, default is |
The Gamma distribution with scale
parameter alpha, shape
parameter c, and threshold
parameter zeta has a density given by:
The cumulative distribution function is given by:
dgamma3
gives the density, pgamma3
gives the distribution function, and qgamma3
gives the quantile function.
dgamma3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pgamma3(q = 1, scale = 1, shape = 5, threshold = 0) temp qgamma3(p = temp, scale = 1, shape = 5, threshold = 0)
dgamma3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pgamma3(q = 1, scale = 1, shape = 5, threshold = 0) temp qgamma3(p = temp, scale = 1, shape = 5, threshold = 0)
Density function, distribution function, and quantile function for the Lognormal distribution.
plnorm3(q, meanlog, sdlog, threshold)
plnorm3(q, meanlog, sdlog, threshold)
q |
A numeric vector of quantiles. |
meanlog , sdlog
|
The mean and standard deviation of the distribution on the log scale with default values of |
threshold |
The threshold parameter, default is |
The Lognormal distribution with meanlog
parameter zeta, sdlog
parameter sigma, and threshold
parameter theta has a density given by:
The cumulative distribution function is given by:
where is the cumulative distribution function of the standard normal distribution.
dlnorm3
gives the density, plnorm3
gives the distribution function, and qlnorm3
gives the quantile function.
dlnorm3(x = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp <- plnorm3(q = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp qlnorm3(p = temp, meanlog = 0, sdlog = 1/8, threshold = 1)
dlnorm3(x = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp <- plnorm3(q = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp qlnorm3(p = temp, meanlog = 0, sdlog = 1/8, threshold = 1)
Function ppPlot
creates a Probability plot of the values in x including a line.
ppPlot( x, distribution, confbounds = TRUE, alpha, probs, main, xlab, ylab, xlim, ylim, border = "red", bounds.col = "black", bounds.lty = 1, start, showPlot = TRUE, axis.y.right = FALSE, bw.theme = FALSE )
ppPlot( x, distribution, confbounds = TRUE, alpha, probs, main, xlab, ylab, xlim, ylim, border = "red", bounds.col = "black", bounds.lty = 1, start, showPlot = TRUE, axis.y.right = FALSE, bw.theme = FALSE )
x |
Numeric vector containing the sample data for the |
distribution |
Character string specifying the distribution of x. The function
By default |
confbounds |
Logical value: whether to display confidence bounds. Default is |
alpha |
Numeric value: significance level for confidence bounds, default is '0.05'. |
probs |
Vector containing the percentages for the y axis. All the values need to be between '0' and '1'. If 'probs' is missing it will be calculated internally. |
main |
Character string: title of the plot. |
xlab |
Character string: label for the x-axis. |
ylab |
Character string: label for the y-axis. |
xlim |
Numeric vector of length 2: limits for the x-axis. |
ylim |
Numeric vector of length 2: limits for the y-axis. |
border |
Character or numeric: color for the border of the line through the quantiles. Default is |
bounds.col |
Character or numeric: color for the confidence bounds lines. Default is |
bounds.lty |
Numeric or character: line type for the confidence bounds lines. This can be specified with either an integer (0-6) or a name:
Default is '1' (solid line). |
start |
A named list giving the parameters to be fitted with initial values. Must be supplied for some distributions (see Details). |
showPlot |
Logical value indicating whether to display the plot. By default, |
axis.y.right |
Logical value indicating whether to display the y-axis on the right side. By default, |
bw.theme |
Logical value indicating whether to use a black-and-white theme from the |
Distribution fitting is performed using the FitDistr
function from this package.
For the computation of the confidence bounds, the variance of the quantiles is estimated using the delta method,
which involves the estimation of the observed Fisher Information matrix as well as the gradient of the CDF of the fitted distribution.
Where possible, those values are replaced by their normal approximation.
The function ppPlot
returns an invisible list containing:
x |
x coordinates. |
y |
y coordinates. |
int |
Intercept. |
slope |
Slope. |
plot |
The generated PP plot. |
set.seed(123) ppPlot(rnorm(20, mean=90, sd=5), "normal",alpha=0.30) ppPlot(rcauchy(100), "cauchy") ppPlot(rweibull(50, shape = 1, scale = 1), "weibull") ppPlot(rlogis(50), "logistic") ppPlot(rlnorm(50) , "log-normal") ppPlot(rbeta(10, 0.7, 1.5),"beta") ppPlot(rpois(20,3), "poisson") ppPlot(rchisq(20, 10),"chi-squared") ppPlot(rgeom(20, prob = 1/4), "geometric") ppPlot(rnbinom(n = 20, size = 3, prob = 0.2), "negative binomial") ppPlot(rf(20, df1 = 10, df2 = 20), "f")
set.seed(123) ppPlot(rnorm(20, mean=90, sd=5), "normal",alpha=0.30) ppPlot(rcauchy(100), "cauchy") ppPlot(rweibull(50, shape = 1, scale = 1), "weibull") ppPlot(rlogis(50), "logistic") ppPlot(rlnorm(50) , "log-normal") ppPlot(rbeta(10, 0.7, 1.5),"beta") ppPlot(rpois(20,3), "poisson") ppPlot(rchisq(20, 10),"chi-squared") ppPlot(rgeom(20, prob = 1/4), "geometric") ppPlot(rnbinom(n = 20, size = 3, prob = 0.2), "negative binomial") ppPlot(rf(20, df1 = 10, df2 = 20), "f")
Function to show adtest
.
print_adtest(x, digits = 4, quote = TRUE, prefix = "", ...)
print_adtest(x, digits = 4, quote = TRUE, prefix = "", ...)
x |
Needs to be an object of class |
digits |
Minimal number of significant digits. |
quote |
Logical, indicating whether or not strings should be printed with surrounding quotes.
By default |
prefix |
Single character or character string that will be printed in front of |
... |
Further arguments passed to or from other methods. |
The function returns a summary of Anderson Darling Test
data <- rnorm(20, mean = 20) pcr1<-pcr(data, "normal", lsl = 17, usl = 23, plot = FALSE) print_adtest(pcr1$adTest)
data <- rnorm(20, mean = 20) pcr1<-pcr(data, "normal", lsl = 17, usl = 23, plot = FALSE) print_adtest(pcr1$adTest)
Density function, distribution function, and quantile function for the Weibull distribution with a threshold parameter.
pweibull3(q, shape, scale, threshold)
pweibull3(q, shape, scale, threshold)
q |
A numeric vector of quantiles. |
shape |
The shape parameter of the Weibull distribution. Default is 1. |
scale |
The scale parameter of the Weibull distribution. Default is 1. |
threshold |
The threshold (or location) parameter of the Weibull distribution. Default is 0. |
The Weibull distribution with the scale
parameter alpha, shape
parameter c, and threshold
parameter zeta has a density function given by:
The cumulative distribution function is given by:
dweibull3
returns the density, pweibull3
returns the distribution function, and qweibull3
returns the quantile function for the Weibull distribution with a threshold.
dweibull3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pweibull3(q = 1, scale = 1, shape = 5, threshold = 0) temp qweibull3(p = temp, scale = 1, shape = 5, threshold = 0)
dweibull3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pweibull3(q = 1, scale = 1, shape = 5, threshold = 0) temp qweibull3(p = temp, scale = 1, shape = 5, threshold = 0)
Density function, distribution function, and quantile function for the Gamma distribution.
qgamma3(p, shape, scale, threshold, ...)
qgamma3(p, shape, scale, threshold, ...)
p |
A numeric vector of probabilities. |
shape |
The shape parameter, default is |
scale |
The scale parameter, default is |
threshold |
The threshold parameter, default is |
... |
Additional arguments that can be passed to |
The Gamma distribution with scale
parameter alpha, shape
parameter c, and threshold
parameter zeta has a density given by:
The cumulative distribution function is given by:
dgamma3
gives the density, pgamma3
gives the distribution function, and qgamma3
gives the quantile function.
dgamma3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pgamma3(q = 1, scale = 1, shape = 5, threshold = 0) temp qgamma3(p = temp, scale = 1, shape = 5, threshold = 0)
dgamma3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pgamma3(q = 1, scale = 1, shape = 5, threshold = 0) temp qgamma3(p = temp, scale = 1, shape = 5, threshold = 0)
Density function, distribution function, and quantile function for the Lognormal distribution.
qlnorm3(p, meanlog, sdlog, threshold, ...)
qlnorm3(p, meanlog, sdlog, threshold, ...)
p |
A numeric vector of probabilities. |
meanlog , sdlog
|
The mean and standard deviation of the distribution on the log scale with default values of |
threshold |
The threshold parameter, default is |
... |
Additional arguments that can be passed to |
The Lognormal distribution with meanlog
parameter zeta, sdlog
parameter sigma, and threshold
parameter theta has a density given by:
The cumulative distribution function is given by:
where is the cumulative distribution function of the standard normal distribution.
dlnorm3
gives the density, plnorm3
gives the distribution function, and qlnorm3
gives the quantile function.
dlnorm3(x = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp <- plnorm3(q = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp qlnorm3(p = temp, meanlog = 0, sdlog = 1/8, threshold = 1)
dlnorm3(x = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp <- plnorm3(q = 2, meanlog = 0, sdlog = 1/8, threshold = 1) temp qlnorm3(p = temp, meanlog = 0, sdlog = 1/8, threshold = 1)
Function qqPlot
creates a QQ plot of the values in x including a line which passes through the first and third quartiles.
qqPlot( x, y, confbounds = TRUE, alpha, main, xlab, ylab, xlim, ylim, border = "red", bounds.col = "black", bounds.lty = 1, start, showPlot = TRUE, axis.y.right = FALSE, bw.theme = FALSE )
qqPlot( x, y, confbounds = TRUE, alpha, main, xlab, ylab, xlim, ylim, border = "red", bounds.col = "black", bounds.lty = 1, start, showPlot = TRUE, axis.y.right = FALSE, bw.theme = FALSE )
x |
The sample for qqPlot. |
y |
Character string specifying the distribution of
By default |
confbounds |
Logical value indicating whether to display confidence bounds. By default, |
alpha |
Numeric value specifying the significance level for the confidence bounds, set to '0.05' by default. |
main |
A character string for the main title of the plot. |
xlab |
A character string for the x-axis label. |
ylab |
A character string for the y-axis label. |
xlim |
A numeric vector of length 2 to specify the limits of the x-axis. |
ylim |
A numeric vector of length 2 to specify the limits of the y-axis. |
border |
A numerical value or single character string giving the color of the interpolation line. By default, |
bounds.col |
A numerical value or single character string giving the color of the confidence bounds lines. By default, |
bounds.lty |
A numeric or character: line type for the confidence bounds lines. This can be specified with either an integer (0-6) or a name:
Default is '1' (solid line). |
start |
A named list giving the parameters to be fitted with initial values. Must be supplied for some distributions (see Details). |
showPlot |
Logical value indicating whether to display the plot. By default, |
axis.y.right |
Logical value indicating whether to display the y-axis on the right side. By default, |
bw.theme |
Logical value indicating whether to use a black-and-white theme from the |
Distribution fitting is performed using the FitDistr
function from this package.
For the computation of the confidence bounds, the variance of the quantiles is estimated using the delta method,
which involves the estimation of the observed Fisher Information matrix as well as the gradient of the CDF of the fitted distribution.
Where possible, those values are replaced by their normal approximation.
The function qqPlot
returns an invisible list containing:
x |
Sample quantiles. |
y |
Theoretical quantiles. |
int |
Intercept of the fitted line. |
slope |
Slope of the fitted line. |
plot |
The generated QQ plot. |
set.seed(123) qqPlot(rnorm(20, mean=90, sd=5), "normal",alpha=0.30) qqPlot(rcauchy(100), "cauchy") qqPlot(rweibull(50, shape = 1, scale = 1), "weibull") qqPlot(rlogis(50), "logistic") qqPlot(rlnorm(50) , "log-normal") qqPlot(rbeta(10, 0.7, 1.5),"beta") qqPlot(rpois(20,3), "poisson") qqPlot(rchisq(20, 10),"chi-squared") qqPlot(rgeom(20, prob = 1/4), "geometric") qqPlot(rnbinom(n = 20, size = 3, prob = 0.2), "negative binomial") qqPlot(rf(20, df1 = 10, df2 = 20), "f")
set.seed(123) qqPlot(rnorm(20, mean=90, sd=5), "normal",alpha=0.30) qqPlot(rcauchy(100), "cauchy") qqPlot(rweibull(50, shape = 1, scale = 1), "weibull") qqPlot(rlogis(50), "logistic") qqPlot(rlnorm(50) , "log-normal") qqPlot(rbeta(10, 0.7, 1.5),"beta") qqPlot(rpois(20,3), "poisson") qqPlot(rchisq(20, 10),"chi-squared") qqPlot(rgeom(20, prob = 1/4), "geometric") qqPlot(rnbinom(n = 20, size = 3, prob = 0.2), "negative binomial") qqPlot(rf(20, df1 = 10, df2 = 20), "f")
Density function, distribution function, and quantile function for the Weibull distribution with a threshold parameter.
qweibull3(p, shape, scale, threshold, ...)
qweibull3(p, shape, scale, threshold, ...)
p |
A numeric vector of probabilities. |
shape |
The shape parameter of the Weibull distribution. Default is 1. |
scale |
The scale parameter of the Weibull distribution. Default is 1. |
threshold |
The threshold (or location) parameter of the Weibull distribution. Default is 0. |
... |
Additional arguments passed to |
The Weibull distribution with the scale
parameter alpha, shape
parameter c, and threshold
parameter zeta has a density function given by:
The cumulative distribution function is given by:
dweibull3
returns the density, pweibull3
returns the distribution function, and qweibull3
returns the quantile function for the Weibull distribution with a threshold.
dweibull3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pweibull3(q = 1, scale = 1, shape = 5, threshold = 0) temp qweibull3(p = temp, scale = 1, shape = 5, threshold = 0)
dweibull3(x = 1, scale = 1, shape = 5, threshold = 0) temp <- pweibull3(q = 1, scale = 1, shape = 5, threshold = 0) temp qweibull3(p = temp, scale = 1, shape = 5, threshold = 0)
Function to do randomize the run order of factorial designs.
randomize(fdo, random.seed = 93275938, so = FALSE)
randomize(fdo, random.seed = 93275938, so = FALSE)
fdo |
An object of class |
random.seed |
Seed for randomness. |
so |
Logical value specifying whether the standard order should be used or not. By default |
An object of class facDesign.c
with the run order randomized.
dfrac <- fracDesign(k = 3) randomize(dfrac)
dfrac <- fracDesign(k = 3) randomize(dfrac)
Designs displayed are central composite designs with orthogonal blocking and near rotatability. The function allows users to choose a design by clicking with the mouse into the appropriate field.
rsmChoose()
rsmChoose()
Returns an object of class facDesign.c
.
rsmChoose()
rsmChoose()
Generates a response surface design containing a cube, centerCube, star, and centerStar portion.
rsmDesign( k = 3, p = 0, alpha = "rotatable", blocks = 1, cc = 1, cs = 1, fp = 1, sp = 1, faceCentered = FALSE )
rsmDesign( k = 3, p = 0, alpha = "rotatable", blocks = 1, cc = 1, cs = 1, fp = 1, sp = 1, faceCentered = FALSE )
k |
Integer value giving the number of factors. By default, |
p |
Integer value giving the number of additional factors in the response surface design by aliasing effects. Default is '0'. |
alpha |
Character string indicating the type of star points to generate. Should be |
blocks |
Integer value specifying the number of blocks in the response surface design. Default is '1'. |
cc |
Integer value giving the number of centerpoints (per block) in the cube portion (i.e., the factorial 2^k design) of the response surface design. Default is '1'. |
cs |
Integer value specifying the number of centerpoints in the star portion. Default is '1'. |
fp |
Integer value giving the number of replications per factorial point (i.e., corner points). Default is '1'. |
sp |
Integer value specifying the number of replications per star point. Default is '1'. |
faceCentered |
Logical value indicating whether to use a faceCentered response surface design (i.e., |
Generated designs consist of a cube, centerCube, star, and centerStar portion. The replication structure can be set with the parameters cc
(centerCube), cs
(centerStar), fp
(factorialPoints), and sp
(starPoints).
The function returns an object of class facDesign.c
.
facDesign
, fracDesign
, fracChoose
, pbDesign
, rsmChoose
# Example 1: Central composite design for 2 factors with 2 blocks, alpha = 1.41, # 5 centerpoints in the cube portion and 3 centerpoints in the star portion: rsmDesign(k = 2, blocks = 2, alpha = sqrt(2), cc = 5, cs = 3) # Example 2: Central composite design with both, orthogonality and near rotatability rsmDesign(k = 2, blocks = 2, alpha = "both") # Example 3: Central composite design with: # 2 centerpoints in the factorial portion of the design (i.e., 2) # 1 centerpoint in the star portion of the design (i.e., 1) # 2 replications per factorial point (i.e., 2^3*2 = 16) # 3 replications per star point (i.e., 3*2*3 = 18) # Makes a total of 37 factor combinations rsdo = rsmDesign(k = 3, blocks = 1, alpha = 2, cc = 2, cs = 1, fp = 2, sp = 3)
# Example 1: Central composite design for 2 factors with 2 blocks, alpha = 1.41, # 5 centerpoints in the cube portion and 3 centerpoints in the star portion: rsmDesign(k = 2, blocks = 2, alpha = sqrt(2), cc = 5, cs = 3) # Example 2: Central composite design with both, orthogonality and near rotatability rsmDesign(k = 2, blocks = 2, alpha = "both") # Example 3: Central composite design with: # 2 centerpoints in the factorial portion of the design (i.e., 2) # 1 centerpoint in the star portion of the design (i.e., 1) # 2 replications per factorial point (i.e., 2^3*2 = 16) # 3 replications per star point (i.e., 3*2*3 = 18) # Makes a total of 37 factor combinations rsdo = rsmDesign(k = 3, blocks = 1, alpha = 2, cc = 2, cs = 1, fp = 2, sp = 3)
This is a function to simulate a black box process for teaching the use of designed experiments. The optimal factor settings can be found using a sequential assembly strategy i.e. apply a 2^k factorial design first, calculate the path of the steepest ascent, again apply a 2^k factorial design and augment a star portion to find the optimal factor settings. Of course, other strategies are possible.
simProc(x1, x2, x3, noise = TRUE)
simProc(x1, x2, x3, noise = TRUE)
x1 |
numeric vector containing the values for factor 1. |
x2 |
numeric vector containing the values for factor 2. |
x3 |
numeric vector containing the values for factor 3. |
noise |
logical value deciding whether noise should be added or not. Default setting is |
simProc
returns a numeric value within the range [0,1].
simProc(120, 140, 1) simProc(120, 220, 1) simProc(160, 140, 1)
simProc(120, 140, 1) simProc(120, 220, 1) simProc(160, 140, 1)
Creates a Signal-to-Noise Ratio plot for designs of type taguchiDesign.c
with at least two replicates.
snPlot(object, type = "nominal", factors, fun = mean, response = NULL, points = FALSE, classic = FALSE, lty, xlab, ylab, main, ylim, l.col, p.col, ld.col, pch)
snPlot(object, type = "nominal", factors, fun = mean, response = NULL, points = FALSE, classic = FALSE, lty, xlab, ylab, main, ylim, l.col, p.col, ld.col, pch)
object |
An object of class |
type |
A character string specifying the type of the Signal-to-Noise Ratio plot. Possible values are:
Default is |
factors |
The factors for which the effect plot is to be created. |
fun |
A function for constructing the effect plot such as |
response |
A character string specifying the response variable. If |
points |
A logical value. If |
classic |
A logical value. If |
lty |
A numeric value specifying the line type to be used. |
xlab |
A title for the x-axis. |
ylab |
A title for the y-axis. |
main |
An overall title for the plot. |
ylim |
A numeric vector of length 2 specifying the limits of the y-axis. |
l.col |
A color for the lines. |
p.col |
A color for the points. |
ld.col |
A color for the dashed line. |
pch |
The symbol for plotting points. |
The Signal-to-Noise Ratio (SNR) is calculated based on the type specified:
`nominal`
:
`smaller`
:
`larger`
:
Signal-to-Noise Ratio plots are used to estimate the effects of individual factors and to judge the variance and validity of results from an effect plot.
An invisible data.frame
containing all the single Signal-to-Noise Ratios.
tdo <- taguchiDesign("L9_3", replicates = 3) tdo$.response(rnorm(27)) snPlot(tdo, points = TRUE, l.col = 2, p.col = 2, ld.col = 2, pch = 16, lty = 3)
tdo <- taguchiDesign("L9_3", replicates = 3) tdo$.response(rnorm(27)) snPlot(tdo, points = TRUE, l.col = 2, p.col = 2, ld.col = 2, pch = 16, lty = 3)
starDesign
is a function to create the star portion of a response surface design. The starDesign function can be used to create a star portion of a response surface design for a sequential assembly strategy.
One can either specify k and p and alpha and cs and cc OR simply simply pass an object of class facDesign.c
to the data. In the latter an object of class facDesign.c
otherwise a list containing the axial runs and centerpoints is returned.
starDesign( k, p = 0, alpha = c("both", "rotatable", "orthogonal"), cs, cc, data )
starDesign( k, p = 0, alpha = c("both", "rotatable", "orthogonal"), cs, cc, data )
k |
Integer value giving number of factors. |
p |
Integer value giving the number of factors via aliasing. By default set to '0'. |
alpha |
If no numeric value is given defaults to |
cs |
Integer value giving the number of centerpoints in the star portion of the design. |
cc |
Integer value giving the number of centerpoints in the cube portion of the design. |
data |
Optional. An object of class |
starDesign
returns a facDesign.c
object if an object of class facDesign.c
is given or a list containing entries for axial runs and center points in the cube and the star portion of a design.
facDesign
, fracDesign
, rsmDesign
, mixDesign
# Example 1: sequential assembly # Factorial design with one center point in the cube portion fdo = facDesign(k = 3, centerCube = 1) # Set the response via generic response method fdo$.response(1:9) # Sequential assembly of a response surface design (rsd) rsd = starDesign(data = fdo) # Example 2: Returning a list of star point designs starDesign(k = 3, cc = 2, cs = 2, alpha = "orthogonal") starDesign(k = 3, cc = 2, cs = 2, alpha = "rotatable") starDesign(k = 3, cc = 2, cs = 2, alpha = "both")
# Example 1: sequential assembly # Factorial design with one center point in the cube portion fdo = facDesign(k = 3, centerCube = 1) # Set the response via generic response method fdo$.response(1:9) # Sequential assembly of a response surface design (rsd) rsd = starDesign(data = fdo) # Example 2: Returning a list of star point designs starDesign(k = 3, cc = 2, cs = 2, alpha = "orthogonal") starDesign(k = 3, cc = 2, cs = 2, alpha = "rotatable") starDesign(k = 3, cc = 2, cs = 2, alpha = "both")
steepAscent
is a method to calculate the steepest ascent for a facDesign.c
object.
steepAscent(factors, response, size = 0.2, steps = 5, data)
steepAscent(factors, response, size = 0.2, steps = 5, data)
factors |
List containing vector of factor names (coded) to be included in calculation, first factor is the reference factor. |
response |
A character of response given in data. |
size |
Numeric integer value giving the step size in coded units for the first factor given in factors.
By default size is set to |
steps |
Numeric integer value giving the number of steps. By default step is set to '5'. |
data |
An object of class |
steepAscent
returns an object of class steepAscent.c
.
# Example 1 fdo = facDesign(k = 2, centerCube = 5) fdo$lows(c(170, 150)) fdo$highs(c(230, 250)) fdo$names(c("temperature", "time")) fdo$unit(c("C", "minutes")) yield = c(32.79, 24.07, 48.94, 52.49, 38.89, 48.29, 29.68, 46.5, 44.15) fdo$.response(yield) fdo$summary() sao = steepAscent(factors = c("B", "A"), response = "yield", size = 1, data = fdo)
# Example 1 fdo = facDesign(k = 2, centerCube = 5) fdo$lows(c(170, 150)) fdo$highs(c(230, 250)) fdo$names(c("temperature", "time")) fdo$unit(c("C", "minutes")) yield = c(32.79, 24.07, 48.94, 52.49, 38.89, 48.29, 29.68, 46.5, 44.15) fdo$.response(yield) fdo$summary() sao = steepAscent(factors = c("B", "A"), response = "yield", size = 1, data = fdo)
The steepAscent.c
class represents a steepest ascent algorithm in a factorial design context. This class is used for optimizing designs based on iterative improvements.
name
A character string representing the name of the steep ascent design.
X
A data frame containing the design matrix for the steepest ascent procedure. This matrix represents the factors and their levels at each iteration.
response
A data frame containing the response values associated with the design matrix.
.response()
Get and set the 'response' values in an object of class 'steepAscent.c'.
steepAscent.c$.response(value)
value
A data frame or numeric vector to set as the new 'response'. If missing, returns the current 'response'.
get()
Access specific elements in the design matrix or response data of the object.
steepAscent.c$get(i, j)
i
An integer specifying the row index to retrieve.
j
An integer specifying the column index to retrieve.
as.data.frame()
Convert the object to a data frame.
steepAscent.c$as.data.frame()
print()
Print the details of the object.
steepAscent.c$print()
plot()
Plot the results of the steepest ascent procedure for an object of class 'steepAscent.c'.
steepAscent.c$plot(main, xlab, ylab, l.col, p.col, line.type, point.shape)
main
The main title of the plot.
xlab
The label for the x-axis.
ylab
The label for the y-axis.
l.col
Color for the line in the plot.
p.col
Color for the points in the plot.
line.type
Type of the line used in the plot.
point.shape
Shape of the points used in the plot.
clone()
The objects of this class are cloneable with this method.
steepAscent.c$clone(deep = FALSE)
deep
Whether to make a deep clone.
steepAscent
, desirability.c
, optimum
Function to provide an overview of fitted linear models for objects of class facDesign.c
.
summaryFits(fdo, lmFit = TRUE, curvTest = TRUE)
summaryFits(fdo, lmFit = TRUE, curvTest = TRUE)
fdo |
An object of class |
lmFit |
A logical value deciding whether the fits from the object |
curvTest |
A logical value deciding whether curvature tests should be performed or not. By default, |
A summary output of the fitted linear models, which may include the linear fits, curvature tests, and original fit values, depending on the input parameters.
dfac <- facDesign(k = 3) dfac$.response(data.frame(y = rnorm(8), y2 = rnorm(8))) dfac$set.fits(lm(y ~ A + B , data = dfac$as.data.frame())) dfac$set.fits(lm(y2 ~ A + C, data = dfac$as.data.frame())) summaryFits(dfac)
dfac <- facDesign(k = 3) dfac$.response(data.frame(y = rnorm(8), y2 = rnorm(8))) dfac$set.fits(lm(y ~ A + B , data = dfac$as.data.frame())) dfac$set.fits(lm(y2 ~ A + C, data = dfac$as.data.frame())) summaryFits(dfac)
Shows a matrix of possible taguchi designs
taguchiChoose( factors1 = 0, factors2 = 0, level1 = 0, level2 = 0, ia = 0, col = 2, randomize = TRUE, replicates = 1 )
taguchiChoose( factors1 = 0, factors2 = 0, level1 = 0, level2 = 0, ia = 0, col = 2, randomize = TRUE, replicates = 1 )
factors1 |
Integer number of factors on level1. By default set to '0'. |
factors2 |
Integer number of factors on level2. By default set to '0'. |
level1 |
Integer number of levels on level1. By default set to '0'. |
level2 |
Integer number of levels on level2. By default set to '0'. |
ia |
Integer number of interactions. By default set to '0'. |
col |
Select the color scheme for the selection matrix: use |
randomize |
A logical value ( |
replicates |
An integer specifying the number of replicates for each run in the design. |
taguchiChoose
returns possible taguchi designs.
Specifying the number of factor1 factors with level1 levels (factors1 = 2, level1 = 3 means 2 factors with 3 factor levels) and factor2 factors with level2 levels and desired interactions one or more taguchi designs are suggested.
If all parameters are set to 0, a matrix of possible taguchi designs is shown.
taguchiChoose
returns an object of class taguchiDesign
.
facDesign
: for 2^k factorial designs.
rsmDesign
: for response surface designs.
fracDesign
: for fractional factorial design.
gageRRDesign
: for gage designs.
tdo1 <- taguchiChoose() tdo1 <- taguchiChoose(factors1 = 3, level1 = 2)
tdo1 <- taguchiChoose() tdo1 <- taguchiChoose(factors1 = 3, level1 = 2)
Function to create a taguchi design.
taguchiDesign(design, randomize = TRUE, replicates = 1)
taguchiDesign(design, randomize = TRUE, replicates = 1)
design |
A character string specifying the orthogonal array of the Taguchi design. The available options are:
|
randomize |
A logical value ( |
replicates |
An integer specifying the number of replicates for each run in the design. |
An overview of possible taguchi designs is possible with taguchiChoose
.
A taguchiDesign
returns an object of class taguchiDesign
.
facDesign
: for 2^k factorial designs.
rsmDesign
: for response surface designs.
fracDesign
: for fractional factorial design.
pbDesign
: for response surface designs.
gageRRDesign
: for gage designs.
tdo <- taguchiDesign("L9_3") tdo$values(list(A = c("material 1", "material 2", "material 3"), B = c(29, 30, 35))) tdo$names(c("Factor 1", "Factor 2", "Factor 3", "Factor 4")) tdo$.response(rnorm(9)) tdo$summary()
tdo <- taguchiDesign("L9_3") tdo$values(list(A = c("material 1", "material 2", "material 3"), B = c(29, 30, 35))) tdo$names(c("Factor 1", "Factor 2", "Factor 3", "Factor 4")) tdo$.response(rnorm(9)) tdo$summary()
An R6 class representing a Taguchi experimental design.
name
A character string specifying the name of the design. Default is NULL
.
factors
A list of factors included in the Taguchi design. Each factor is typically an instance of the taguchiFactor
class.
design
A 'data.frame' representing the design matrix of the experiment. This includes the levels of each factor for every run of the experiment. Default is an empty data.frame
.
designType
A character string specifying the type of Taguchi design used. Default is NULL
.
replic
A 'data.frame' containing the replication information for the design. Default is an empty data.frame
.
response
A 'data.frame' storing the response values collected from the experiment. Default is an empty data.frame
.
Type
A 'data.frame' specifying the type of responses or factors involved in the design. Default is an empty data.frame
.
block
A 'data.frame' indicating any blocking factors used in the design. Default is an empty data.frame
.
runOrder
A 'data.frame' detailing the order in which the experimental runs were conducted. Default is an empty data.frame
.
standardOrder
A 'data.frame' detailing the standard order of the experimental runs. Default is an empty data.frame
.
desireVal
A list storing desired values for responses in the experiment. Default is an empty list.
desirability
A list storing desirability functions used to evaluate the outcomes of the experiment. Default is an empty list.
fits
A 'data.frame' containing model fits or other statistical summaries from the analysis of the experimental data. Default is an empty data.frame
.
values()
Get and set the values
for an object of class taguchiDesign
.
taguchiDesign.c$values(value)
value
New value, If missing value get the values
.
units()
Get and set the units
for an object of class taguchiDesign
.
taguchiDesign.c$units(value)
value
New units, If missing value get the units
.
.factors()
Get and set the factors
in an object of class taguchiDesign
.
taguchiDesign.c$.factors(value)
value
New factors, If missing value get the factors
.
names()
Get and set the names
in an object of class taguchiDesign
.
taguchiDesign.c$names(value)
value
New names, If missing value get the names
.
as.data.frame()
Return a data frame with the information of the object taguchiDesign.c
.
taguchiDesign.c$as.data.frame()
print()
Methods for function print
in Package base
.
taguchiDesign.c$print()
.response()
Get and set the the response
in an object of class taguchiDesign
.
taguchiDesign.c$.response(value)
value
New response, If missing value get the response
.
.nfp()
Prints a summary of the factors attributes including their low, high, name, unit, and type.
taguchiDesign.c$.nfp()
summary()
Methods for function summary
in Package base
.
taguchiDesign.c$summary()
effectPlot()
Plots the effects of factors on the response variables.
taguchiDesign.c$effectPlot( factors, fun = mean, response = NULL, points = FALSE, l.col, p.col, ld.col, lty, xlab, ylab, main, ylim, pch )
factors
Factors to be plotted.
fun
Function applied to the response variables (e.g., mean).
response
Optional; specifies which response variables to plot.
points
Logical; if TRUE, plots data points.
l.col
A color for the lines.
p.col
A color for the points.
ld.col
A color for the dashed line.
lty
Line type for plotting.
xlab
Label for the x-axis.
ylab
Label for the y-axis.
main
Main title for the plot.
ylim
Limits for the y-axis.
pch
The symbol for plotting points.
tdo = taguchiDesign("L9_3") tdo$.response(rnorm(9)) tdo$effectPlot(points = TRUE, pch = 16, lty = 3)
identity()
Calculates the alias table for a fractional factorial design and prints an easy to read summary of the defining relations such as 'I = ABCD' for a standard 2^(4-1) factorial design.
taguchiDesign.c$identity()
clone()
The objects of this class are cloneable with this method.
taguchiDesign.c$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------ ## Method `taguchiDesign.c$effectPlot` ## ------------------------------------------------ tdo = taguchiDesign("L9_3") tdo$.response(rnorm(9)) tdo$effectPlot(points = TRUE, pch = 16, lty = 3)
## ------------------------------------------------ ## Method `taguchiDesign.c$effectPlot` ## ------------------------------------------------ tdo = taguchiDesign("L9_3") tdo$.response(rnorm(9)) tdo$effectPlot(points = TRUE, pch = 16, lty = 3)
An R6 class representing a factor in a Taguchi design.
values
A vector containing the levels or values associated with the factor. Default is NA
.
name
A character string specifying the name of the factor. Default is an empty string ``
.
unit
A character string specifying the unit of measurement for the factor. Default is an empty string ``
.
type
A character string specifying the type of the factor, which can be either `numeric`
or `categorical`
. Default is `numeric`
.
attributes()
Get the attributes of the factor.
taguchiFactor$attributes()
.values()
Get and set the values
for the factors in an object of class taguchiFactor
.
taguchiFactor$.values(value)
value
New values, If missing value get the values
.
.unit()
Get and set the units
for the factors in an object of class taguchiFactor
.
taguchiFactor$.unit(value)
value
New unit, If missing value get the units
.
names()
Get and set the names
in an object of class taguchiFactor
.
taguchiFactor$names(value)
value
New names, If missing value get the names
.
clone()
The objects of this class are cloneable with this method.
taguchiFactor$clone(deep = FALSE)
deep
Whether to make a deep clone.
Creates a wireframe diagram for an object of class facDesign.c
.
wirePlot( x, y, z, data = NULL, xlim, ylim, zlim, main, xlab, ylab, sub, sub.a = TRUE, zlab, form = "fit", col = "Rainbow", steps, fun, plot = TRUE, show.scale = TRUE, n.scene = "scene" )
wirePlot( x, y, z, data = NULL, xlim, ylim, zlim, main, xlab, ylab, sub, sub.a = TRUE, zlab, form = "fit", col = "Rainbow", steps, fun, plot = TRUE, show.scale = TRUE, n.scene = "scene" )
x |
Name providing the Factor A for the plot. |
y |
Name providing the Factor B for the plot. |
z |
Name giving the Response variable. |
data |
Needs to be an object of class |
xlim |
Numeric vector of length 2: limits for the x-axis. If missing, limits are set automatically. |
ylim |
Numeric vector of length 2: limits for the y-axis. If missing, limits are set automatically. |
zlim |
Numeric vector of length 2: limits for the z-axis. If missing, limits are set automatically. |
main |
Character string: title of the plot. |
xlab |
Character string: label for the x-axis. |
ylab |
Character string: label for the y-axis. |
sub |
Character string: subtitle for the plot. Default is |
sub.a |
Logical value indicating whether to display the subtitle. Default is |
zlab |
Character string: label for the z-axis. |
form |
Character string specifying the form of the surface to be plotted. Options include
Default is |
col |
Character string specifying the color palette to use for the plot (e.g., |
steps |
Numeric value specifying the number of steps for the grid in the plot. Higher values result in a smoother surface. |
fun |
Optional function to be applied to the data before plotting. |
plot |
Logical value indicating whether to display the plot. Default is |
show.scale |
Logical value indicating whether to display the color scale on the plot. Default is |
n.scene |
Character string specifying the scene name for the plot. Default is |
The wirePlot
function is used to create a 3D wireframe plot that visualizes the relationship between two factors and a response variable. The plot can be customized in various ways, including changing axis labels, adding subtitles, and choosing the color palette.
The function wirePlot
returns an invisible list containing:
plot |
The generated wireframe plot. |
grid |
The grid data used for plotting. |
# Example 1: Basic wireframe plot x <- seq(-10, 10, length = 30) y <- seq(-10, 10, length = 30) z <- outer(x, y, function(a, b) sin(sqrt(a^2 + b^2))) wirePlot(x, y, z, main = "3D Wireframe Plot", xlab = "X-Axis", ylab = "Y-Axis", zlab = "Z-Axis") fdo = rsmDesign(k = 3, blocks = 2) fdo$.response(data.frame(y = rnorm(fdo$nrow()))) #I - display linear fit wirePlot(A,B,y, data = fdo, form = "linear") #II - display full fit (i.e. effect, interactions and quadratic effects wirePlot(A,B,y, data = fdo, form = "full") #III - display a fit specified before fdo$set.fits(fdo$lm(y ~ B + I(A^2))) wirePlot(A,B,y, data = fdo, form = "fit") #IV - display a fit given directly wirePlot(A,B,y, data = fdo, form = "y ~ A*B + I(A^2)") #V - display a fit using a different colorRamp wirePlot(A,B,y, data = fdo, form = "full", col = 2)
# Example 1: Basic wireframe plot x <- seq(-10, 10, length = 30) y <- seq(-10, 10, length = 30) z <- outer(x, y, function(a, b) sin(sqrt(a^2 + b^2))) wirePlot(x, y, z, main = "3D Wireframe Plot", xlab = "X-Axis", ylab = "Y-Axis", zlab = "Z-Axis") fdo = rsmDesign(k = 3, blocks = 2) fdo$.response(data.frame(y = rnorm(fdo$nrow()))) #I - display linear fit wirePlot(A,B,y, data = fdo, form = "linear") #II - display full fit (i.e. effect, interactions and quadratic effects wirePlot(A,B,y, data = fdo, form = "full") #III - display a fit specified before fdo$set.fits(fdo$lm(y ~ B + I(A^2))) wirePlot(A,B,y, data = fdo, form = "fit") #IV - display a fit given directly wirePlot(A,B,y, data = fdo, form = "y ~ A*B + I(A^2)") #V - display a fit using a different colorRamp wirePlot(A,B,y, data = fdo, form = "full", col = 2)
This function creates a ternary plot for mixture designs (i.e. object of class mixDesign
).
wirePlot3( x, y, z, response, data = NULL, main, xlab, ylab, zlab, form = "linear", col = "Rainbow", steps, plot = TRUE )
wirePlot3( x, y, z, response, data = NULL, main, xlab, ylab, zlab, form = "linear", col = "Rainbow", steps, plot = TRUE )
x |
Factor 1 of the |
y |
Factor 2 of the |
z |
Factor 3 of the |
response |
the response of the |
data |
The |
main |
Character string specifying the main title of the plot. |
xlab |
Character string specifying the label for the x-axis. |
ylab |
Character string specifying the label for the y-axis. |
zlab |
Character string specifying the label for the z-axis. |
form |
A character string or a formula with the syntax 'y ~ A + B + C'. If form is a character string, it has to be one of the following:
How the form influences the output is described in the reference listed below.
By default, |
col |
Character string specifying the color palette to use for the plot (e.g., |
steps |
A numeric value specifying the resolution of the plot, i.e., the number of rows for the square matrix, which also represents the number of grid points per factor.
By default, |
plot |
Logical value indicating whether to display the plot. Default is |
The function wirePlot3
returns an invisible matrix containing the response values as NA's and numerics.
mixDesign.c
, mixDesign
, contourPlot3
.
#Example 1 mdo <- mixDesign(3, 2, center = FALSE, axial = FALSE, randomize = FALSE, replicates = c(1, 1, 2, 3)) elongation <- c(11.0, 12.4, 15.0, 14.8, 16.1, 17.7, 16.4, 16.6, 8.8, 10.0, 10.0, 9.7, 11.8, 16.8, 16.0) mdo$.response(elongation) wirePlot3(A, B, C, elongation, data = mdo, form = "quadratic") #Example 2 mdo <- mixDesign(3,2, center = FALSE, axial = FALSE, randomize = FALSE, replicates = c(1,1,2,3)) mdo$names(c("polyethylene", "polystyrene", "polypropylene")) mdo$units("percent") elongation <- c(11.0, 12.4, 15.0, 14.8, 16.1, 17.7, 16.4, 16.6, 8.8, 10.0, 10.0, 9.7, 11.8, 16.8, 16.0) mdo$.response(elongation) wirePlot3(A, B, C, elongation, data = mdo, form = "linear") wirePlot3(A, B, C, elongation, data = mdo, form = "quadratic", col = "Jet") wirePlot3(A, B, C, elongation, data = mdo, form = "elongation ~ I(A^2) - B:A + I(C^2)", col = "Electric") wirePlot3(A, B, C, elongation, data = mdo, form = "quadratic", col = "Earth")
#Example 1 mdo <- mixDesign(3, 2, center = FALSE, axial = FALSE, randomize = FALSE, replicates = c(1, 1, 2, 3)) elongation <- c(11.0, 12.4, 15.0, 14.8, 16.1, 17.7, 16.4, 16.6, 8.8, 10.0, 10.0, 9.7, 11.8, 16.8, 16.0) mdo$.response(elongation) wirePlot3(A, B, C, elongation, data = mdo, form = "quadratic") #Example 2 mdo <- mixDesign(3,2, center = FALSE, axial = FALSE, randomize = FALSE, replicates = c(1,1,2,3)) mdo$names(c("polyethylene", "polystyrene", "polypropylene")) mdo$units("percent") elongation <- c(11.0, 12.4, 15.0, 14.8, 16.1, 17.7, 16.4, 16.6, 8.8, 10.0, 10.0, 9.7, 11.8, 16.8, 16.0) mdo$.response(elongation) wirePlot3(A, B, C, elongation, data = mdo, form = "linear") wirePlot3(A, B, C, elongation, data = mdo, form = "quadratic", col = "Jet") wirePlot3(A, B, C, elongation, data = mdo, form = "elongation ~ I(A^2) - B:A + I(C^2)", col = "Electric") wirePlot3(A, B, C, elongation, data = mdo, form = "quadratic", col = "Earth")