What are you working on?

Find a calculator, explore a formula, or learn the method.

THE ENGINEERING REFERENCE / GUIDE

Fitting a Power-Law Correlation: Residuals, Units, and Range of Application

Short Answer

A power-law correlation of the form y = k x^n is usually fitted either by ordinary least squares on logarithmically transformed data or by nonlinear least squares on the original data — two approaches that minimize different residuals and can give different answers. The exponent n is dimensionless, the prefactor k carries units determined by x and y, and the fitted correlation is trustworthy only within the range of data used to fit it.

Power laws — relationships of the form y = k xn, where one variable is proportional to another raised to an exponent — are among the most common empirical models in engineering and science. Fitting one to data is simple in principle, but a defensible fit requires attention to three details that are easy to overlook: which residuals the fitting method actually minimizes, what units the fitted constant carries, and the range of conditions over which the correlation may be applied. This article explains what a power-law correlation is, compares the two standard fitting approaches, shows how the units of the constants are determined, and explains how to state and respect a correlation’s range of application.

What a power-law correlation is

A power law expresses one quantity as a constant multiplier times another raised to an exponent: y = k xn, where k (the prefactor) and n (the exponent) are unknown constants to be determined from data. Such relationships are widespread. A classic laboratory example is the period of a simple harmonic oscillator, where one may suspect a power-law dependence on the oscillating mass without knowing either constant in advance, as described in a Pomona College physics lab module on power-law fitting (Power-Law Fitting and Log-Log Graphs). In engineering practice, correlations usually connect dimensionless groups — pipe-flow friction factors as a function of Reynolds number, for instance, or heat-transfer Nusselt numbers as functions of Reynolds and Prandtl numbers.

The defining property that makes power laws convenient is that they become straight lines under a logarithmic transformation. Taking logs of both sides gives log y = log k + n log x, so on log–log axes the data should follow a line whose slope is the exponent n and whose intercept is log k. If n were already known, one could simply plot y against xn and read k from the slope; because n usually is not known, the log transformation avoids having to guess and test candidate exponents (Pomona College handout).

Two fitting approaches: log-space regression versus nonlinear least squares

The traditional approach is to transform both variables — replace each y value with ln y and each x value with ln x — and apply ordinary least squares to the transformed pairs, exactly as for any straight line (Wall & Jenkins, Practical Statistics for Astronomers II, §3.1). The slope estimates n; the intercept estimates ln k, and k is recovered by exponentiating.

The alternative is nonlinear least squares (NLS): fit y = k xn directly to the untransformed data, adjusting k and n until the sum of squared residuals in y is minimized. A further variant, generalized nonlinear least squares, extends this to data whose scatter changes with magnitude.

These methods are not interchangeable. A 2024 methods review by R. D. Moore in the Confluence Journal of Watershed Science and Management — a field where power-law rating curves are routine — notes that log-transformed ordinary least squares, nonlinear least squares, and generalized nonlinear least squares rest on different model characteristics and can yield different fitted relationships and different prediction limits (Moore, 2024). The choice should follow the error structure of the measurements: if scatter is roughly proportional to the magnitude of y (multiplicative, relative errors), regression in log space matches the data-generating process; if scatter is roughly constant in absolute terms, fitting on the original scale is the better match.

A related caution comes from least-squares theory itself: the formal justification for minimizing squared residuals is cleanest for linear models with Gaussian errors, and after a nonlinear transformation such as taking logarithms the residuals generally cannot be Gaussian. Minimizing squares remains possible and frequently sensible, but the statistical guarantees of the untransformed setting should not be assumed to carry over automatically (Wall & Jenkins).

AspectLeast squares on log-transformed dataNonlinear least squares (original scale)
Quantity minimizedSquared residuals of log ySquared residuals of y
Implied error behaviorRelative (multiplicative) scatterAbsolute scatter
Effective weightingLarge and small values carry comparable weightLarge values dominate
Prediction limitsNatural in log space; differ from original-scale limitsComputed directly for y

Residuals: what the fit actually minimizes

