Here I am interested in the relationship between physical activity and BMI in a large sample. I am interested in non-linear associations (realise not too non-linear in this instance, but thinking moreso about application) so trying to unpick this relationship more using a restricted cubic spline (i.e. fractional polynomial). I started off using mkspline, adjustrcspline, mfxrcspline - but decided that uvrs fracplot would be more useful and flexible here, so that is the focus.
1) One thing I find odd when plotting spline (with added scatter of outcome/exposure relationship) is that even though all data are above zero, the plot won't let me adjust the y-scale from say 0-80 - it wants to leave a big chunk of empty space from -50 to zero. This is the case even if adding code to make sure any non-existent BMI data <0 (see below code in red) are removed. Just wondered if anyone knew why this was and how to fix scaling issue?
2) In your mind, is the below plot with predicted spline and scatter somewhat deceptive at present, in that may appear to show a spline of 'line of best fit' of scatter data, when that is not really the case per se (i.e. is an adjusted predicted spline)? My sense was this was a transparent way to show the spline and underlying data relationship it was based on, but perhaps I have misinterpreted its meaning? Perhaps a histogram underneath is better, or no scatter at all? My plan down the track would be to trim to spline plot at 1st and 99th percentile, for clarity.
3) If one was interested in pulling out the specific spline curve data (beta coefficients?) and their 95% CI's at specific points along the x-axis (e.g. 10, 30, 60 total PA) is there a good way to do this coding-wise? I couldn't figure that out. Does it require generation of a spline variable?
Code:
clear all use "$data\analysis.dta", clear global cov2 age_acc i.sex i.Ethnicity whitecell_count xi: uvrs regress BMI_acc overall_daily_activity $cov2, df(5) degree(3) //4 knots fracplot overall_daily_activity, msymbol(none) ytitle("Partial adjusted linear predictor for BMI_acc") title("") subtitle("Cubic spline regression, 4 equally spaced knots") /// addplot(scatter BMI_acc overall_daily_activity /*if BMI_acc >=0*/, below msymbol(oh) msize(small) mcolor(%40)) scheme(plottigblind) /// xlabel(0 (10) 150) yscale(range(0 100)) Is it possible to pull out beta's and 95% CI's from this plot at specific points on x-scale (exposure) - e.g. at 10, 30, 60 total PA? A part of me wonders whether this would actually be meaninful?
Patrick
Array
0 Response to Restricted cubic splines (uvrs fracplot) - plotting scale issues and how to pull out specific data points on spline?
Post a Comment