Dear,
I have tried to use cubic splines in Stata, with graphing options. I am afraid I don’t really understand them.
What is the difference between the xblc and xbrcspline commands? How do I use them? Are the use different in linear and logistic regression?
Anna
Code and output:
*Make splines.
mkspline CO2_s = CO2_Total_round, cubic nknots(4) displayknots
*Linear regression.
regress D3_vit CO2_s*
levelsof CO2_Total_round, local(levels)
xblc CO2_s*, ///
covname(CO2_Total_round) at(`r(levels)') reference(5.9) eform line ///
ytitle("Vitamin D nmol/L")xtitle("CO2-eq") ///
xlabel(0(2)25) xscale(range(0 25)) ylabel(0 100) yscale(range(0 100))

*Logistic regression (which percentage are deficient).
logit Serum_vitD_belowREF CO2_s*
levelsof CO2_Total_round, local(levels)
xblc CO2_s*, ///
covname(CO2_Total_round) at(`r(levels)') reference(5.9) eform line ///
ytitle("Vitamin D deficiency")xtitle("CO2-eq") ///
xlabel(0(2)25) xscale(range(0 25)) ylabel(0 100) yscale(range(0 100))

I have tried to use cubic splines in Stata, with graphing options. I am afraid I don’t really understand them.
What is the difference between the xblc and xbrcspline commands? How do I use them? Are the use different in linear and logistic regression?
Anna
Code and output:
*Make splines.
mkspline CO2_s = CO2_Total_round, cubic nknots(4) displayknots
*Linear regression.
regress D3_vit CO2_s*
levelsof CO2_Total_round, local(levels)
xblc CO2_s*, ///
covname(CO2_Total_round) at(`r(levels)') reference(5.9) eform line ///
ytitle("Vitamin D nmol/L")xtitle("CO2-eq") ///
xlabel(0(2)25) xscale(range(0 25)) ylabel(0 100) yscale(range(0 100))
*Logistic regression (which percentage are deficient).
logit Serum_vitD_belowREF CO2_s*
levelsof CO2_Total_round, local(levels)
xblc CO2_s*, ///
covname(CO2_Total_round) at(`r(levels)') reference(5.9) eform line ///
ytitle("Vitamin D deficiency")xtitle("CO2-eq") ///
xlabel(0(2)25) xscale(range(0 25)) ylabel(0 100) yscale(range(0 100))