A residual is the difference between an observed value and the value the fitted model predicts. The essential point for power laws is that the two fitting spaces produce different residuals. In a log-space fit, residuals are differences of logarithms — observed ln y minus fitted ln y — which correspond to relative discrepancies: a factor-of-two miss is weighted the same whether y is 2 or 2,000. On the original scale, residuals are absolute differences, so the largest values dominate unless the data are weighted deliberately.

Both views are diagnostically valuable. A fit that looks excellent on log–log axes can show systematic curvature or trending residuals once back-transformed, particularly at the high end of the data, and the reverse can happen as well. Because logarithmic axes compress wide ranges, mild curvature can be nearly invisible in the transformed plot yet matter on the original scale. The standard safeguard is to inspect residuals in both spaces, plotted against the fitted values: patterns signal either the wrong error assumption or a model that holds only approximately (Moore, 2024; Wall & Jenkins).

Units of the fitted constants

Units are where power-law fits most often fail quietly. A parameter-units guide for the WAPP+ fitting software states two rules that settle most questions (WAPP+: Units of Parameters):

  • Numbers that are added, subtracted, or set equal to one another must have the same units.
  • Standard mathematical functions — sin, cos, exp, log and their relatives — produce unitless output.

The second rule has a direct consequence: the logarithm of a dimensional quantity is not strictly defined. What is meaningful is the logarithm of a ratio, such as ln(y/y0), where the reference is a unit of y. Software silently strips units when taking logs, but the constant extracted from the intercept inherits a dependence on the units used.

For a power law, the first rule fixes the units of k. Because k xn must carry the units of y, and xn carries the units of x raised to the power n, the prefactor has units of y divided by x to the power n. The exponent n itself is dimensionless. A practical consequence: refitting with x expressed in meters rather than millimeters leaves n unchanged but multiplies k by 1000n.

The same rules generalize to any fitting form. In the WAPP+ example, an exponential fit y = A exp(Bx) to data with x recorded in minutes and y in counts per second returns A = 1001 counts/s and B = −0.1501 min−1: A takes the units of y and B the inverse units of x (WAPP+ guide).

The robust remedy is to build correlations between dimensionless groups — Reynolds, Prandtl, Nusselt numbers and the like — so that both k and n are dimensionless and the correlation is independent of any unit system. When a fitted variable is dimensional, the units must travel with the coefficient. As a hypothetical illustration: suppose pressure-drop data collected between 5 and 25 m³/h are fitted to ΔP = k Qn, giving n ≈ 1.9 and a k in kPa per (m³/h)n. Using that coefficient with a flow rate in gallons per minute, without conversion, would mispredict pressure drops by a large factor even though the exponent carries over unchanged. The coefficient and the unit convention are a package; one without the other is incomplete.

Range of application

Engineering power laws are empirical summaries, not limit-free laws of nature. Their exponents typically reflect a particular operating regime, and the same system can follow different power laws in different regimes. Pipe flow is the standard illustration: in laminar flow the friction factor varies as 1/Re, whereas smooth-pipe turbulent flow is described over limited ranges by much shallower power laws, classically the Blasius form with the friction factor proportional to Re−1/4. On a log–log plot spanning both regimes the relation bends rather than remaining a single straight line.

Two consequences follow. First, report the fitted range — the span of the independent variable or dimensionless group covered by the data — together with the coefficients, and treat any prediction outside that span as an extrapolation for which neither k nor n is guaranteed. Second, do not over-read straightness: because logarithmic axes compress decades, data over a narrow range can look convincingly linear while hiding curvature that appears once the correlation is pushed further. Where the regime changes, a single power law fits poorly by construction; piecewise fits with explicitly stated breakpoints are the appropriate alternative.

Uncertainty reporting belongs to the same discipline. Moore (2024) emphasizes that prediction limits differ among fitting methods, so a correlation should state not only its coefficients but also how its limits were computed and on which scale — log or original — they apply.

