Learn R Programming

ibr (version 2.0-0)

ibr: Iterative bias reduction smoothing

Description

Performs iterative bias reduction using kernel, thin plate splines Duchon splines or low rank splines. Missing values are not allowed.

Usage

ibr(formula, data, subset, criterion="gcv", df=1.5, Kmin=1, Kmax=1e+06, smoother="k",
 kernel="g", rank=NULL, 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 variablecallThe matched callparcallA list containing several components: p contains the number of explanatory variables and m the order of the splines (if relevant), s the power of weights, scaled boolean which is TRUE when explanatory variables are scaled, mean mean of explanatory variables if scaled=TRUE, sd standard deviation of explanatory variables if scaled=TRUE, critmethod that indicates the method chosen for criteria strict, rank the rank of low rank splines if relevant, criterion the chosen criterion, smoother the chosen smoother, kernel the chosen kernel, smoothobject the smoothobject returned by smoothConcriteriaValue of the chosen criterion at the given iteration, NA is returned when aggregation of criteria is chosen (see component criterion of list control.par). If the number of iterations iter is given by the user, NULL is returnedalliterNumeric vector giving all the optimal number of iterations selected by the chosen criteria.allcriteriaeither 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 all the values of criteria at the given optimal iteration if a non exhaustive search is chosen (see also exhaustive component of list control.par).callThe matched call.termsThe 'terms' object used.

References

Cornillon, P.-A.; Hengartner, N.; Jegou, N. and Matzner-Lober, E. (2012) Iterative bias reduction: a comparative study. Statistics and Computing, 23, 777-791.

Cornillon, P.-A.; Hengartner, N. and Matzner-Lober, E. (2013) Recursive bias estimation for multivariate regression smoothers Recursive bias estimation for multivariate regression smoothers. ESAIM: Probability and Statistics, 18, 483-502.

Wood, S.N. (2003) Thin plate regression splines. J. R. Statist. Soc. B, 65, 95-114.

See Also

predict.ibr, summary.ibr, gam

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.data.frame(x=rep(xf, ngrid),y=rep(xf, rep(ngrid, ngrid)),z=as.vector(zf))
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)))
data <- cbind.data.frame(x=xc,y=yc,z=as.vector(Z))
# fit by thin plate splines (of order 2) ibr
res.ibr <- ibr(z~x+y,data=data,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~.,data=ozone,df=1.1)
summary(res.ibr)
predict(res.ibr)

Run the code above in your browser using DataLab