[R] Non linear programming: choose R that minimizes corr(y,x^R)

2013-02-06 Thread Ravi Varadhan
Hi John, Do you want to minimize correlation or |correlation|? Here is a simple code, with example, that shows how to optimize the magnitude (that is corr^2) of correlation between y and x^p, where p is a positive real number. You can modify it to suit your needs. corxy.opt - function(x, y,

[R] Non linear programming: choose R that minimizes corr(y, x^R)

2013-02-05 Thread John Sorkin
I am looking for a package that will allow me to choose R (a real number) that minimizes the correlation of y and x^R, i.e. find R such that corr(y,x^R) is minimized. Any suggestions for packages I might look at would be helpful. Thanks, John John David Sorkin M.D., Ph.D. Chief,

Re: [R] Non linear programming: choose R that minimizes corr(y, x^R)

2013-02-05 Thread Greg Snow
The stats package has the optimize function that could be used for this. On Tue, Feb 5, 2013 at 2:08 PM, John Sorkin jsor...@grecc.umaryland.eduwrote: I am looking for a package that will allow me to choose R (a real number) that minimizes the correlation of y and x^R, i.e. find R such that

Re: [R] Non linear programming: choose R that minimizes corr(y, x^R)

2013-02-05 Thread Bert Gunter
If you really mean minimize and not maximize, I doubt that any such R exists. -- Bert On Tue, Feb 5, 2013 at 1:08 PM, John Sorkin jsor...@grecc.umaryland.edu wrote: I am looking for a package that will allow me to choose R (a real number) that minimizes the correlation of y and x^R, i.e.

Re: [R] Non linear programming: choose R that minimizes corr(y, x^R)

2013-02-05 Thread John Sorkin
I really mean minimize. John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913