title: R fitting equation (Nikolsky-Eisenman equation) to data
body: <p>I used to use <em>SigmaPlot</em> to fit a modified version of the Nikolsky-Eisenman equation of the form</p>
  
  <pre><code>y = P1 + P2 * log(10^(-x) + P3)
  </code></pre>
  
  <p>using the global curve fit function. Details of parameters can be found in the Sigmaplot report below. I want to do this now in R.</p>
  
  <p>Some data:</p>
  
  <pre><code>pNO3 &lt;- c(1.1203, 2.0410, 3.0155, 4.0048, 4.3045, 5.0, 6.0)
  mV &lt;- c(45.2, 100.9, 160.9, 215.7, 231.5, 244.5, 257.4)
  data &lt;- data.frame(pNO3, mV)
  plot(data$pNO3, data$mV)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/7WOhR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7WOhR.png" alt="enter image description here"></a></p>
  
  <p>The graph and report generated by sigmaplot for the above data is shown below.
  Can anyone point me in the right direction of how to generate something similar in R?</p>
  
  <pre><code>NonLinear Regression - Global Curve Fitting     Wednesday, May 01, 2013, 13:04:55
  Data Source: Data 1 in Notebook1
  Equation: User-Defined, Nicolsky Eisenman
  f=P1+P2*log(10^(-x)+P3)
  Data Set Specifications:
  Data Set    Independent Variable    Dependent Variable
  1           Column 3        Column 7
  Global Parameters:
  A Global Parameter is shared across all data sets.
  Global Goodness of Fit:
  R   Rsqr    Adj Rsqr    Standard Error of Estimate
  0.9997  0.9994  0.9991      2.4421  
  Analysis of Variance: 
  Analysis of Variance: 
      DF  SS  MS  
  Regression    3 264242.5551 88080.8517
  Residual    4   23.8549 5.9637  
  Total   7   264266.4100 37752.3443  
  Corrected for the mean of the observations:
      DF  SS  MS  F   P   
  Regression  2   38844.3822  19422.1911  3256.7192   &lt;0.0001 
  Residual    4   23.8549 5.9637  
  Total   6   38868.2371  6478.0395   
  Statistical Tests:
  Normality Test (Shapiro-Wilk)           Passed  (P = 0.4003)
  W Statistic= 0.9106 Significance Level = 0.0500
  Constant Variance Test      Passed  (P = 0.1209)
  Number of Observations =  7 
  Rsqr  = 0.9994 
  Residual Sum of Squares = 23.8549 
  Parameter Estimates:
      Coefficient Std. Error  t   P
  P1  -24.3265      3.3330    -7.2987 0.0019
  P2  -61.7088      1.2861    -47.9796    &lt;0.0001
  P3  2.8351E-005   4.6040E-006   6.1579  0.0035
  Fit Equation Description:
  [Variables]
  f0_x = col(3)
  f0_y = col(7)
  [Parameters]
  f0_P1 = 0 ' {{previous: -24.3265}}
  f0_P2 = -5 ' {{previous: -61.7088}}
  f0_P3 = 0 ' {{previous: 2.8351e-005}}
  [Equation]
  f0 = f0_P1+f0_P2*log(10^(-f0_x)+f0_P3)
  fit f0 to f0_y
  [Constraints]
  [Options]
  tolerance=0.000100
  stepsize=100
  iterations=100
  Number of Iterations Performed = 4
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/gKLwN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gKLwN.png" alt="enter image description here"></a></p>