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?
How to find the value of a variable using condition on another variable?Hi Statalist users, I have a dataset of which I am posting a snippet with relevant variables (age, …
considering inter eyes correlation in spearman analysis(mixed model)Hi I am working on retinal thickness of 68 eyes measured by 2 devices. I calculated the spearman co…
Negative values for categorical variable.Hello, I have been using R but started learning STATA recently. To briefly introduce what I have be…
How to avoid duplication in observations for variables that exist in multiple waves of panel dataHi Statalist. Using panel dataset with five waves, I group couples into a number of religious categ…
Lag independent variable in fixed effects regression using repeated cross section dataHello Statalist, I'm currently analyzing repeated cross-section data (different individuals were su…
Subscribe to:
Post Comments (Atom)
0 Response to Help!How could I draw a restricted cubic spline using linear regression?
Post a Comment