Is it possible to fit splines in MLwiN?
Yes, it is possible to fit splines in MLwiN, but there is no special facility for doing this: it has to be done manually. • Create an indicator variable for each interval you want to fit a different polynomial to. In other words, if the cut points for your spline are 2, 7, 10, and expvar is your explanatory variable, and c20 onwards are all free columns then type in the Command interface: calc c20 = ‘expvar’ < 2 calc c21 = ('expvar' >=2) & (‘expvar’ < 7) calc c22 = ('expvar' >= 7) & (‘expvar’ < 10) calc c23 = 'expvar' >= 10 name c20 ‘int1’ name c21 ‘int2’ name c22 ‘int3’ name c23 ‘int4’ (Or you can use the Recode by range window with a new destination variable each time) • Create a new explanatory variable for each interval by multiplying ‘expvar’ by the indicator variable calc c24 = ‘expvar’ * ‘int1’ calc c25 = ‘expvar’ * ‘int2’ calc c26 = ‘expvar’ * ‘int3’ calc c27 = ‘expvar’ * ‘int4’ name c24 ‘expvar1’ name c25 ‘expvar2’ name c26 ‘expvar3’ name c27 ‘expvar4’ • Add each explanatory v