A practical checklist

  1. Plot the data on log–log axes to confirm that a power law is plausible for the full data set (Pomona College handout).
  2. Decide the error model: relative, multiplicative scatter favors log-space ordinary least squares; absolute scatter favors nonlinear least squares on the original scale (Moore, 2024).
  3. Nondimensionalize the variables where possible, or fix and record the unit convention for x and y.
  4. Fit the model and record the exponent n and the prefactor k with its units (y units divided by x units to the power n) and their uncertainties.
  5. Inspect residuals in both log and original space for trends, curvature, or changing spread; refit, reweight, or switch methods if patterns appear.
  6. State the fitted range of the independent variable or dimensionless group, along with prediction limits and the scale on which they were computed.
  7. Refrain from extrapolation; if behavior outside the fitted range matters, gather data there rather than assuming the constants still apply.

Common mistakes

  • Taking logs of dimensional numbers without a reference. The intercept — and therefore k — silently depends on the units used, while the exponent does not. Normalize or state the unit convention (WAPP+ guide).
  • Assuming the two fitting methods agree. Log-space least squares and original-scale nonlinear least squares minimize different residuals and can give noticeably different coefficients and prediction limits (Moore, 2024).
  • Judging fit quality in the transformed space only. A good log–log fit can conceal absolute errors that matter when the correlation is used to predict y.
  • Reporting a bare coefficient. A value of k without units is unusable; k carries the units of y divided by those of x to the power n.
  • Extrapolating silently. Applying the correlation outside the fitted range is a new assumption, not a result of the fit, and should be labeled as such.

Key takeaways

A power-law correlation is defined as much by its residuals, units, and stated range as by its two constants. The log–log transformation turns y = k xn into a straight line of slope n, but fitting in log space minimizes relative residuals while fitting on the original scale minimizes absolute ones, and the methods do not give identical answers or identical prediction limits. The exponent is dimensionless; the prefactor is not, so it must be reported with the units of both variables. Finally, the correlation is an empirical summary: its coefficients are trustworthy inside the fitted range, and use outside that range is an extrapolation that should be declared, not assumed.

FAQ

Can I take the logarithm of a quantity with units?

Strictly, no: logarithms and exponentials are defined only for dimensionless arguments. In practice one takes the log of a ratio, such as y divided by a reference unit. The consequence for fitting is that a log-space intercept — and hence the recovered constant k — depends on the units chosen for x and y, while the exponent n does not.

Do fitting in log space and fitting on the original scale give the same power law?

Usually not. Log-space least squares minimizes residuals of log y (relative errors), while nonlinear least squares minimizes residuals of y (absolute errors). Moore (2024) shows that these approaches, together with generalized nonlinear least squares, can produce different coefficients and different prediction limits; the choice should follow the error structure of the data.

What does the slope of a straight line on log-log axes represent?

It estimates the exponent n in y = k x^n. The intercept equals log k, so the prefactor k is recovered by exponentiating the intercept — and it carries units of [y] divided by [x] to the power n.

Can I use a fitted power-law correlation outside the fitted data range?

It should not be used beyond the range of conditions covered by the fitting data. Exponents often reflect a specific regime (for example, laminar versus turbulent flow), and the relation may change form outside that regime; predictions outside the fitted range are extrapolations.

What are the units of the constant in a correlation such as pressure drop versus flow rate?

For y = k x^n, k has units of [y]/[x]^n — for a fit of pressure drop to flow rate raised to a power, units of pressure per (flow rate)^n. The coefficient must always be reported together with the units used for x and y in the fit.

References

  1. Pomona College Physics, "Power-Law Fitting and Log-Log Graphs" (lab handout LR05). http://www.physics.pomona.edu/sixideas/old/labs/LRM/LR05.pdf
  2. "WAPP+: Units of Parameters," WAPP+ documentation, physics.csbsju.edu. http://www.physics.csbsju.edu/stats/WAPP2_units.html
  3. Moore, R. D. (2024). "Fitting Power-Law Relations in Watershed Science and Analysis, with an Example Using the R Language." Confluence: Journal of Watershed Science and Management 7(1). https://doi.org/10.22230/jwsm.2024v7n1a53
  4. Wall, J. V., & Jenkins, C. R. "Practical Statistics for Astronomers II," §3.1: The Method of Least Squares — Regression Analysis. NASA/IPAC NED Level 5. https://vo.ned.ipac.caltech.edu/level5/Wall2/Wal3_1.html

Related Terms

Leave a Reply

Your email address will not be published. Required fields are marked *