You are on page 1of 6

Exercise4

Factorial Run
Introduction:
A full factorial design may also be called a fully crossed design. Such
an experiment allows the investigator to study the effect of each
factor on the response variable, as well as the effects of interactions
between factors on the response variable.
In statistics, a full factorial experiment is
an experiment whose design consists of two or more factors, each
with discrete possible values or "levels", and whose experimental units
take on all possible combinations of these levels across all such
factors.
Codes:
package exercisee4;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JTextField;

/**

* @author Andrea Beatrice Oro

*/

public class Exercisee4 {

public static void main(String[] args) {

double[] T = {160, 180, 160, 180, 160, 180, 160, 180};

double[] C = {20, 20, 40, 40, 20, 20, 40, 40};

double[] K = {0, 0, 0, 0, 1, 1, 1, 1};

JTextField yield1= new JTextField(5);

JTextField yield2= new JTextField(5);

JTextField yield3= new JTextField(5);

JTextField yield4= new JTextField(5);

JTextField yield5= new JTextField(5);

JTextField yield6= new JTextField(5);

JTextField yield7= new JTextField(5);

JTextField yield8= new JTextField(5);


JPanel myPanely = new JPanel();

myPanely.add(new JLabel("y1:"));

myPanely.add(yield1);

myPanely.add(new JLabel("y2:"));

myPanely.add(yield2);

myPanely.add(new JLabel("y3:"));

myPanely.add(yield3);

myPanely.add(new JLabel("y4:"));

myPanely.add(yield4);

myPanely.add(new JLabel("y5:"));

myPanely.add(yield5);

myPanely.add(new JLabel("y6:"));

myPanely.add(yield6);

myPanely.add(new JLabel("y7:"));

myPanely.add(yield7);

myPanely.add(new JLabel("y8:"));

myPanely.add(yield8);

double yield=JOptionPane.showConfirmDialog(null, myPanely,

"Please Enter yield % Values", JOptionPane.OK_CANCEL_OPTION);

double y1, y2, y3, y4, y5, y6, y7, y8;

y1=Double.parseDouble(yield1.getText());

y2=Double.parseDouble(yield2.getText());

y3=Double.parseDouble(yield3.getText());

y4=Double.parseDouble(yield4.getText());
y5=Double.parseDouble(yield5.getText());

y6=Double.parseDouble(yield6.getText());

y7=Double.parseDouble(yield7.getText());

y8=Double.parseDouble(yield8.getText());

double[] Y = {y1, y2, y3, y4, y5, y6, y7, y8};

//one factor interaction

double tpos=(Y[1]+Y[3]+Y[5]+Y[7])/4;

double tneg=(Y[0]+Y[2]+Y[4]+Y[6])/4;

double cpos=(Y[2]+Y[3]+Y[6]+Y[7])/4;

double cneg=(Y[0]+Y[1]+Y[4]+Y[5])/4;

double kpos=(Y[4]+Y[5]+Y[6]+Y[7])/4;

double kneg=(Y[0]+Y[1]+Y[2]+Y[3])/4;

double interT=tpos-tneg;

double interC=cpos-cneg;

double interK=kpos-kneg;

//two factor interaction

double tkpos=(Y[0]+Y[2]+Y[5]+Y[7])/4;

double tkneg=(Y[1]+Y[3]+Y[4]+Y[6])/4;

double interTK=tkpos-tkneg;

double tcpos=(Y[0]+Y[3]+Y[4]+Y[7])/4;

double tcneg=(Y[1]+Y[2]+Y[5]+Y[6])/4;

double interTC=tcpos-tcneg;

double ckpos=(Y[0]+Y[1]+Y[6]+Y[7])/4;

double ckneg=(Y[2]+Y[3]+Y[4]+Y[5])/4;
double interCK=ckpos-ckneg;

//three factor interaction

double tckpos=((Y[7]-Y[6])-(Y[5]-Y[4]))/2;

double tckneg=((Y[3]-Y[2])-(Y[1]-Y[0]))/2;

double interTCK=(tckpos-tckneg)/2;

JOptionPane.showMessageDialog(null, "Interaction T: " + interT + "+-1.4\n" +

"Interaction C: " + interC + "+-1.4\n" +

"Interaction K: " + interK + "+-1.4\n" +

"Interaction TK: " + interTK + "+-1.4\n" +

"Interaction TC: " + interTC + "+-1.4\n" +

"Interaction CK: " + interCK + "+-1.4\n" +

"Interaction TCK: " + interTCK + "+-1.4");

System.out.println(interT + "+-1.4");

System.out.println(interC + "+-1.4");

System.out.println(interK + "+-1.4");

System.out.println(interTK + "+-1.4");

System.out.println(interTC + "+-1.4");

System.out.println(interCK + "+-1.4");

System.out.println(interTCK + "+-1.4");

You might also like