
R : Copyright 2002, The R Development Core Team
Version 1.5.1  (2002-06-17)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.

R is a collaborative project with many contributors.
Type `contributors()' for more information.

Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.

> invisible(options(echo = TRUE))
> set.seed(102941)
> 
> nobs <- 500
> sdv <- 1.0
> 
> x <- seq(-1,1,length=nobs)
> f <- 6*x^3 + 1.5*sin(11*x)*exp(-x^2*6)
> f <- 1.4*f
> 
> out <- cbind(x,f)
> write(t(out),file="bv_tru.dat",ncol=ncol(out))
> 
> e <- rnorm(n=nobs,mean=0.0,sd=sdv)
> y <- f + e
> out <- cbind(x,y)
> write(t(out),file="bv_lrn.dat",ncol=ncol(out))
> 
> e <- rnorm(n=nobs,mean=0.0,sd=sdv)
> y <- f + e
> out <- cbind(x,y)
> write(t(out),file="bv_val.dat",ncol=ncol(out))
> 
> lrn <- read.table("bv_lrn.dat",
+          header=F,colClasses="numeric",col.names=c("x","y"))
> val <- read.table("bv_val.dat",
+          header=F,colClasses="numeric",col.names=c("x","y"))
> tru <- read.table("bv_tru.dat",
+          header=F,colClasses="numeric",col.names=c("x","f"))
> 
> x <- lrn$x
> y <- lrn$y
> f <- tru$f
> e <- y - f
> 
> source("psopts.r")
> 
> postscript(file="bv_lrn.eps")
> 
> plot(x=x,y=y,type="n",xlab="feature",ylab="target")
> points(x=x,y=y,pch="o",cex=0.5)
> 
> dev.off()
null device 
          1 
> 
> postscript(file="bv_tru.eps")
> 
> plot(x=x,y=y,type="n",xlab="feature",ylab="target")
> points(x=x,y=y,pch="o",cex=0.5)
> lines(x=x,y=f,type="l",lty="solid",col="blue",lwd=2)
> 
> dev.off()
null device 
          1 
> proc.time()
[1] 1.24 0.11 1.46 0.00 0.00
> 
