Using normalden function in Stata

Below is a worked example of using the normalden function:


Please copy and paste the below commands in your do-file:

clear
set obs 100

generate x1 = rnormal(0,1)
generate x2 = rnormal(0.5,1.3)

summarize x1
local M1 = r(mean)
local SD1 = r(sd)

summarize x2
local M2 = r(mean)
local SD2 = r(sd)

twoway function x1 = normalden(x, `M1', `SD1') , range(-4 4) || ///
function x2 = normalden(x, `M2', `SD2'), range(-4 5)

For more information on Stata graphs, please have a look at the book A Visual Guide to Stata Graphics, 3rd Edition

3 views

© 2020 by Survey Design and Analysis Services. 

  • LinkedIn
  • Facebook
  • Twitter
  • YouTube