Skip to content

AlfCano/rk.doe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rk.doe: Design of Experiments (DoE) for RKWard

Version License AI Assistance

rk.doe is an external plug-in for RKWard that provides a Graphical User Interface (GUI) for generating and analyzing experimental designs. It leverages the power of the R packages DoE.base and FrF2 to bring industrial-grade statistical tools to RKWard, filling the gap for engineers and quality professionals who need alternatives to Minitab or Bluesky Statistics.

Features

1. Design Generation

  • Full Factorial Designs:
    • Supports mixed-level designs (e.g., 2-level and 3-level factors combined).
    • Options for replications, randomization, and random seeds.
    • Built-in Simulation: Automatically generate a simulated response variable ("Yield") with random noise to test analysis workflows immediately.
  • Fractional Factorial Designs (FrF2):
    • Generate 2-level fractional designs.
    • Support for Generators, Center Points, and Replications.
    • Built-in Simulation: Automatically generate a simulated response variable with random noise.

2. Design Analysis

  • ANOVA: Automated Analysis of Variance tables for the experimental model.
  • Main Effects Plots: Visualize the impact of individual factors on the response.
  • Interaction Plots:
    • Smart Detection: Automatically uses FrF2::IAPlot for 2-level designs (interaction matrix).
    • Fallback Logic: Automatically generates standard base R interaction plots for designs with >2 levels (mixed/general factorial).
  • Live Preview: Toggle between Main Effects and Interaction plots in the preview window before printing results to the output.

Dependencies

This plugin relies on the following R packages:

  • DoE.base
  • FrF2
  • rkwarddev (for development/building)

Installation

  1. Open R in RKWard.
  2. Run the following commands in the R console:
require(devtools)
## Computar
  install_github(
    repo="AlfCano/rk.doe"
  )
  1. Restart RKWard to ensure the new menu items appear correctly.

Usage Guide

The plugin adds a new entry to the main menu under: Analysis > Design of Experiments (DoE)

Example 1: Full Factorial Design and Analysis

Step 1: Generate a Design

  1. Navigate to Analysis > Design of Experiments (DoE) > Full Factorial Design.
  2. Levels per factor: Enter 2, 2, 3 (for two 2-level factors and one 3-level factor).
  3. Factor Names: (Optional) Enter names like Temp, Pressure, Speed.
  4. Simulation: Check "Add Simulated Response" to create a dummy "Yield" column automatically. Keep "Response Name" as Yield.
  5. Save Design as: Enter a name (e.g., my_experiment).
  6. Click Submit.

Step 2: Analyze the Design

  1. Navigate to Analysis > Design of Experiments (DoE) > Analyze Design.
  2. Design Object: Select my_experiment from the list.
    • Note: If you don't see the columns inside my_experiment, click the small + or > arrow next to the dataframe name to expand it.
  3. Response Variable: Drag the Yield column into this field.
  4. Plots to Print: Check both "Print Main Effects Plot" and "Print Interaction Plot".
  5. Preview: Use the radio buttons to switch the preview graph between "Main Effects" and "Interaction".
  6. Click Submit.
    • Expected Output: An ANOVA table, a general Main Effects Plot, and multiple pairwise Interaction Plots (due to the 3-level factor) will appear in separate RKWard plot windows.

Example 2: Fractional Factorial Design and Analysis

Scenario: Chemical Process Optimization

You want to maximize the Yield of a reaction. You have 4 factors, but a full experiment ($2^4 = 16$ runs) is too expensive. You decide to run an 8-run fractional factorial design.

  • Factor A: Temperature
  • Factor B: Pressure
  • Factor C: Concentration
  • Factor D: Stirring Rate

Step 1: Generate the FrF2 Design

  1. Go to Analysis > Design of Experiments (DoE) > Fractional Factorial (FrF2).
  2. Number of Runs: Set to 8.
  3. Number of Factors: Set to 4 (This implies factors A, B, C, D).
  4. Generators: Leave this empty (FrF2 will automatically select the best resolution IV design, likely D = ABC).
  5. Replications: 1.
  6. Center Points: 0.
  7. Random Seed: You can leave it as 12345 or change it.
  8. Simulation: Check "Add Simulated Response" to create a dummy "Yield" column automatically. Keep "Response Name" as Yield.
  9. Save Design as: Enter my_frf2_design.
  10. Click Submit.
    • Expected Output: A summary of the design (e.g., factors, levels, generators) will appear in the output window. my_frf2_design will appear in your RKWard workspace.

Step 2: Analyze the FrF2 Design

  1. Go to Analysis > Design of Experiments (DoE) > Analyze Design.
  2. Design Object: Select my_frf2_design from the list.
  3. Response Variable: Drag the Yield column (expand my_frf2_design if needed) into this field.
  4. Plots to Print: Check both "Print Main Effects Plot" and "Print Interaction Plot".
  5. Preview:
    • Select Main Effects in the radio button.
    • Observe the preview window: You should see the main effects for factors A, B, C, D.
    • Switch the radio button to Interaction to see the interaction matrix plot (if applicable for the 2-level design).
  6. Click Submit.
    • Expected Output: An ANOVA table, a Main Effects Plot, and an Interaction Plot matrix (generated by FrF2::IAPlot) will appear in separate RKWard plot windows.

Troubleshooting

  • "Model not created" in Preview: Ensure you have selected a valid Design Object and a Response Variable. The preview requires valid data to calculate the linear model.
  • Selecting Columns: RKWard's variable selector treats dataframes as single objects by default. You must expand the tree (click the arrow next to the dataframe name) to select individual columns like Yield.
  • Interaction Plots for General Designs: For designs with factors having more than two levels, FrF2::IAPlot is not applicable. The plugin will automatically fall back to generating separate pairwise interaction plots using base R's interaction.plot().

Author

Alfonso Cano
Benemérita Universidad Autónoma de Puebla
License: GPL (>= 3)


This plugin was developed with the assistance of Gemini, a large language model by Google.

About

An RKWard plugin for generating Full Factorial, Fractional Factorial, and Response Surface designs using 'DoE.base, FrF2.'. Design Generation: Create Full Factorial, Fractional Factorial, and Response Surface designs and specialized ANOVA and interaction plots for experimental designs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors