Example: bachelor of science

Using and interpreting restricted cubic splines - Maarten Buis

IntroductionSplinesInterpreting the resultsUsing and interpreting restricted cubic splinesMaarten L. BuisInstitut f r SoziologieEberhard Karls Universit t T L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsOutlineIntroductionSplinesInterpr eting the resultsMaarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsThe default is linearIA large part of daily statistical practice consists ofestimating the relationship between two or more default is often to assume the relationships are assumption is (almost) always wrongbut is still a verygood thing:IThe aim of a model is to simplify the situation such thatmere mortals can understand the patterns present in that a relationship is linear is a very natural anduseful talk deals with the rare situation where we want toconsider non-linear could for example occur because:Ithe relationship is too non-linear to be meaningfullysummarized by a linear relationship, orIwe are substantively interested in the L.

Introduction Splines Interpreting the results The default is linear I A large part of daily statistical practice consists of estimating the relationship between two or more variables. I The default is often to assume the relationships are linear. I This assumption is (almost) always wrong but is still a very

Tags:

  Using, Restricted, Interpreting, Cubic, Spline, Using and interpreting restricted cubic splines, Splines interpreting

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Using and interpreting restricted cubic splines - Maarten Buis

1 IntroductionSplinesInterpreting the resultsUsing and interpreting restricted cubic splinesMaarten L. BuisInstitut f r SoziologieEberhard Karls Universit t T L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsOutlineIntroductionSplinesInterpr eting the resultsMaarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsThe default is linearIA large part of daily statistical practice consists ofestimating the relationship between two or more default is often to assume the relationships are assumption is (almost) always wrongbut is still a verygood thing:IThe aim of a model is to simplify the situation such thatmere mortals can understand the patterns present in that a relationship is linear is a very natural anduseful talk deals with the rare situation where we want toconsider non-linear could for example occur because:Ithe relationship is too non-linear to be meaningfullysummarized by a linear relationship, orIwe are substantively interested in the L.

2 BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsThe default is linearIA large part of daily statistical practice consists ofestimating the relationship between two or more default is often to assume the relationships are assumption is (almost) always wrongbut is still a verygood thing:IThe aim of a model is to simplify the situation such thatmere mortals can understand the patterns present in that a relationship is linear is a very natural anduseful talk deals with the rare situation where we want toconsider non-linear could for example occur because:Ithe relationship is too non-linear to be meaningfullysummarized by a linear relationship, orIwe are substantively interested in the L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsThe default is linearIA large part of daily statistical practice consists ofestimating the relationship between two or more default is often to assume the relationships are assumption is (almost) always wrongbut is still a verygood thing:IThe aim of a model is to simplify the situation such thatmere mortals can understand the patterns present in that a relationship is linear is a very natural anduseful talk deals with the rare situation where we want toconsider non-linear could for example occur because:Ithe relationship is too non-linear to be meaningfullysummarized by a linear relationship, orIwe are substantively interested in the L.

3 BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsThe default is linearIA large part of daily statistical practice consists ofestimating the relationship between two or more default is often to assume the relationships are assumption is (almost) always wrongbut is still a verygood thing:IThe aim of a model is to simplify the situation such thatmere mortals can understand the patterns present in that a relationship is linear is a very natural anduseful talk deals with the rare situation where we want toconsider non-linear could for example occur because:Ithe relationship is too non-linear to be meaningfullysummarized by a linear relationship, orIwe are substantively interested in the L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsThe default is linearIA large part of daily statistical practice consists ofestimating the relationship between two or more default is often to assume the relationships are assumption is (almost) always wrongbut is still a verygood thing:IThe aim of a model is to simplify the situation such thatmere mortals can understand the patterns present in that a relationship is linear is a very natural anduseful talk deals with the rare situation where we want toconsider non-linear could for example occur because:Ithe relationship is too non-linear to be meaningfullysummarized by a linear relationship, orIwe are substantively interested in the L.

4 BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsThe default is linearIA large part of daily statistical practice consists ofestimating the relationship between two or more default is often to assume the relationships are assumption is (almost) always wrongbut is still a verygood thing:IThe aim of a model is to simplify the situation such thatmere mortals can understand the patterns present in that a relationship is linear is a very natural anduseful talk deals with the rare situation where we want toconsider non-linear could for example occur because:Ithe relationship is too non-linear to be meaningfullysummarized by a linear relationship, orIwe are substantively interested in the L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsThe default is linearIA large part of daily statistical practice consists ofestimating the relationship between two or more default is often to assume the relationships are assumption is (almost) always wrongbut is still a verygood thing:IThe aim of a model is to simplify the situation such thatmere mortals can understand the patterns present in that a relationship is linear is a very natural anduseful talk deals with the rare situation where we want toconsider non-linear could for example occur because:Ithe relationship is too non-linear to be meaningfullysummarized by a linear relationship, orIwe are substantively interested in the L.

5 BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsThe default is linearIA large part of daily statistical practice consists ofestimating the relationship between two or more default is often to assume the relationships are assumption is (almost) always wrongbut is still a verygood thing:IThe aim of a model is to simplify the situation such thatmere mortals can understand the patterns present in that a relationship is linear is a very natural anduseful talk deals with the rare situation where we want toconsider non-linear could for example occur because:Ithe relationship is too non-linear to be meaningfullysummarized by a linear relationship, orIwe are substantively interested in the L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsOutlineIntroductionSplinesInterpr eting the resultsMaarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsA linear association05101510203040 Mileage (mpg)price in 1000 dollarsFitted valuesMaarten L.

6 BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsHow did I do that?. sysuse auto, clear(1978 Automobile Data). replace price = price / 1000price was int now float(74 real changes made). label variable price "price in 1000 dollars".. reg price mpgSourceSS df MS Number of obs = 74F( 1, 72) = 1 Prob > F = 72 R-squared = R-squared = 73 Root MSE = Std. Err. t P>|t| [95% Conf. Interval] .0530767 predict y_lin(option xb assumed; fitted values). twoway scatter price mpg || ///> line y_lin mpg, ///> sort clstyle(solid) Maarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsA linear spline05101510203040 Mileage (mpg)price in 1000 dollarsFitted valuesMaarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsHow did I do that?

7 Mkspline linsp_mpg1 18 linsp_mpg2= mpg. reg price linsp*SourceSS df MS Number of obs = 74F( 2, 71) = 2 Prob > F = 71 R-squared = R-squared = 73 Root MSE = Std. Err. t P>|t| [95% Conf. Interval] .1888701 .0568009 . test linsp_mpg1 = linsp_mpg2( 1) linsp_mpg1 - linsp_mpg2 = 0F( 1, 71) = > F = predict y_linsp(option xb assumed; fitted values). twoway scatter price mpg || line y_linsp mpg, sort clstyle(solid) Maarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsA cubic spline05101510203040 Mileage (mpg)price in 1000 dollarsFitted valuesMaarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsHow did I do that?. mkspline cubsp_mpg1 18 cubsp_mpg2 = mpg, marginal. foreach var of varlist cubsp*{2.}

8 Qui replace`var =`var ^33. }. gen cubsp_sq = mpg^2. gen cubsp_lin = mpg. reg price cubsp*SourceSS df MS Number of obs = 74F( 4, 69) = 4 Prob > F = 69 R-squared = R-squared = 73 Root MSE = Std. Err. t P>|t| [95% Conf. Interval] .0136154 ..0143188 ..7142946 predict y_cubsp(option xb assumed; fitted values). twoway scatter price mpg || line y_cubsp mpg, sort clstyle(solid) Maarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsA restricted cubic spline051015E(price)10203040 Mileage (mpg) Maarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsHow did I do that?. mkspline2 rc = mpg, cubic knots(15 20 25). reg price rc*SourceSS df MS Number of obs = 74F( 2, 71) = 2 Prob > F = 71 R-squared = R-squared = 73 Root MSE = Std.

9 Err. t P>|t| [95% Conf. Interval] .151159 .1344838 .3109781 . adjustrcspline , noci addplot(scatter price mpg, msymbol(Oh)) Maarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsOutlineIntroductionSplinesInterpr eting the resultsMaarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsThepostrcsplinepackageIAvailable from SSCI consists of three programs:mkspline2 The same asmksplineexcept that itleaves information behind that can beused by the other the adjusted marginal L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsAdjusted predictionsIShow the predicted outcome against the spline if we have other covariates?IPredicted outcome for an observation with typical valueson the other covariates. reg price rc*rep78 foreignSourceSS df MS Number of obs = 69F( 4, 64) = 4 Prob > F = 64 R-squared = R-squared = 68 Root MSE = Std.

10 Err. t P>|t| [95% Conf. Interval] .1627389 .1444228 .2548693 ..379311 ..8049689 adjustrcspline, at(foreign=0) Maarten L. BuisUsing and interpreting restricted cubic splinesIntroductionSplinesInterpreting the resultsAdjusted predictionsIShow the predicted outcome against the spline if we have other covariates?IPredicted outcome for an observation with typical valueson the other covariates. reg price rc*rep78 foreignSourceSS df MS Number of obs = 69F( 4, 64) = 4 Prob > F = 64 R-squared = R-squared = 68 Root MSE = Std. Err. t P>|t| [95% Conf. Interval] .1627389 .1444228 .2548693 ..379311 ..8049689 adjustrcspline, at(foreign=0) Maarten L.