Learn R Programming

ibr (version 1.3.1)

ibr: Iterative bias reduction smoothing

Description

Performs iterative bias reduction using kernel or thin plate splines. In the latter case, the order m is chosen as the first integer such that 2m/d>1, where d is the number of explanatory variables. Missing values are not allowed.

Usage

ibr(x, y, criterion="gcv", df=1.5, Kmin=1, Kmax=1e+05, smoother="k",
 kernel="g", control.par=list(), cv.options=list())

Arguments

Value

Returns an object of class ibr which is a list including:betaVector of coefficients.residualsVector of residuals.fittedVector of fitted values.iterThe number of iterations used.initialdfThe initial effective degree of freedom of the pilot (or base) smoother.finaldfThe effective degree of freedom of the iterated bias reduction smoother at the iter iterations.bandwidthVector of bandwith for each explanatory variablecallA list containing four components: x contains the initial explanatory variables, y contains the initial dependant variables, criterion contains the chosen criterion, kernel the kernel, p the number of explanatory variables and m the order of the splines (if relevant).criteriaeither a list containing all the criteria evaluated on the grid Kmin:Kmax (along with the effective degree of freedom of the smoother and the sigma squared on this grid) if an exhaustive search is chosen (see the value of function iterchoiceAe or iterchoiceS1e) or the value of the chosen criterion at the given iteration if a non exhaustive search is chosen (see exhaustive). If the number of iterations iter is given by the user NULL is returned

References

Cornillon, P. A., Hengartner, N. and Matzner-Lober, E. (2009) Recursive Bias Estimation for high dimensional regression smoothers. submitted.

See Also

predict.ibr, summary.ibr

Examples

Run this code
f <- function(x, y) { .75*exp(-((9*x-2)^2 + (9*y-2)^2)/4) +
                      .75*exp(-((9*x+1)^2/49 + (9*y+1)^2/10)) +
                      .50*exp(-((9*x-7)^2 + (9*y-3)^2)/4) -
                      .20*exp(-((9*x-4)^2 + (9*y-7)^2)) }
# define a (fine) x-y grid and calculate the function values on the grid
ngrid <- 50; xf <- seq(0,1, length=ngrid+2)[-c(1,ngrid+2)]
yf <- xf ; zf <- outer(xf, yf, f)
grid <- cbind(rep(xf, ngrid), rep(xf, rep(ngrid, ngrid)))
persp(xf, yf, zf, theta=130, phi=20, expand=0.45,main="True Function")
#generate a data set with function f and noise to signal ratio 5
noise <- .2 ; N <- 100 
xr <- seq(0.05,0.95,by=0.1) ; yr <- xr ; zr <- outer(xr,yr,f) ; set.seed(25)
std <- sqrt(noise*var(as.vector(zr))) ; noise <- rnorm(length(zr),0,std)
Z <- zr + matrix(noise,sqrt(N),sqrt(N))
# transpose the data to a column format 
xc <- rep(xr, sqrt(N)) ; yc <- rep(yr, rep(sqrt(N),sqrt(N)))
X <- cbind(xc, yc) ; Zc <- as.vector(Z)
# fit by thin plate splines (of order 2) ibr
res.ibr <- ibr(X,Zc,df=1.1,smoother="tps")
fit <- matrix(predict(res.ibr,grid),ngrid,ngrid)
persp(xf, yf, fit ,theta=130,phi=20,expand=0.45,main="Fit",zlab="fit")

data(ozone, package = "ibr")
res.ibr <- ibr(ozone[,-1],ozone[,1],df=1.1)
summary(res.ibr)
predict(res.ibr)

Run the code above in your browser using DataLab