> eps<-rnorm(100,0,1/3) > x<-runif(100) > sin4x <- function(x){sin(4*x)} > y<-sin4(x)+eps > sin4 <- function(x){sin(4*x)} > sin4 <- function(x){sin(4*x)} > y<-sin4(x)+eps > plot(sin4,0,1,type="l",ylim=c(-1.0,1.5),xlim=c(0,1)) > points(x,y) > lines(ksmooth(x,y,"box",bandwidth=.2),col="blue") > lines(ksmooth(x,y,"normal",bandwidth=.2),col="green") > points(loess(y~x),pch="*") > scatter.smooth(x,y, lty=2) > plot(hr$age,hr$sbp) > scatter.smooth(hr$age,hr$sbp) > plot(hr$age,hr$sbp) > scatter.smooth(hr$age,hr$sbp,span=1/2) > scatter.smooth(hr$age,hr$sbp,span=1/3) > density(hr$sbp) Call: density.default(x = hr$sbp) Data: hr$sbp (462 obs.); Bandwidth 'bw' = 4.725 x y Min. : 86.82 Min. :2.716e-06 1st Qu.:123.16 1st Qu.:8.901e-04 Median :159.50 Median :3.245e-03 Mean :159.50 Mean :6.873e-03 3rd Qu.:195.84 3rd Qu.:1.065e-02 Max. :232.18 Max. :2.536e-02 > plot(.Last.value) > quartz() > hist(hr$sbp) > ?density > sbp.dens=density(hr$sbp) > sbp.dens$bw [1] 4.725204 > var(hr$sbp) [1] 420.099 > plot(density(hr$sbp,bw=10)) > plot(density(hr$age) + ) > hist(hr$age) > plot(density(hr$age))