{"id":1116,"date":"2022-07-11T14:39:47","date_gmt":"2022-07-11T18:39:47","guid":{"rendered":"https:\/\/blog.uvm.edu\/tbplante\/?p=1116"},"modified":"2024-07-16T16:11:54","modified_gmt":"2024-07-16T20:11:54","slug":"part-6-visualizing-your-continuous-exposure-at-baseline","status":"publish","type":"post","link":"https:\/\/blog.uvm.edu\/tbplante\/2022\/07\/11\/part-6-visualizing-your-continuous-exposure-at-baseline\/","title":{"rendered":"Part 6: Visualizing your continuous exposure at baseline"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Visualization of your continuous exposure in an observational epidemiology research project<\/h2>\n\n\n\n<p>As we saw in <a href=\"https:\/\/blog.uvm.edu\/tbplante\/2022\/07\/05\/part-5-baseline-characteristics-in-a-table-1\/\" target=\"_blank\" rel=\"noreferrer noopener\">Part 5<\/a>, it&#8217;s important to describe the characteristics of your baseline population by your exposure. This helps readers get a better understanding of internal validity. <strong><em>For folks completing analyses with binary exposures, part 6 isn&#8217;t for you<\/em><\/strong>. If your analysis includes continuous exposures or ordinal exposures with at least a handful of options, read on.<\/p>\n\n\n\n<p>I think it&#8217;s vitally important to visualize your exposure before moving any further forward with your analyses. There are a few reasons that I do this:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Understand the distribution of your exposure<\/strong>. Looking at the raw spread of your data will help you understand if it has a relatively normal distribution, if it&#8217;s skewed, if it is multimodal (eg, has several peaks), or if it&#8217;s just plain old weird looking. If your exposure is non-normally distributed, then you&#8217;ll need to consider the implications of the spread in your analysis. This may mean log-transforming, square root-transforming (if you have lots of zeros in your exposure&#8217;s values), or some other sort of transformation.\n<ul class=\"wp-block-list\">\n<li><em>Note<\/em>: make sure to visualize your transformed exposure value!<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Look for patterns that need exploring<\/strong>. You might notice a huge peak at a value of &#8220;999&#8221;. This might represent missing values, which will need to be recoded. You might notice that values towards the end of the tails of the bell curve might spike up at a particular value. This might represent values that were really above or below the lower limit of detection. You&#8217;ll need to think about how to handle such values, possibly recoding them following the NHANES approach as the <a href=\"https:\/\/www.ncbi.nlm.nih.gov\/pmc\/articles\/PMC5709716\/\" target=\"_blank\" rel=\"noreferrer noopener\">limit of detection divided by the square root of 2<\/a>. <\/li>\n\n\n\n<li><strong>Understand the distribution of your exposure by key subgroups<\/strong>. In REGARDS, our analyses commonly focus on racial differences in CVD events. Because of this, I commonly visualize exposures with overlaid histograms for Black and White participants, and see how these exposure variables differ by race. This could easily be done for other sociodemgraphics (notably, by sex), anthropometrics, and disease states. <\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Ways to depict your continuous exposure<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Stem and leaf plots<\/li>\n\n\n\n<li>Histograms<\/li>\n\n\n\n<li>Kernel density plots<\/li>\n\n\n\n<li>Boxplots<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">1. Stem and leaf plots<\/h2>\n\n\n\n<p>Stem and leaf plots are handy for quickly visualizing distributions since the output happens essentially instantaneously, whereas other figures (e.g., histograms) take a second or two to render. Stem and leaf plots are basically sideways histograms using numbers. The Stata command is &#8211;stem&#8211;. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>* load the sysuse auto dataset and clear all data in memory\nsysuse auto, clear\n* now render a stem and leaf plot of weight\nstem weight<\/code><\/pre>\n\n\n\n<p>Here&#8217;s what you get in Stata&#8217;s output window. You&#8217;ll see a 2 digit number (eg &#8220;17**&#8221;) followed by a vertical bar then another 2 digit number (eg &#8220;60&#8221;). That means that 1 person has a value of 1760. If there are multiple numbers after the bar, then that means that there are more than 1 number in that group. For example, the &#8220;22**&#8221; stem has &#8220;00&#8221;, &#8220;00&#8221;, &#8220;30&#8221;, &#8220;40&#8221;, and &#8220;80&#8221; leaves, meaning that there is 2200, 2200, 2230, and 2280 as values in this dataset.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Stem-and-leaf plot for weight (Weight (lbs.))\n\n  17** | 60\n  18** | 00,00,30\n  19** | 30,80,90\n  20** | 20,40,50,70\n  21** | 10,20,30,60\n  22** | 00,00,30,40,80\n  23** | 70\n  24** | 10\n  25** | 20,80\n  26** | 40,50,50,70,90\n  27** | 30,50,50\n  28** | 30,30\n  29** | 30\n  30** | \n  31** | 70,80\n  32** | 00,10,20,50,60,80\n  33** | 00,10,30,50,70,70\n  34** | 00,20,20,30,70\n  35** | \n  36** | 00,00,70,90,90\n  37** | 00,20,40\n  38** | 30,80\n  39** | 00\n  40** | 30,60,60,80\n  41** | 30\n  42** | 90\n  43** | 30\n  44** | \n  45** | \n  46** | \n  47** | 20\n  48** | 40<\/code><\/pre>\n\n\n\n<p>For stems with a huge amount of values, you&#8217;ll see some other characters appear to split up the stem into multiple stems. For example, here&#8217;s the output for stem of MPG:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>. stem mpg\n\nStem-and-leaf plot for mpg (Mileage (mpg))\n\n  1t | 22\n  1f | 44444455\n  1s | 66667777\n  1. | 88888888899999999\n  2* | 00011111\n  2t | 22222333\n  2f | 444455555\n  2s | 666\n  2. | 8889\n  3* | 001\n  3t | \n  3f | 455\n  3s | \n  3. | \n  4* | 1<\/code><\/pre>\n\n\n\n<p>You&#8217;ll notice that the 10-place stem is split into 4 different stems, &#8220;1t&#8221;, &#8220;1f&#8221;, &#8220;1s&#8221;, and &#8220;1.&#8221;. I&#8217;m guessing that *=0-1, t=2-3, f=4-5, s=6-7, .=8.9. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Histograms<\/h2>\n\n\n\n<p>A conventional histogram splits continuous data into several evenly-spaced discrete groups called &#8220;bins&#8221;, and visualizes these discrete groups as a bar graph. These are commonly used but in Stata can&#8217;t be used with pweighting. See kernel density plots below for consideration of how to use pweighting. <\/p>\n\n\n\n<p>Let&#8217;s see how to do this in Stata, with some randomly generated data that approximates a normal distribution. While we&#8217;re at it, we&#8217;ll make a variable called &#8220;group&#8221; that&#8217;s 0 or 1 that we&#8217;ll use later. (Also note that this dataset doesn&#8217;t use discrete values, so I&#8217;m not specifying the discrete option in my &#8220;hist&#8221; code. If you see spaces in your histogram because you are using discrete values, add &#8220;, discrete&#8221; after your variable name in the histogram line.)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>clear all\n\/\/ set observations to be 1000:\nset obs 1000\n\/\/ set a random number seed for reproducibility: \nset seed 12345\n\/\/ make a normally-distributed variable, with mean of 5 and SD of 10:\ngen myvariable = rnormal(5,10)\n\/\/ make a 0 or 1 variable for a group, following instructions for \"generate ui\":\n\/\/ https:\/\/blog.stata.com\/2012\/07\/18\/using-statas-random-number-generators-part-1\/\ngen group = floor((1-0+1)*runiform() + 0)\n\/\/ now make a histogram\nhist myvariable<\/code><\/pre>\n\n\n\n<p>Here&#8217;s the overall histogram: <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"526\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-1.png\" alt=\"\" class=\"wp-image-1120\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-1.png 731w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-1-300x216.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/figure>\n\n\n\n<p>On the X axis you see the ranges of the values of variable of interest, from around -30 to about +40. On the Y axis you see the density plot. I want to show this same figure by group, however, and the bins are not currently transparent. You won&#8217;t be able to tell one group from another. So, in Stata, you need to use the &#8220;twoway histogram&#8221; option instead of just &#8220;histogram&#8221; and specify transparent colors of the figure using the %NUMBER notation. We&#8217;ll also add a legend. We&#8217;ll set the scheme to s1mono to get rid of the ugly default blue surrounding box as well. Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ set the scheme to s1mono:\nset scheme s1mono\n\/\/ now make your histogram:\ntwoway \/\/\/\n(hist myvariable if group==0, color(blue%30)) \/\/\/\n(hist myvariable if group==1, color(red%30)) \/\/\/\n, \/\/\/\nlegend(order(1 \"Group==0\" 2 \"Group==1\"))<\/code><\/pre>\n\n\n\n<p>Here&#8217;s what you get:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"526\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-2.png\" alt=\"\" class=\"wp-image-1121\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-2.png 731w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-2-300x216.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/figure>\n\n\n\n<p>You can modify things as needed. Something you might consider is changing the density to count or frequency, which is done by adding &#8220;frequency&#8221; or &#8220;percent&#8221; after the commas but before the colors. You might also opt to select different colors, which you can read about selection of colors in <a rel=\"noreferrer noopener\" href=\"https:\/\/onlinelibrary.wiley.com\/doi\/10.1002\/rth2.12308\" target=\"_blank\">this editorial I wrote with Mary Cushman<\/a>. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Considerations for designing histograms<\/h2>\n\n\n\n<p>One question is how many bins you want. I found this nice 2019 article by Regina L. Nuzzo, PhD (<a rel=\"noreferrer noopener\" href=\"https:\/\/onlinelibrary.wiley.com\/doi\/pdfdirect\/10.1002\/pmrj.12145\" target=\"_blank\">PDF link<\/a>, <a rel=\"noreferrer noopener\" href=\"https:\/\/pubmed.ncbi.nlm.nih.gov\/30761760\/\" target=\"_blank\">PubMed listing<\/a>) that goes over lots of considerations for the design of histograms. I specifically like the Box, which lists equations to determine number of bins and bid width. In general, if you have too many bins, your data will look choppy:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ using 100 bins here\ntwoway \/\/\/\n(hist myvariable if group==0, color(blue%30) bin(100)) \/\/\/\n(hist myvariable if group==1, color(red%30)  bin(100)) \/\/\/\n, \/\/\/\nlegend(order(1 \"Group==0\" 2 \"Group==1\"))<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"537\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-3.png\" alt=\"\" class=\"wp-image-1123\" style=\"width:731px;height:537px\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-3.png 731w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-3-300x220.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/figure>\n\n\n\n<p>And if you have too few, you won&#8217;t be able to make sense of the overall structure of the data.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ using 2 bins here\ntwoway \/\/\/\n(hist myvariable if group==0, color(blue%30) bin(2)) \/\/\/\n(hist myvariable if group==1, color(red%30)  bin(2)) \/\/\/\n, \/\/\/\nlegend(order(1 \"Group==0\" 2 \"Group==1\"))<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"527\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-4.png\" alt=\"\" class=\"wp-image-1124\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-4.png 727w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-4-300x217.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/figure>\n\n\n\n<p>Be thoughtful about how thinly you want to splice your data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What about histograms on a log scale?<\/h3>\n\n\n\n<p>You might have some sort of skewed variable that you want to show on a log scale. The easiest way to do this is to (1) make a log-transformed variable of this, and (2) make a histogram of the log-transformed variable. For part #2, you&#8217;ll want to print the labels of the original variable in their log-transformed spot, otherwise you&#8217;ll wind up with labels for the log-transformed variable, which are usually not easy to interpret. See the `=log(number)&#8217; trick below for how to drop non-log transformed labels in log-transformed spots.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ clear dataset and make skewed variable\nclear all \nset obs 1000\ngen variable = 10+ ((rbeta(2, 10))*100)\n\n\/\/ visualize non-log transformed data\ntwoway \/\/\/ \n(hist variable) \/\/\/\n, \/\/\/\nxlab(10 \"10\" 20 \"20\" 30 \"30\" 40 \"40\" 50 \"50\" 60 \"60\")\n\n\/\/ make a long-transformed variable\ngen logvariable=log(variable)\n\n\/\/ visualize non-log transformed data\n\/\/ plop the labels in the spots where the \"original\" labels should be\ntwoway \/\/\/\n(hist logvariable) \/\/\/\n, \/\/\/\nxlab(`=log(10)' \"10\" `=log(20)' \"20\" `=log(30)' \"30\" `=log(40)' \"40\" `=log(50)' \"50\" `=log(60)' \"60\")<\/code><\/pre>\n\n\n\n<p>Here&#8217;s the raw variable. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"982\" height=\"577\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image.png\" alt=\"\" class=\"wp-image-1831\" style=\"width:618px;height:auto\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image.png 982w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-300x176.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-768x451.png 768w\" sizes=\"auto, (max-width: 982px) 100vw, 982px\" \/><\/figure>\n\n\n\n<p>Here is the histogram of the log transformed variable. Notice that the 10-60 labels are printed in the correct spots with the `=log(NUMBER)&#8217; code above. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"995\" height=\"582\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-1.png\" alt=\"\" class=\"wp-image-1832\" style=\"width:637px;height:auto\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-1.png 995w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-1-300x175.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-1-768x449.png 768w\" sizes=\"auto, (max-width: 995px) 100vw, 995px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">3. Kernel density plots<\/h2>\n\n\n\n<p>Kernel density plots are similar to histograms, except it shows a smoothed line over your data&#8217;s distribution. Histograms are less likely to hide outliers since kernel density plots can smooth over outliers. The code for a kernel density plot in Stata is nearly identical to the &#8220;twoway hist&#8221; code above.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>twoway \/\/\/\n(kdensity myvariable if group==0, color(blue%30)) \/\/\/\n(kdensity myvariable if group==1, color(red%30)) \/\/\/\n, \/\/\/\nlegend(order(1 \"Group==0\" 2 \"Group==1\"))<\/code><\/pre>\n\n\n\n<p>Output: <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"521\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-5.png\" alt=\"\" class=\"wp-image-1126\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-5.png 722w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-5-300x216.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/figure>\n\n\n\n<p>You can even combine histograms and kernel density plots!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>twoway \/\/\/\n(hist myvariable if group==0, color(blue%30)) \/\/\/\n(hist myvariable if group==1, color(red%30)) \/\/\/\n(kdensity myvariable if group==0, color(blue%30)) \/\/\/\n(kdensity myvariable if group==1, color(red%30)) \/\/\/\n, \/\/\/\nlegend(order(1 \"Group==0\" 2 \"Group==1\"))<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"737\" height=\"531\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-6.png\" alt=\"\" class=\"wp-image-1127\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-6.png 737w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/07\/image-6-300x216.png 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/figure>\n\n\n\n<p>I&#8217;ve never done this myself for a manuscript, but just showing that it&#8217;s possible.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Using kdens to make kernel density plots that use pweights<\/h3>\n\n\n\n<p>You might need to make kernel density plots that use pweighting. There&#8217;s a &#8211;kdens&#8211; package that allows you to do that, which requires &#8211;moremata&#8211; to be installed. Here&#8217;s how you can make a pweighted kernel density plot with kdens.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> \/\/ only need to install once:\nssc install moremata\nssc install kdens\n\/\/ load nhanes demo code\nwebuse nhanes2f, clear\n\/\/ now svyset the data and use kdens to make a weighted plot\nsvyset psuid &#091;pw=finalwgt], strata(stratid)\ntwoway kdens weight &#091;pw=finalwgt]<\/code><\/pre>\n\n\n\n<p>And you&#8217;ll get this!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"993\" height=\"597\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-2.png\" alt=\"\" class=\"wp-image-1836\" style=\"width:566px;height:auto\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-2.png 993w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-2-300x180.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-2-768x462.png 768w\" sizes=\"auto, (max-width: 993px) 100vw, 993px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">4. Boxplots<\/h2>\n\n\n\n<p>Boxplots are handy at showing distributions of multiple groups all at once. This is a nice overview of what all of the <a href=\"https:\/\/www.simplypsychology.org\/boxplots.html\" data-type=\"link\" data-id=\"https:\/\/www.simplypsychology.org\/boxplots.html\" target=\"_blank\" rel=\"noreferrer noopener\">bits of the figure means<\/a>. Briefly, there&#8217;s a box that is the median and IQR. There are some lines sticking out that are the upper and lower adjacent lines, which are the 75th percentile + (1.5*the width of the IQR range) and 25th percentile &#8211; (1.5*the width of the IQR range). Dots outside these ranges are the outliers. <\/p>\n\n\n\n<p>Making boxplots is simple in stata using the &#8211;graph box&#8211; command. My one piece of advice is to be aware of the by() and over() commands since they can help you stitch together boxplots in interesting ways. Example code follows.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sysuse bplong, clear\n\ngraph box bp\ngraph box bp, over(sex) \ngraph box bp, by(sex) \ngraph box bp, by(agegrp) over(sex)  \ngraph box bp, by(sex) over(agegrp) \n<\/code><\/pre>\n\n\n\n<p>No subcommands<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"990\" height=\"597\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-3.png\" alt=\"\" class=\"wp-image-1837\" style=\"width:447px;height:auto\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-3.png 990w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-3-300x181.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-3-768x463.png 768w\" sizes=\"auto, (max-width: 990px) 100vw, 990px\" \/><\/figure>\n\n\n\n<p>Subcommand: , over(sex)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1011\" height=\"600\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-4.png\" alt=\"\" class=\"wp-image-1838\" style=\"width:457px;height:auto\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-4.png 1011w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-4-300x178.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-4-768x456.png 768w\" sizes=\"auto, (max-width: 1011px) 100vw, 1011px\" \/><\/figure>\n\n\n\n<p>Subcommand: , by(sex)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"992\" height=\"593\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-5.png\" alt=\"\" class=\"wp-image-1839\" style=\"width:461px;height:auto\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-5.png 992w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-5-300x179.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-5-768x459.png 768w\" sizes=\"auto, (max-width: 992px) 100vw, 992px\" \/><\/figure>\n\n\n\n<p>Subcommand: , by(agegrp) over(sex)  <\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"992\" height=\"591\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-6.png\" alt=\"\" class=\"wp-image-1840\" style=\"width:453px;height:auto\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-6.png 992w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-6-300x179.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-6-768x458.png 768w\" sizes=\"auto, (max-width: 992px) 100vw, 992px\" \/><\/figure>\n\n\n\n<p>Subcommand: , by(sex) over(agegrp) <\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"997\" height=\"597\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-7.png\" alt=\"\" class=\"wp-image-1841\" style=\"width:450px;height:auto\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-7.png 997w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-7-300x180.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2024\/07\/image-7-768x460.png 768w\" sizes=\"auto, (max-width: 997px) 100vw, 997px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Visualization of your continuous exposure in an observational epidemiology research project As we saw in Part 5, it&#8217;s important to describe the characteristics of your baseline population by your exposure. This helps readers get a better understanding of internal validity. For folks completing analyses with binary exposures, part 6 isn&#8217;t for you. If your analysis &hellip; <a href=\"https:\/\/blog.uvm.edu\/tbplante\/2022\/07\/11\/part-6-visualizing-your-continuous-exposure-at-baseline\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Part 6: Visualizing your continuous exposure at baseline<\/span><\/a><\/p>\n","protected":false},"author":4473,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[502558,678998],"tags":[703438,222041,703459,703384,703502,703501,703500,12509,579,502556,278018,703503,703504,703389],"class_list":["post-1116","post","type-post","status-publish","format-standard","hentry","category-epidemiology-and-biostatistics","category-summer-students","tag-boxplot","tag-epidemiology","tag-graph-box","tag-histogram","tag-kdens","tag-kdensity","tag-kernel-density-plot","tag-manuscript","tag-research","tag-stata","tag-statistics","tag-stem","tag-stem-and-leaf-plot","tag-visualization"],"_links":{"self":[{"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/posts\/1116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/users\/4473"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/comments?post=1116"}],"version-history":[{"count":10,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/posts\/1116\/revisions"}],"predecessor-version":[{"id":1842,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/posts\/1116\/revisions\/1842"}],"wp:attachment":[{"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/media?parent=1116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/categories?post=1116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/tags?post=1116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}