Skip to content

Error meaning

3 messages · Roslina Zakaria, David Winsemius, Berend Hasselman

#
When I look at this line:

f4 <- pars[1]*pars[2]*pars[3](pars[1]+pars[4])

It appears to my wet-brain interpreter that you are trying to apply a  
function par[3] to the argument (pars[1]+pars[4])

When I insert a "*", I then get output but I don't know if it is  
correct.

 > newton.input2(pars)
$fval
[1]   46.00 3956.00 6181.25 4439.00

$jacobian
      [,1]      [,2]   [,3]  [,4]
[1,]   40      1.15      0 0e+00
[2,] 5280    197.80      0 0e+00
[3,] 8250    247.25      0 0e+00
[4,] 6160 126950.00 101560 1e+05
#
Roslina Zakaria wrote:
I agree with David. 
The formula for f4 is surely incorrect.

Furthermore:

1. what is the newt package you mention. I can't find it on CRAN.

2. A solution of your system is pars = [ 0, anything, anything, anything ]
   (if pars[1] == 0 then all f-values will also be 0 regardless of values
for pars[2:4])
    There are more solutions to your system (try pars = c(-1 , 0, 0, 0)).

3. The jacobian you generate is incorrect

4. I tried to solve your system with the correction mentioned above with my
package nleqlsv.
   I have to change the return value of your function newton.input2 to only
return fval.

   Using Broyden and a numerical jacobian. As far as I can see, this
confirms the point I made in item 2.
pars[1] = 0 with arbitrary values in pars[2], pars[3], pars[4] is a
solution.


Berend