LOGARITHMIC CURVE FIT
Logarithmic Regression Calculator
Fit a logarithmic curve ŷ = a + b·ln(x) to paired X and Y observations. The predictor X must be positive. The result includes the equation, graph, R², RMSE and residuals.
YOUR DATA
Enter paired observations
Paste or upload numeric X and Y columns. All X values must be greater than zero. Use a period as the decimal mark. Up to 5 MB and 5,000 observations are accepted.
The file is read locally in your browser.
YOUR RESULTS
Logarithmic fit
Observed values and fitted curve
Each point is one input observation.
Residuals by observation
Residual = observed Y − predicted Y.
| Row | Observed Y | Predicted Y | Residual |
|---|
How to use this calculator
- Paste paired X and Y values, or load the worked example.
- Choose the X and Y columns. Every X value must be strictly positive because ln(x) is undefined at zero and for negative numbers.
- Review the fitted equation, curve, R², RMSE and residuals.
- Download a JSON summary that records the method and any exclusions.
Formula and calculation method
The model is ŷ = a + b·ln(x). The calculator transforms each predictor to w = ln(x) and fits the straight line ŷ = a + bw by ordinary least squares. The slope b and intercept a are displayed directly in the original equation.
R² = 1 − SSE/SST and RMSE = √(SSE/n), both computed from the original-scale predictions and observed Y values.
Worked example: X = [1, e, e²] and Y = [0, 1, 2]. Then ln(X) = [0, 1, 2], so the least-squares line through these points is ŷ = 0 + 1·ln(x), giving a = 0 and b = 1.
Assumptions and limitations
- Every observed X must be a finite positive number. Zero or negative X values are rejected because ln(x) is undefined.
- At least two complete paired observations with distinct positive X values are required.
- The fitting criterion is squared error in Y after log-transforming X. It does not test whether a logarithmic relationship is appropriate or whether errors are independent.
- R² and RMSE describe fit to these input observations only; they do not prove causation or predict new data.
- Extrapolation below zero or far outside the observed X range is not meaningful for this model.
- The current input limit is 5,000 observations and 5 MB per file.
Related calculators
Linear regression · Exponential regression · Quadratic regression · Compare regression models