Nelly Reduan
2019-Oct-09 21:30 UTC
[R] Include a formula using the function “makeParamSet”
Hello, I am performing Latin Hypercube sampling from functions "makeParamSet" and "generateDesign" (package "ParamHelpers") in R. Using the function "makeParamSet", how can I specify a formula to define a given parameter ? Here is an example where "g? is the product of ?a? and ?c?: ps <- makeParamSet(makeIntegerParam("a", lower=800, upper=7200), makeIntegerParam("c", lower=632, upper=5688), makeIntegerParam("e", lower=5, upper=45), makeIntegerParam("b", lower=0, upper=7200), makeIntegerParam("d", lower=0, upper=5688), makeIntegerParam("f", lower=0, upper=45), makeIntegerParam("g", trafo = function(a,c) a*c), forbidden = quote(d > g)) Y <- generateDesign(100, ps, trafo = T) Problem: With the code, I have the following error: Error in doBasicGenDesignChecks(par.set) : Finite box constraints required! Thank you very much for your help. Nelly [[alternative HTML version deleted]]
Jeff Newmiller
2019-Oct-10 03:35 UTC
[R] Include a formula using the function “makeParamSet”
Technically this question is off-topic on this mailing list (read the Posting Guide!), but I might hazard a guess that the package doesn't like using variable that is a lowercase "c" since that is an extremely common R function name. You can sometimes get away with this, but it takes very careful programming and this package might not have been designed with that in mind. On October 9, 2019 2:30:15 PM PDT, Nelly Reduan <nell.redu at hotmail.fr> wrote:>Hello, > > >I am performing Latin Hypercube sampling from functions "makeParamSet" >and "generateDesign" (package "ParamHelpers") in R. Using the function >"makeParamSet", how can I specify a formula to define a given parameter >? Here is an example where "g? is the product of ?a? and ?c?: > >ps <- makeParamSet(makeIntegerParam("a", lower=800, upper=7200), > > makeIntegerParam("c", lower=632, upper=5688), > > makeIntegerParam("e", lower=5, upper=45), > > makeIntegerParam("b", lower=0, upper=7200), > > makeIntegerParam("d", lower=0, upper=5688), > > makeIntegerParam("f", lower=0, upper=45), > > makeIntegerParam("g", trafo = function(a,c) a*c), > > forbidden = quote(d > g)) > >Y <- generateDesign(100, ps, trafo = T) > >Problem: >With the code, I have the following error: > >Error in doBasicGenDesignChecks(par.set) : > > Finite box constraints required! > >Thank you very much for your help. >Nelly > > [[alternative HTML version deleted]]-- Sent from my phone. Please excuse my brevity.