Re: [R] Package nleqslv ERROR

2017-08-11 Thread Berend Hasselman
Just to set things straight: The error message "Error in nleqslv(xstart, fun) : Length of fn result <> length of x!" is issued by the underlying nleqslv C function. refers to the second argument of function nleqslv which is named fn. It is not issued by R itself. Other have already pointed

Re: [R] Package nleqslv ERROR

2017-08-09 Thread J C Nash
Maybe it's simpler to point out that nonlinear EQUATIONS need n equations for n unknowns. 4 only equals 2 through the looking glass. Alternatively, maybe the OP wants to adjust the 2 parameters to best fit the 4 relationships, in which case nlsr package function nlfb() would be appropriate.

Re: [R] Package nleqslv ERROR

2017-08-09 Thread Mark Sharp
Santi, In the second line of your function you have the following: f <- numeric(length(x)) This sets the length of this numeric vector (i.e., "f") to the length of the vector "x". Later, inside the function you assign to values to 4 elements of the vector "f". This assumes that "f" is at least

[R] Package nleqslv ERROR

2017-08-09 Thread Santi Burone
Dear all, I am relatively new to R and have had some difficulty in understanding an error i get when running a code to solve a system of non-linear equations, with four equations and two variables. This is my code: ALPHA <- c(-0.0985168033402, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4) BETA <-