R language how to do optimization with either/or constraints? [closed] - r

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am trying to do constrained optimization using R. My constraint is not continuous. Here is an example:
minimize: f(x,y)=(x-2)^2+y^2
st. x=0 or x>=3
y=0 or y>=2
What type of optimization problem is this?

These are called semi-continuous variables. Some solvers support these directly, but they can also be formulated with additional binary variables:
3*d <= x <= 1000*d
d binary
Anyway, you end up with a MIQP model (Mixed Integer Quadratic Programming). Solvers like Gurobi and Cplex support this and have R interfaces.

Related

Is there a way to inform classifiers in R of the relative costs of misclassification? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
This is a general question. Are there classifiers in R -- functions that perform classification implementing classification algorithms-- that accept as input argument the relative cost of misclassification. E.g. if a misclassification of a positive to negative has cost 1 the opposite has cost 3.
If yes which are these functions?
Yes. If you are using the caret package (you should; it provides 'standardization' for 200+ classification and regression methods by wrapping almost all relevant R's packages), you can set the weights argument of the train function (see p.152; see also here) for models that support class weights. This answer lists some of the models that support class weights.

r code for inverse of Yeo Johnson Transformation? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I use YJ transformation for predictor variables and try to plot the model between predicted and observed values. Could you please help me to do this?
I am looking for a r code for inverse of Yeo-Johnson transformation.
There's an answer to this in the comments for this question over at Cross Validated. Here's the documentation for VGAM::yeo.johnson (use inverse = TRUE).

R generate random vectors from multivariate distributions [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I want to generate random points of uniform density over the unit ball [-1,1]^d in R.
Are there any R packages which offer this functionality?
I am sure i can do this myself by extending this answer: https://math.stackexchange.com/a/87238/250498 to d dimensions.
But i want to know if there is any function or package in R that already does this.
It would be useful if there is a package which can generate standard multivariate distributions instead of me having to sample them myself using rejection sampling or other techniques.

Penalized gamma regression in R [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am aware of the http://cran.r-project.org/web/packages/glmnet/index.html and http://cran.r-project.org/web/packages/penalized/index.html packages, but neither of them seems to support Gamma GLMs.
I'd like to utilize elastic net for gamma GLMs in R, what is the easiest way to do it?
(meta: also debating whether this should go on Cross Validated for better responses?)
You can use the HDtweedie package. Gamma is a special case of the Tweedie distribution with p = 2. It's a relatively new package, so expect some teething problems.

Is there a package for approximating a function using Chebychev Polynomials? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Is there a package for approximating a function using Chebychev Polynomials?
I was formerly using Matlab and there was a package called Compecon that can approximate a function using Chebychev Polynomials.
I am wondering if there is any packages similar for Julia.
Or is there any packages in C or fortran or Python that can do this?
Thanka a lot!
You might want to check out ApproxFun.jl, it may be relevant.
https://github.com/QuantEcon/CompEcon.jl and related https://github.com/QuantEcon/BasisMatrices.jl have the capacity I believe.

Resources