**************** **************** ** mkspline ** Using linear splines **************** **************** Overview: The "mkspline" command creates a collection of variables that permit a so-called piecewise linear model. Such a model assumes that the regression is linear between specified points, and that the regression is connected at these points. For example, in the framingham data I analyze BMI (body mass index) and wanted to see if a linear relationship is adequate. I wanted to let the model look something like: | | O | * * | * * | O * | * logit(p) | * | * | * | * |* |------|---------|----------- 24 28 BMI where the risk (logit) increases linearly over each range but the slope over each range may be different. Usage: "mkspline bmiS1 24 bmiS2 28 bmiS3 = bmi" "logistic chd bmiS1-3" Note that the useage of the "mkspline" command requires that you name the variable in each interval, and that you specify the values at which you are happy to let the function bend. In the example call above "bmiS1" is the linear term before "24", bmiS2 is the linear term between "24" and "28", and "bmiS3" is the linear term after "28". The coefficients for the logistic regression model are the slopes (changes in log odds) over the interval that the variable corresponds to. Summaries: The "mkspline" function creates the variables that you need to use this flexible linear model. The created variables can be used for any analysis. Options: (1) "mkspline bmiS1 24 bmiS2 28 bmiS3 = bmi, marginal" The "marginal" option means that the coefficients that are fit in the spline model can be interpreted as changes in slopes from the preceeding interval. This is useful for testing whether the slope is changing from one interval to the next. **************** **************** ** fracpoly ** Using fractional polynomials **************** **************** Overview: The "fracpoly" command allows use of general polynomial regression models (even using fractional powers such as sqrt(X) = X^{1/2}, and negative powers such as 1/X = X^{-1}). This allows a very flexible curve to be used for a continuous covariate. Usage: "fracpoly logistic chd bmi" "fracplot bmi" Note that the useage of "fracpoly" comes before a general regression command. Summaries: The "fracpoly" function actually uses a variable selection method to chose the powers of X that will be used. This is why the fitting procedure can be somewhat slow. When a model is determined the routine will tell you the powers of X that are used. I don't find the coefficients of these variables interesting, but the shape/form can be shown using the "fracplot bmi" command. This includes the regression model with standard error bars. Options: (1) "fracplot bmi" -- shows the fitted curve with 95% CIs.