Include a formula using the function “makeParamSet”

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Include a formula using the function “makeParamSet”

Nelly Reduan
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]]


______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Include a formula using the function “makeParamSet”

Jeff Newmiller
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 <[hidden email]> 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.