[R] DOE in R?
Carlos J. Gil Bellosta
cgb at datanalytics.com
Thu Sep 10 00:16:48 CEST 2009
Hello,
I think I misread the link you sent me yesterday. In any case, the
reason why SAS generates a model with 30 trials whereas R produces
another one with 25 is that, if the parameter for the number of trials
is not specified in the proc/function call, both systems adhere to
different defaults: number of cols in the design matrix plus 10 for SAS
and plus 5 for R. You can check proc optex and optFederov documentation
for details.
Beyond that, SAS implements several optimization methods, among which,
Federov's. R implements just (one version of) Federov's. Finally, the
non-deterministic nature of the search for optimality (and local optima)
may lead to discrepancies between the outputs. You will have to work
through the different proc/function inputs to make sure you are running
an analogous algorithm on both systems.
Best regards,
Carlos J. Gil Bellosta
http://www.datanalytics.com
On Sun, 2009-09-06 at 20:33 -0400, b miner wrote:
> I attempted to use the package algdesign. I used the following code.
> However, the results were very much not matching the reference I noted
> (which is located at
> http://www2.sas.com/proceedings/sugi31/196-31.pdf). Instead of 30
> design points, I received 25 and those that were returned, only half
> or so matched the reference. I am inexperienced with optimal designs
> so I dont know if I am doing something wrong, the package is not the
> correct one for the task or a combination. Here is the code in case
> anyone has any input:
>
> #CODE:
>
> runif(1) #for a bug in program (assumes random seed object exists)
>
> dat<-gen.factorial(c(3,3,3,3,2),varNames=c("Intro","Duration","GOTO","Fee","Color"))
> dat #show design plan
>
> desD<-optFederov(~Intro+Duration+GOTO+Fee+Color
> +quad(Intro)+quad(Duration)+quad(GOTO)+quad(Fee)+Intro*Duration
> +Intro*GOTO+Intro*Fee+Intro*Color+Duration*GOTO+Duration*Fee
> +Duration*Color+GOTO*Fee+GOTO*Color
> +Fee*Color,dat,crit="D",maxIteration=1000,eval=TRUE)
>
> #D
> desD$D
>
> #design
> desD$design
> design<-desD$design
>
>
>
>
> > Subject: Re: [R] DOE in R?
> > From: cgb at datanalytics.com
> > To: b_miner at live.com
> > CC: r-help at r-project.org
> > Date: Sun, 6 Sep 2009 14:57:36 +0200
> >
> > Hello,
> >
> > This is your starting point:
> >
> > http://cran.r-project.org/web/views/ExperimentalDesign.html
> >
> > Best regards,
> >
> > Carlos J. Gil Bellosta
> > http://www.datanalytics.com
> >
> >
> > On Thu, 2009-09-03 at 17:38 -0700, B_miner wrote:
> > > Hello!
> > >
> > >
> > > This is not a topic I am well versed in but required to become
> well versed
> > > in...I welcome any assistance!
> > >
> > > Using R, I want to create an optimal design for an experiment.
> I'll be
> > > analyzing the results with logistic regression or some generalized
> linear
> > > model. I am thinking that the algdesign package can help (but no
> idea where
> > > to start?).
> > >
> > > I'm presenting an example here that I have seen the answer to (in
> SAS) in
> > > order to make sure I would have gotten it *right*.
> > >
> > > There are 5 factors: 4 are quantitative with three levels each and
> 1 is
> > > qualitative with two levels.
> > >
> > > Factor and levels:
> > >
> > > Intro: 0, 1.99, 2.99
> > > Duration: 6, 9 ,12
> > > GOTO: 3.99, 4.99, 5.99
> > > Fee: 0, 15, 45
> > > Color: Red, White
> > >
> > >
> > > In order to screen these factors, I would want to get a design
> where I could
> > > evaluate all main effects, all first order interactions and the
> squared
> > > terms of Intro, Duration, GOTO and FEE (for example Intro*Intro).
> > >
> > > Looking for the D-optimal design.
> > >
> > > Is this something that R can provide?
> > >
> > >
> > > These are, according to the SAS paper I read the following:
> > > Obs intro duration goto fee color
> > > 1 0.00 6 3.99 0 WHITE
> > > 2 0.00 6 3.99 45 RED
> > > 3 0.00 6 5.99 0 RED
> > > 4 0.00 6 5.99 45 WHITE
> > > 5 0.00 9 3.99 45 RED
> > > 6 0.00 9 4.99 15 WHITE
> > > 7 0.00 9 5.99 0 RED
> > > 8 0.00 12 3.99 0 RED
> > > 9 0.00 12 3.99 45 WHITE
> > > 10 0.00 12 5.99 0 WHITE
> > > 11 0.00 12 5.99 45 RED
> > > 12 0.00 12 5.99 45 WHITE
> > > 13 1.99 6 3.99 15 RED
> > > 14 1.99 6 4.99 45 WHITE
> > > 15 1.99 6 5.99 0 WHITE
> > > 16 1.99 9 5.99 45 RED
> > > 17 1.99 12 3.99 0 WHITE
> > > 18 1.99 12 5.99 15 RED
> > > 19 2.99 6 3.99 0 WHITE
> > > 20 2.99 6 3.99 45 WHITE
> > > 21 2.99 6 4.99 0 RED
> > > 22 2.99 6 5.99 15 WHITE
> > > 23 2.99 6 5.99 45 RED
> > > 24 2.99 9 3.99 0 RED
> > > 25 2.99 12 3.99 15 WHITE
> > > 26 2.99 12 3.99 45 RED
> > > 27 2.99 12 4.99 0 WHITE
> > > 28 2.99 12 4.99 45 RED
> > > 29 2.99 12 5.99 0 RED
> > > 30 2.99 12 5.99 45 WHITE
> > >
> > >
> >
> >
> >
> >
>
>
> ______________________________________________________________________
> Windows Live: Make it easier for your friends to see what you’re up to
> on Facebook. Find out more.
More information about the R-help
mailing list