Skip to content
Prev 307207 / 398506 Next

svyhist

Hi Anthony,

The ylim () has been added to the code (please see below), and I got 4 plots that have the same y -dimension. 

Each plot displays 2 distributions - one as histogram from the data and another one as line (i.e., idealized theoretical normal distribution?).  

My question is, "Is there way to change the distribution in the line () function and try other theoretical distribution to approximate the observed distribution?"


Thanks,

Pradip Muhuri


########################################

MyBreaks <- c(18,35,45,55,65,75,85,95)

png("svyhist_no_spd_age_at_inteview.png")
options( survey.lonely.psu = "adjust" )
svyhist (~age_p,
         subset (nhis, xspd2=='No SPD'), breaks=MyBreaks,
         ylim = c(0,0.035),
         main= " ",
         col="grey80", xlab="Age at Interview among those Who had no SPD"
         )

lines (svysmooth(~dthage, bandwidth=5,subset(nhis, xspd2=='No SPD')), lwd=2)

dev.off ()