# natural cubic spline with a knot at 3
basis.var <- mkbasis(1:5, knots=3)
basis.var
# quadratic spline selected by df, automatic knots location
mkbasis(1:5, type="bs", df=4, degree=2)
# linear centered at 4
mkbasis(1:5, type="lin", cenvalue=4)
# polynomial with degree 3, with intercept
mklagbasis(maxlag=5, type="poly", degree=3)
# integer
mklagbasis(maxlag=5, type="integer")
# threshold-type: double and single threshold or piecewise
mkbasis(1:5, type="dthr", knots=c(2,3))
mkbasis(1:5, type="hthr", knots=3)
mkbasis(1:5, type="hthr", knots=c(2,3))
# the intercept: strata defined by 2 cut-off points
mklagbasis(maxlag=10, type="strata", knots=c(4,7))
mklagbasis(maxlag=10, type="strata", knots=c(4,7), int=FALSE)
# centering: polynomial
mkbasis(0:10, type="poly", degree=3)
mkbasis(0:10, type="poly", degree=3, cen=FALSE)
### See the vignette 'dlnmOverview' for a detailed explanation of this example
Run the code above in your browser using DataLab