## ---------------------------------------------------------------------------- ## R scripts for Haerdle/Mueller/Sperlich/Werwatz: "Nonparametric and ## Semiparametric Modelling", Springer Series in Statistics, 2004 ## ---------------------------------------------------------------------------- ## Script SPMkernelregression ## ---------------------------------------------------------------------------- ## Description computes the regression of food on net-income ## for the UK 1976 expenditure data. ## ---------------------------------------------------------------------------- ## Author Marlene Mueller, 2008/11/21 ## ---------------------------------------------------------------------------- x <- read.csv2("D:\\fes76.txt", dec=".") x <- x[,c("NIC","FOO")] x <- x[order(x$NIC),] plot(x,col="lightblue",pch=20,main="Engel Curve") library(KernSmooth) mh <- locpoly(x$NIC,x$FOO,degree=0,kernel="normal",bandwidth=10) lines(mh)