Re: [R] Odd Results when generating predictions with nnet function

2020-09-02 Thread Paul Bernal
You are right Jeff, that was a mistake, I was focusing on the square root and made the mistake of talking about taking the square root instead of raising to the 2nd power. This is the example I was following ( https://www.youtube.com/watch?v=SaQgA6V8UA4). Of course, I tried fitting the nnet model

Re: [R] Odd Results when generating predictions with nnet function

2020-09-02 Thread peter dalgaard
The problem seems to be the fit rather than the predictions. Looks like nnet is happier with data between 0 and 1, witness Fit <- nnet(y/max(y) ~ x, a, size = 5, maxit = 1000, lineout = T, decay = 0.001) plot(y/max(y)~x,a) lines(fitted(Fit)~x,a) > On 2 Sep 2020, at 16:21 , Paul Bernal wrote:

Re: [R] Odd Results when generating predictions with nnet function

2020-09-02 Thread Jeff Newmiller
Why would you expect raising y_pred to the 0.5 to "backtransform" a model sqrt(y)~x? Wouldn't you raise to the 2? Why would you "backtransform" x in such a model if it were never transformed in the first place? Dr Maechler did not suggest that. And why are you mentioning some random

Re: [R] Odd Results when generating predictions with nnet function

2020-09-02 Thread Paul Bernal
Dear Dr. Martin and Dr. Peter, Hope you are doing well. Thank you for your kind feedback. I also tried fitting the nnet using y ~ x, but the model kept on generating odd predictions. If I understand correctly, from what Dr. Martin said, it would be a good idea to try modeling sqrt(y) ~ x and then

Re: [R] Odd Results when generating predictions with nnet function

2020-09-02 Thread Martin Maechler
> peter dalgaard > on Wed, 2 Sep 2020 08:41:09 +0200 writes: > Generically, nnet(a$y ~ a$x, a ...) should be nnet(y ~ x, > data=a, ...) otherwise predict will go looking for a$x, no > matter what is in xnew. > But more importantly, nnet() is a _classifier_, >

Re: [R] Odd Results when generating predictions with nnet function

2020-09-02 Thread peter dalgaard
Generically, nnet(a$y ~ a$x, a ...) should be nnet(y ~ x, data=a, ...) otherwise predict will go looking for a$x, no matter what is in xnew. But more importantly, nnet() is a _classifier_, so the LHS should be a class, not a numeric variable. -pd > On 1 Sep 2020, at 22:19 , Paul Bernal