I am working on a project using linear regression and I want to draw a restricted cubic spline for regression coefficient.And I only get a OR using the following code:
svyset sdmvpsu [pw = wtmec8yr], strata( sdmvstra ) singleunit(centered)
centile lbxgly if eligible==1, centile(1,99)
drop if lbxgly <= 9.84 | lbxgly >= 213
generate lbxgly1 = round( lbxgly ) if eligible==1
_pctile lbxgly1, p(10 50 90)
return list
mkspline fibers = lbxgly1, knots(25 47 104) cubic
xi: svy: regress cell_length fibers1 fibers2 i.age i.riagendr /*
*/i.race i.edu i.income i.smoke i.drink i.diabetes i.chole i.waist
testparm fibers2
testparm fibers2 fibers1
capture drop pa or lb ub
levelsof lbxgly1, local(level)
xblc fibers1-fibers2, covname(lbxgly1) at(`r(levels)') > reference(9) eform generate(pa ors lbs ubs)
twoway (line lbs ubs ors pa , sort lc(black black black) lp(- -)) , legend(off) xlabel(0(50)320) ylabel(0.1(0.1)1.3, angle(horiz) format( %2.1fc)) ytitle("beta") xtitle("lbxgly, g/day") name(f1,replace)
Related Posts with Help!How could I draw a restricted cubic spline using linear regression?
Dependent Double-Sorting 25 Portfolios Code: * Example generated by -dataex-. To install: ssc install dataex clear input float s_id str52 …
Dropping a huge chunk of observation after making R read the data created from Stata 17I've been using Stata 17 for my research and after analyzing and cleaning I need to use R for a spec…
Rename variablesHello everyone, I would like to know renaming var as ascending order. I'd like to rename var_1, var_…
How to drop observation if it doesn't have full date rangeHi all, I am trying to remove observations of TICKER's who don't have the full date range which is …
Predict command using imputed dataHi everyone. I have used multiple imputation and I am trying to use the "predict" command but I can…
Subscribe to:
Post Comments (Atom)
0 Response to Help!How could I draw a restricted cubic spline using linear regression?
Post a Comment