Nonlinear regression with R
I have the following datasets:
x1 <- c(0.00113, 0.00123, 0.00125, 0.0013, 0.00136, 0.0014, 0.00146,
0.00151,0.00158,0.00163,0.00166)
x2 <- c(0.99887, 0.899, 0.79823, 0.6942, 0.59889, 0.49958, 0.39972,
0.29933,0.19983,0.0997,0)
x3 <- c(0,0.09977, 0.20051, 0.3045, 0.39975, 0.49902, 0.59883, 0.69916,
0.79859,0.89867,0.99834)
x4 <- c(-6.785538, -6.700741, -6.684612, -6.645391, -6.600271, -6.571283, -6.529319,
-6.495646,-6.450330,-6.419175,-6.400938)
I have the following fixed parameters:
R <- 8.314
Tm <- 510.15
H <- 17.7
Need to adjust the following model with 7 parameters:
NRTL <- x4~(H/R)*((1/Tm)-(1/293.15))-(((t21*exp(-a*t21)*x2)+(t31*exp(-a*t31)*x3))/((x1+(exp(-a*t21)*x2)+(exp(-a*t31)*x3)))+(x1/((x1+(exp(-a*t21)*x2)+(exp(-a*t31)*x3)))*(((-x2*t21*exp(-a*t21))-(x3*t31*exp(t31)))/(x1+(exp(-a*t21)*x2)+(exp(-a*t31)*x3)))+(((x2*exp(-a*t12))/((exp(-a*t12)*x1)+x2+(exp(-a*t32)*x3)))*(t12-(((x1*t21*exp(-a*t21))+(x3*t32*exp(-a*t32)))/((exp(-a*t12)*x1)+x2+(exp(-a*t32)*x3))))+((x3*exp(-a*t13))/((exp(-a*t13)*x1)+(exp(-a*t23)*x2)+x3))*(t13-(((x1*t13*exp(-a*t13))+(x2*t23*exp(-a*t23)/((exp(-a*t13)*x1)+(exp(-a*t23)*x2)+x3))))))))
Could anyone help with the code in R? I am not being able to perform nonlinear regression because I am not being able to get reasonable values for the initial estimates of the parameters.
Note: the parameters are as follows:
a t12 t13 t21 t23 t31 t32
0
Author: Rui Barradas, 2019-09-19