Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Abby Spurdle
> L= 1006.536 > L= 1006.537 > L= 1006.535 > It appears to have chosen step size 0.001, not 0.1. It should be > getting adequate accuracy in both 1st and 2nd derivatives. > Those little ripples you see in the plot are not relevant. I'm impressed. But you're still wrong. Try this: -

Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Duncan Murdoch
On 12/03/2020 7:25 p.m., Abby Spurdle wrote: There is nothing in that plot to indicate that the result given by optim() should be accepted as optimal. The numerical approximation to the derivative is 0.055851 everywhere in your graph That wasn't how I intended the plot to be interpreted. By

Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Abby Spurdle
> There is nothing in that plot to indicate that the result given by > optim() should be accepted as optimal. The numerical approximation to > the derivative is 0.055851 everywhere in your graph That wasn't how I intended the plot to be interpreted. By default, the step size (in x) is 1e-5,

Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Duncan Murdoch
On 12/03/2020 1:22 p.m., Abby Spurdle wrote: I'm sorry, Duncan. But I disagree. This is not a "bug" in optim function, as such. (Or at least, there's nothing in this discussion to suggest that there's a bug). But rather a floating point arithmetic related problem. The OP's function looks

Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Mark Leeds
Hi Abby: Either way, thanks for your efforts with the derivative plot. Note that John Nash is a SERIOUS EXPERT in optimization so I would just go by what he said earlier. Also, I don't want to speak for Duncan but I have a feeling that he meant "inadequacy" in the CG method rather than a bug in

Re: [R] How to make our data normally distributed in R

2020-03-12 Thread Jin Li
Hi, Why do you want to re-scale RMSE to 0-1? You can change ylim=(0,1) to ylim=(0, 4600). You may use VEcv (Variance explained by predictive models based on cross-validation) that ranges from 0 to 100% instead. It can be calculated using vecv function in library(spm) or you can convert RMSE to

Re: [R] Installing Packages

2020-03-12 Thread Jeff Reichman
Thank you all - that was helpful. I guess I assumes everything that got pushed up to the server was already compiled. -Original Message- From: Duncan Murdoch Sent: Wednesday, March 11, 2020 10:10 AM To: reichm...@sbcglobal.net; r-help@r-project.org Subject: Re: [R] Installing Packages

Re: [R] How to make our data normally distributed in R

2020-03-12 Thread Neha gupta
Thanks Hasan and Rui Rui, as you mentioned As for the second question, if your RMSE vector had values in the range 2900 to 4600 and the y axis limits are c(0, 1), how can you expect to see anything? Then what should be the values of ylim in boxplots? I need to show them as boxplot between 0-1

Re: [R] How to make our data normally distributed in R

2020-03-12 Thread Rui Barradas
Hello, To rescale data so that their values are between 0 and 1, use this function: scale01 <- function(x, na.rm = FALSE){ (x - min(x, na.rm = na.rm))/(max(x, na.rm = na.rm) - min(x, na.rm = na.rm)) } x <- c(SVM=3500, ANN=4600, R.Forest=2900) scale01(x) # SVM ANN

Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Abby Spurdle
> (1) An exact solution can be derived quickly Please disregard note (1) above. I'm not sure if it was right. And one more comment: The conjugate gradient method is an established method. So the question is, is the optim function applying this method or not... And assuming that it is, then R is

[R] How to make our data normally distributed in R

2020-03-12 Thread Neha gupta
Hi I have a regression based data where I get the RMSE results as: SVM=3500 ANN=4600 R.Forest=2900 I want to know how can I make it so that its values comes as 0-1 I plot the boxplot for it to indicate their RMSE values and used, ylim=(0,1), but the boxplot which works for RMSE values like

Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Abby Spurdle
I'm sorry, Duncan. But I disagree. This is not a "bug" in optim function, as such. (Or at least, there's nothing in this discussion to suggest that there's a bug). But rather a floating point arithmetic related problem. The OP's function looks simple enough, at first glance. But it's not.

Re: [R] how do I add text lables on QQ plot

2020-03-12 Thread Ana Marija
Thank you! On Thu, Mar 12, 2020 at 12:47 PM Abby Spurdle wrote: > > The plotting character is determined by the pch argument. > i.e. You need to specify the pch argument in the legend call. > > Here's the R code to preview the first 20 plotting characters: > > > plot (1:20, rep (0, 20),

Re: [R] how do I add text lables on QQ plot

2020-03-12 Thread Abby Spurdle
The plotting character is determined by the pch argument. i.e. You need to specify the pch argument in the legend call. Here's the R code to preview the first 20 plotting characters: > plot (1:20, rep (0, 20), pch=1:20, ylim = c (-5, 5) ) > text (1:20, rep (1, 20), 1:20) Empty circles, have a

Re: [R] how do I add text lables on QQ plot

2020-03-12 Thread Abby Spurdle
Hi Ana, I've already given you an example of using the text function with vectors. I note that this thread contains a lot of duplication. I'd recommend people read the whole thread before posting. On Fri, Mar 13, 2020 at 3:42 AM Ana Marija wrote: > > Hi Michael, > > can you please send me a

Re: [R] Unintended behaviour (possibly bugs)

