Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cubic splines, how to graph them correctly?

    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))

    Click image for larger version

Name:	Linear.jpg
Views:	1
Size:	22.4 KB
ID:	1749244


    *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))

    Click image for larger version

Name:	Logistic.jpg
Views:	1
Size:	29.1 KB
ID:	1749245

Working...
X