Stata 15 help for fracpoly

fracpoly has been superseded by fp. fracpoly continues to work but, as of Stata 13, is no longer an official part of Stata. This is the original help file, which we will no longer update, so some links may no longer work.

-------------------------------------------------------------------------------

Title

[R] fracpoly -- Fractional polynomial regression

Syntax

Fractional polynomial regression

fracpoly [, fracpoly_options] : regression_cmd [yvar1 [yvar2]] xvar1 [# [#...]] [xvar2 [# [#...]]] [...] [xvarlist] [if] [in] [ weight] [, regression_cmd_options]

Display table showing the best fractional polynomial model for each degree

fracpoly , compare

Create variables containing fractional polynomial powers

fracgen varname # [# ...] [if] [in] [, fracgen_options]

fracpoly_options Description ------------------------------------------------------------------------- Model degree(#) degree of fractional polynomial to fit; default is degree(2)

Model 2 noscaling suppress scaling of first independent variable noconstant suppress constant term powers(numlist) list of fractional polynomial powers from which models are chosen center(cent_list) specification of centering for the independent variables all include out-of-sample observations in generated variables

Reporting log display iteration log compare compare models by degree display_options control column formats and line width -------------------------------------------------------------------------

regression_cmd_options Description ------------------------------------------------------------------------- Model 2 regression_cmd_options options appropriate to the regression command in use -------------------------------------------------------------------------

All weight types supported by regression_cmd are allowed; see weight. See [R] fracpoly postestimation for features available after estimation.

where

cent_list is a comma-separated list with elements varlist:{mean|#|no}, except that the first element may optionally be of the form {mean|#|no} to specify the default for all variables.

regression_cmd may be clogit, glm, intreg, logistic, logit, mlogit, nbreg, ologit, oprobit, poisson, probit, qreg, regress, rreg, stcox, stcrreg, streg, or xtgee.

fracgen_options Description ------------------------------------------------------------------------- Main center(no|mean|#) center varname as specified; default is center(no) noscaling suppress scaling of varname restrict([varname] [if]) compute centering and scaling using specified subsample replace replace variables if they exist -------------------------------------------------------------------------

Menu

fracpoly

Statistics > Linear models and related > Fractional polynomials > Fractional polynomial regression

fracgen

Statistics > Linear models and related > Fractional polynomials > Create fractional polynomial powers

Description

fracpoly fits fractional polynomials (FPs) in xvar1 as part of the specified regression model. After execution, fracpoly leaves variables in the dataset named Ixvar__1, Ixvar__2, ..., where xvar represents the first four letters of the name of xvar1. The new variables contain the best-fitting FP powers of xvar1.

Covariates other than xvar1, which are optional, are specified in xvar2, ..., and xvarlist. They may be modeled linearly and with specified FP transformations. Fractional polynomial powers are specified by typing numbers after the variable's name. A variable name typed without numbers is entered linearly.

fracgen creates new variables named varname_1, varname_2, ..., containing FP powers of varname by using the powers (#[# ...]) specified.

See [R] fracpoly postestimation for information on fracplot and fracpred.

See [R] mfp for multivariable FP model fitting.

Options for fracpoly

+-------+ ----+ Model +------------------------------------------------------------

degree(#) determines the degree of FP to be fit. The default is degree(2), that is, a model with two power terms.

+---------+ ----+ Model 2 +----------------------------------------------------------

noscaling suppresses scaling of xvar1 and its powers.

noconstant suppresses the regression constant if this is permitted by regression_cmd.

powers(numlist) is the set of FP powers from which models are to be chosen. The default is powers(-2, -1, -.5, 0, .5, 1, 2, 3) (0 means log).

center(cent_list) defines the centering for the covariates xvar1, xvar2, ..., xvarlist. The default is center(mean). A typical item in cent_list is varlist:{mean|#|no}. Items are separated by commas. The first item is special because varlist: is optional, and if omitted, the default is (re)set to the specified value (mean or # or no). For example, center(no, age:mean) sets the default to no and sets the centering for age to mean.

regression_cmd_options are options appropriate to the regression command in use. For example, for stcox, regression_cmd_options may include efron or some alternate method for handling tied failures.

all includes out-of-sample observations when generating the best-fitting FP powers of xvar_1, xvar_2, etc. By default, the generated FP variables contain missing values outside the estimation sample.

+-----------+ ----+ Reporting +--------------------------------------------------------

log displays deviances and (for regress) residual standard deviations for each FP model fit.

compare reports a closed-test comparison between FP models.

display_options: cformat(%fmt), pformat(%fmt), sformat(%fmt), and nolstretch; see [R] estimation options.

Options for fracgen

+------+ ----+ Main +-------------------------------------------------------------

center(no|mean|#) specifies whether varname is to be centered; the default is center(no).

noscaling suppresses scaling of varname.

restrict([varname] [if]) specifies that centering and scaling be computed using the subsample identified by varname and if.

The subsample is defined by the observations for which varname!=0 that also meet the if conditions. Typically, varname=1 defines the subsample and varname=0 indicates observations not belonging to the subsample. For observations whose subsample status is uncertain, varname should be set to a missing value; such observations are dropped from the subsample.

By default, fracgen computes the centering and scaling by using the sample of observations identified in the [if] [in] options. The restrict() option identifies a subset of this sample.

replace specifies that any existing variables named varname_1, varname_2, ..., may be replaced.

Examples

--------------------------------------------------------------------------- Setup . webuse igg

Fit a second-degree fractional polynomial regression model . fracpoly: regress sqrtigg age

Fit a fourth-degree fractional polynomial regression model and compare to models of lower degrees . fracpoly, degree(4) compare: regress sqrtigg age

Fit a fractional polynomial regression model using powers -2 and 2 . fracpoly: regress sqrtigg age -2 2

--------------------------------------------------------------------------- Setup . sysuse auto, clear

Create variables containing fractional polynomial powers of -2 and -1 of mpg without scaling . fracgen mpg -2 -1 if foreign==1, noscaling replace ---------------------------------------------------------------------------

Stored results

In addition to what regression_cmd stores, fracpoly stores the following in e():

Scalars e(fp_N) number of nonmissing observations e(fp_dev) deviance for FP model of degree m e(fp_df) FP model degrees of freedom e(fp_d0) deviance for model without xvar_1 e(fp_s0) residual SD for model without xvar_1 e(fp_dlin) deviance for model linear in xvar_1 e(fp_slin) residual SD model linear in xvar_1 e(fp_d1), e(fp_d2), ... deviances for FP models of degree 1,2,...,m e(fp_s1), e(fp_s2), ... residual SDs for FP models of degree 1,2,...,m

Macros e(fp_cmd) fracpoly e(cmdline) command as typed e(fp_depv) yvar1 (yvar2) e(fp_rhs) xvar_1 e(fp_base) variables in xvar_2, ..., xvarlist after centering and FP transformation e(fp_xp) Ixvar__1, Ixvar__2, etc. e(fp_fvl) variables in model finally estimated e(fp_wgt) weight type or "" e(fp_wexp) weight expression if `e(fp_wgt)' !="" e(fp_pwrs) powers for FP model of degree m e(fp_x1), e(fp_x2), ... xvar_1 and variables in model e(fp_k1), e(fp_k2), ... powers for FP models of degree 1,2,...,m

Residual SDs are stored only when regression_cmd is regress.


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index