2020-03-12 Thread Martin Maechler
> Alexey Shipunov > on Tue, 18 Feb 2020 14:34:48 +0900 writes: > Thank you for the detailed explanation. I tend to agree. However, this > behavior is relatively easy to remediate: > This is the piece of the current code: > === > if (!(is.null(labels) &&

Re: [R] how do I add text lables on QQ plot

2020-03-12 Thread Ana Marija
I could make legend via this: qq(fdr2_sorted$FDR.q.val2, main = "RG_All", pch = 16, col=fdr1_sorted$group, cex = 0.8, las = 1) legend('topleft', legend = c('up-regulated', 'down-regulated'), fill = c('red', 'blue'),bty="o") but this gives me squares in legend. How do I write this code in order to

Re: [R] how do I add text lables on QQ plot

2020-03-12 Thread Ana Marija
Also how would I add legend to this plot? I searched qqman pages and there is no mention of that qq(fdr2_sorted$FDR.q.val2, main = "RG_All", pch = 16, col=fdr1_sorted$group, cex = 0.8, las = 1) On Thu, Mar 12, 2020 at 9:30 AM Ana Marija wrote: > > Hi Michael, > > can you please send me a line

Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Skyler Saleebyan
Thanks for the replies. Since I was seeing this glitch with CG in my 1d and 2d formulation of the problem I was trying to figure out what was going on that led to the failure. I'll switch to a more suitable method and keep these considerations in mind. On Thu, Mar 12, 2020, 9:23 AM J C Nash

Re: [R] how do I add text lables on QQ plot

2020-03-12 Thread Ana Marija
Hi Michael, can you please send me a line of code showing how it would be done. Thanks Ana On Thu, Mar 12, 2020 at 9:16 AM Michael Dewey wrote: > > Dear Ana > > You can specify the first three parameters to text() as vectors so it is > all done in one call. That may or may not answer your

Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Duncan Murdoch
It looks like a bug in the CG method. The other methods in optim() all work fine. CG is documented to be a good choice in high dimensions; why did you choose it for a 1 dim problem? Duncan Murdoch On 12/03/2020 2:30 a.m., Skyler Saleebyan wrote: I am trying to familiarize myself with

Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread J C Nash
As author of CG (at least the code that was used to build it), I can say I was never happy with that code. Rcgmin is the replacement I wrote, and I believe that could still be improved. BUT: - you have a 1D optimization. Use Brent method and supply bounds. - I never intended CG (or BFGS or

Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Eric Berger
It is possible to work out this problem explicitly. Playing with a few different calls to optim shows that the method="L-BFGS-B" gives the correct answer. I don't have particular insight into why method="CG" is problematic. On Thu, Mar 12, 2020 at 4:12 PM Jeff Newmiller wrote: > The help file

Re: [R] how do I add text lables on QQ plot

2020-03-12 Thread Michael Dewey
Dear Ana You can specify the first three parameters to text() as vectors so it is all done in one call. That may or may not answer your question. Michael On 12/03/2020 14:08, Ana Marija wrote: HI David, thank you for getting back to me. Is there is a way for qq() to pick up text label

Re: [R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Jeff Newmiller
The help file points out that CG is "fragile" ... and I would expect that failing to define a gradient function will exacerbate that. I think you should use a different algorithm or specify a gradient function. You might also consider working with the more recent optimr package contributed by

Re: [R] how do I add text lables on QQ plot

2020-03-12 Thread Ana Marija
HI David, thank you for getting back to me. Is there is a way for qq() to pick up text label names on its own or I have to specify each one manually? like in this example: text( 2, 6, "arbitrary") this is dput for >a=head(fdr2_sorted) > dput(a) structure(list(NAME =

[R] Relatively Simple Maximization Using Optim Doesnt Optimize

2020-03-12 Thread Skyler Saleebyan
I am trying to familiarize myself with optim() with a relatively simple maximization. Description: L and K are two terms which are constrained to add up to a total 10 (with respective weights to each). To map this constraint I plugged K into the function (to make this as simple as possible.)

[R] [Rd] R 4.0.0 scheduled for April 24

2020-03-12 Thread Peter Dalgaard via R-help
Full schedule is available on developer.r-project.org. Notice that Copenhagen Business School, like all Danish educational institutions, is physically locked down for two weeks due to COVID-19. The schedule is automated, but there may be irregularities with the nightly builds, if things act up

Re: [R-es] conocer un elemento a partir de su rowname y colname

2020-03-12 Thread Marcelino De La Cruz Rot
Hola Manuel: ¿Has probado esto?: df["caso","variable"] Salud, Marcelino El 12/03/2020 a las 12:25, Manuel Mendoza escribió: > Buenos días erreros, tengo una df y necesito extraer un elemento de forma > automática de una variable chr, pero no a partir de su posición en la df > sino del

Re: [R-es] conocer un elemento a partir de su rowname y colname

2020-03-12 Thread Carlos Ortega
H, puedes poner un ejemplo... no lo entiendo muy bien... Gracias, Carlos www.qualityexcellence.es El jue., 12 mar. 2020 a las 12:26, Manuel Mendoza (< mmend...@fulbrightmail.org>) escribió: > Buenos días erreros, tengo una df y necesito extraer un elemento de forma > automática de una

[R-es] conocer un elemento a partir de su rowname y colname

2020-03-12 Thread Manuel Mendoza
Buenos días erreros, tengo una df y necesito extraer un elemento de forma automática de una variable chr, pero no a partir de su posición en la df sino del nombre del caso y de la variable. Gracias, y que el coronavirus os pille bien sanos (pues no hay escapatoria). Manuel [[alternative