Make Truncated Power Base for Natural Cubic Spline [snp7: STB-22] --------------------------------------------------- ^spbase^ xvar [[^if^ exp] [^in^ range] ^, gen(^newvar^)^ [ ^n^knots^(^#^)^ ^kn^ots^(^#,...,#^)^ ] Description ----------- ^spbase^ creates a truncated power basis for a natural cubic spline in xvar. It creates one new variable for each interior knot, named newvar1, newvar2,.., where "newvar" is the name specified by ^gen^. Additionally a macro called "newvar" is created containing the name of xvar and the new variables. Options ------- ^gen(^newvar^)^ is not optional. The basis variables are stored in "newvar1",..."newvar"nk"", where "nk" is the number of interior knots. ^knots^ specifies the exact location of the interior knots. ^nknots^ specifies the number of interior knots. (Ignored if the locations are specified). Remarks ------- The natural cubic spline has knots at the ends of xvar as well at the interior sites. It is constrained to be linear beyond the the extreme knots and to be everywhere twice continuously differentiable. By default the interior knots are placed at equally spaced quantiles. The truncated power basis used is not particularly computationally stable. Example _______ spbase age, gen(age_b) logistic case $age_b treat predict fit,xb replace fit=xb-_b[treat]*treat gr fit age,s(i) c(l) sort ti("Relative risk associated with age") l1("logit") Author ------ Peter Sasieni Imperial Cancer Research Fund, London FAX 011-44-71-269-3429 Also see -------- Manual: [4] estimate STB: snp7 (STB-22) On-line: ^help^ for ^graph^, ^spline^, and ^sp_adj^