How to use this calculator
Fit y=a·x^b by least squares on natural-log measurements and predict the geometric response at a positive x value.
- Enter Positive predictor values, Positive response values, Positive prediction x. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Log linear power law data fit explained
The model fits a straight line to ln(y) versus ln(x), then converts its intercept and slope into the power-law scale and exponent. With ordinary least squares on log responses, the prediction is centered on the log scale and is not automatically corrected to an arithmetic-mean forecast.
Inputs, symbols, and units
x— Positive predictor values- Ordered values in the role named above. Match row positions with other lists and use a consistent measurement unit within the same variable. Use comma-separated values in the stated order.
y— Positive response values- Ordered values in the role named above. Match row positions with other lists and use a consistent measurement unit within the same variable. Use comma-separated values in the stated order.
q— Positive prediction x- Positive predictor value where the fitted geometric response is evaluated, in the same unit as x.
Formula and method
ln yi=ln a+b ln xi+εi; a=exp(intercept of log regression).
Transform both measured variables with natural logarithms and fit an ordinary line. Back-transforming the fitted log response gives a geometric center or conditional median under symmetric normal log errors, not an automatically bias-corrected arithmetic mean.
A worked scenario
Positive predictor values = 1,2,3,5,8; Positive response values = 2.1,5.8,10.2,22.4,46.7; Positive prediction x = 4.
- Fitted power exponent: 1.48774803
- Multiplicative scale coefficient: 2.06315356 y units/x unit^exponent
- Predicted geometric response: 16.22725724 y units
- Log-scale R²: 0.99958283
The example spans x from one to eight and predicts at four, inside that range. Log fitting gives relative departures more comparable weight than fitting raw y residuals.
Assumptions and edge cases
Positive x and y, at least three matching observations, and varying log x. The fit minimizes log-scale errors rather than original-scale squared residuals. Extrapolation and multiplicative error assumptions need separate judgment.
Reading the outputs
The exponent is dimensionless. The scale coefficient depends on the selected units of x and y, while the displayed R squared is computed in log space.
Frequently asked questions
Can zero responses be included?
No. Their logarithms are undefined; adding an arbitrary constant changes the model.
Does back-transformation give an arithmetic mean?
Not without a justified bias correction or explicit error model.
Is this a general nonlinear least-squares power fit?
No. It is specifically a log-linear fit with log-scale residuals.
How do I use the Log linear power law data fit calculator?
Enter Positive predictor values, Positive response values, Positive prediction x. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Log linear power law data fit?
Positive predictor values = 1,2,3,5,8; Positive response values = 2.1,5.8,10.2,22.4,46.7; Positive prediction x = 4. Fitted power exponent: 1.48774803 Multiplicative scale coefficient: 2.06315356 y units/x unit^exponent Predicted geometric response: 16.22725724 y units Log-scale R²: 0.99958283 The example spans x from one to eight and predicts at four, inside that range. Log fitting gives relative departures more comparable weight than fitting raw y residuals.
Method reference: Statsmodels linear regression model definitions.
Read our calculation methodology.