Home  /  Products  /  Features  /  Fractional polynomials

<-  See Stata's other features

Highlights

  • More flexible parameterization than with polynomials

  • Prefix command for use with any estimation command

Fractional polynomials are an alternative to regular polynomials that provide flexible parameterization for continuous variables.

For example, say we have an outcome \(y\), a regressor \(x\), and our research interest is in the effect of \(x\) on \(y\). We know that \(y\) is also affected by \(age\). One solution to this problem would be to fit a linear regression of the form

\(y_1 = b_0 + b_1x_i + b_2age_i + b_3age_i\!^2 + u_i\)

An alternative would be to control for age using fractional polynomials:

\(y_i = b_0 + b_1x_i + b_2age_i\!^{(p2)} + u_i\)

Fractional powers are different from regular powers, and we emphasize this difference by enclosing the fractional power in parentheses. For instance, \(age^{(0)}\) is \(ln(age)\). You can see the full definition, but one example will demonstrate the power of fractional polynomials.

To fit the fractional polynomial model, we type

. fp <age>, scale: reg y x <age>
(fitting 44 models)
(....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%)

Fractional polynomial comparisons:
Test Residual Deviance
age df Deviance std. dev. diff. P Powers
omitted 4 -83.145 0.237 625.517 0.000
linear 3 -179.287 0.232 529.376 0.000 1
m = 1 2 -295.392 0.225 413.270 0.000 3
m = 2 0 -708.663 0.203 0.000 -- -.5 -.5
Note: Test df is degrees of freedom, and P = P > F is sig. level for tests comparing models vs. model with m = 2 based on deviance difference, F(df, 1994).
Source SS df MS Number of obs = 2,000
F(3, 1996) = 347.37
Model 42.8971855 3 14.2990618 Prob > F = 0.0000
Residual 82.1620986 1,996 .041163376 R-squared = 0.3430
Adj R-squared = 0.3420
Total 125.059284 1,999 .062560923 Root MSE = .20289
y Coefficient Std. err. t P>|t| [95% conf. interval]
x .7954347 .0466225 17.06 0.000 .7040008 .8868686
age_1 11.04709 .4085977 27.04 0.000 10.24577 11.84841
age_2 13.17616 .4991682 26.40 0.000 12.19722 14.15511
_cons -8.059393 .5469551 -14.74 0.000 -9.132056 -6.98673

We find that \(b_1\), the effect of \(x\) on \(y\), is 0.80, but before we take that result seriously, we must ask ourselves whether we have adequately controlled for age.

. fp plot, residuals(none)

Notice the shape of the \(y\) versus \(age\) curve. We could not have obtained that shape using a standard quadratic. Fractional polynomials provide a wide range of shapes that include all the shapes provided by ordinary polynomials and more. The fractional polynomial parameterization did not predetermine that the shape we obtained was skewed right. Fractional polynomials can just as easily produce skewed left shapes.

We still need to do more to convince ourselves that the curve above is adequate, but we will not do so here

Tell me more

See the fractional polynomial manual entry.