Full factorial 2^k & 3^k experiment.
data dat1;
infile 'C:\usr\dir\namedat.csv' dlm=',';
input y A B C;
If you have to write the data set or if you have to make the design
on your own then go for this :
proc factex;
factors C B A/nlev=3;
size design=27; option-> fraction=2
model res=max; option -> model estimate = (A|B|C@2)
model res=5
blocks nblocks=3;
examine C A(3);
output out=deslay blockname=block
A nvals=(0 1 2)
B nvals=(0 1 2)
C cvals=('a' 'b' 'c'); Option-> designrep=3
run;
Once you have the dataset, you have to analyse the data and get some outputs.
Answer the following questions..
1) R-squared,
2) model-anova, parameter estimates,
3) Hypothesis tests..
4) Contrast estimates..
5) Residual Analysis..
6) important factors..
7) profile plots & interaction plots.
If interaction is present then go for Contour plot.
8) tests for violation of assumptions
normality, independence, equality of variance.
ods output Estimates =estime;
ods listing close;
proc glm data=dat1 outstat=ssout;
class A B C;
model y=A|B|C/ss1 solution clparm; "solution" gives the parameter estimates
means A B C/hovtest=levene; Option-> hovtest=bartlett
output out=resout r=resid p=predict;
estimate 'A' A -1 1/divisor=1; Main effect of A
estimate 'AB' A*B 1 -1 -1 1/divisor=2;
contrast 'A' A -1 1;
run;
ods listing;
proc print data=estime;
run;
Following code gives you the regression coefficients
proc glm data=dat1;
model y=A|B|C;
run;
Residual plots
proc plot data=resout;
plot resid*(predict A B C)="*"/vref=0;
run;
proc univariate data=resout noprint;
probplot residual/normal(mu=est sigma=est);
inset normal;
run;
Important Factors' Selection
title 'Normal probability plot';
proc univariate data=estime noprint;
probplot Estimate/normal(mu=est sigma=est);
inset normal;
run;
proc plot data=ssout;
plot SS*_SOURCE_=_TYPE_;
run;
data estim1;
set estim;
absestim=abs(Estimate);
run;
title 'Half normal probability plot';
proc univariate data=estim1 noprint;
probplot absestim/normal(mu=est sigma=est);
inset normal;
run;
Main effects plots
proc means data=proce noprint;
class A;
var yield;
output out=outa mean=avga;
run;
data meanout;
merge outa outb outc outd;
run;
proc means data=proce noprint;
class B;
var yield;
output out=outb mean=avgb;
run;
title 'Main effects plots';
symbol i=join h=1 v=dot;
legend1 label=none;
proc gplot data=meanout;
plot avga*A avgb*B avgc*C avgd*D/overlay legend=legend1;
run;
Interaction Plots
proc means data=silic;
class A B;
var resis;
output out=outab mean=avgab;
run;
title 'Interaction plot';
symbol i=join v=dot h=1;
proc gplot data=outab;
plot avgab*A=B;
run;
Contour Plots
proc g3grid data=resout2 out=gridout;
grid A*B=predict2/naxis1=31 naxis2=31 spline;
run;
proc gcontour data=gridoutab;
plot A*B=predict2/grid autolabel;
run;
Surface Plot
proc g3d data=gridoutab;
plot A*B=predict2/grid autolabel;
run;