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?
Saving matrices of resultsHello all, I wonder if someone could help me. I'm using this code to save the results from quantile …
keep ifHi, I want to use " keep if" to keep a subset of observations in my dataset, but I get an error: Typ…
How can we set Stata so that potential commands would pop up downward whenever we type in a string or word?Hey colleagues, Today I was asked a question by a student of my intro. stat. using Stata class. Ple…
IF statement using a local string variableI have a code that looks like the below (minimum working example). A loop that loops through 2 scena…
Making balanced panel by dropping observation based on a certain variableI want to make a balanced panel based on my ln_wage outcome variable. In my data most of data has 22…
Subscribe to:
Post Comments (Atom)
0 Response to Help!How could I draw a restricted cubic spline using linear regression?
Post a Comment