--- title: 'Semiparametric regression: local methods, bootstrap' output: html_document: default pdf_document: default date: "2023-10-28" --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` # Data ```{r dati} d=read.table("lidar.dat",header=TRUE) names(d)=c("x","y") d=d[sort.list(d$x),] d$x=(d$x-min(d$x))/(max(d$x)-min(d$x)) ``` ```{r simulated data} n=200 x=sort(runif(n,0,1)) x=seq(0,1,length=n) truef=function(x) sin(2*pi*x) my=truef(x) signaltonoise=2 simula=function(signalnoise=signaltonoise){ y=rnorm(n,my,sd=sd(my)/signalnoise) return(data.frame(x=x,y=y,truef=my)) } d=simula() plot(d$x,d$y) ``` # The smoothers ```{r smoothers definitions} runmean0=function(x,xx,yy,h) mean(yy[abs(xx-x)