I am working with R with this code from the book "Bootstrap Methods: With Applications in R" by Gerhard Dikta and Marsel Scheer:
set.seed(123,kind ="Mersenne-Twister",normal.kind ="Inversion")
semiparametric_data <-
data.frame(X = runif(400, min = 1, max = 30)) %>%
dplyr::mutate(
mu = 4 * exp(-X/2) - 3 * exp(-X/10), epsilon = rnorm(400, sd = 0.25),
Y = mu + epsilon)
fit_sp <- minpack.lm::nlsLM(
formula = Y ̃ a * exp(X/b) + c * exp(X/d),
data = semiparametric_data,
start = c(a = 4, b = -2, c = -3, d = -10),
control = nls.control(maxiter = 1000))
fit_sp
## Nonlinear regression model
## model: Y ̃ a * exp(X/b) + c * exp(X/d)
## data: semiparametric_data
## a b c d
## 3.707 -2.105 -3.025 -9.797
## residual sum-of-squares: 23.76
##
## Number of iterations to convergence: 3
## Achieved convergence tolerance: 1.49e-08
- What does minimize the
nls
function? RMSE or MSE? - What is the difference between minimizing RMSE or MSE?
By a theoretical/mathematical point of view the resulting coefficients should be the same but in fact the resulting coefficients are slightly different.
- What is more efficient to minimize between RMSE and MSE in non linear least squares?
minpack.lm::nlsLM
. Are you comparing this tonls
? As noted in my answer,nls
andnlsLM
use different algorithms (Gauss-Newton vs Levenberg-Marquardt). $\endgroup$