intervals.nnr {assist}R Documentation

Calculate Predictions and Approximate Posterior Standard Deviations for Spline Estimates From a nnr Object


Approximate posterior standard deviations are calculated for the spline estimate of nonparametric functions from a nnr object, based on which approximate Bayesian confidence intervals may be constructed.


## S3 method for class 'nnr'
intervals(object,level=0.95, newdata=NULL, terms, pstd=TRUE, ...)



an object inheriting from class nnr, representing a nonlinear nonparametric regression model fit.


a data frame on which the fitted spline estimates are to be evaluated. Only those predictors, referred in func of nnr fitting, have to be present. The variable names of the data frame should correspond to the function(s)' arguments appearing in the opion func= of nnr. Default is NULL, where predictions are made at the same values used to fit the object.


an optional named list of vectors or matrices containing 0's and 1's collecting one or several combinations of the components of spline estimates in the fitted snr object. The length and names of the list shall match those of the unknown functions appearing in the 'snr' fit object. For the case of a single function, a vector of 0's and 1's can also be accepted. A value "1" at a particular position means that the component at that position is collected. Default is a vector of 1's, representing the overall fits of all unknown functions.


an optional logic value. If TRUE (the default), the posterior standard deviations are calculated. Orelse, only the predictions are calculated. Computation required for posterior standard deviations could be intensive.


a numeric value set as 0.95.


other arguments, currently unused.


The standard deviation returned is based on approximate Bayesian confidence intervals as formulated in Ke and Wang (2002).


an object of class bCI is returned, which is a list of length 2. Its first element is a matrix which contains predictions for combinations specified by terms, and second element is a matrix which contains corresponding posterior standard deviations.


Chunlei Ke and Yuedong Wang


Ke, C. and Wang, Y. (2002). Nonlinear Nonparametric Regression Models. Submitted.

See Also

nnr, plot.bCI


## Not run: 
## fit a generalized varying coefficient models
Arosa$csmonth <- (Arosa$month-0.5)/12
Arosa$csyear <- (Arosa$year-1)/45 <- nnr(thick~f1(csyear)+exp(f2(csyear))*f3(csmonth),
        func=list(f1(x)~list(~I(x-.5),cubic(x)), f2(x)~list(~I(x-.5)-1,cubic(x)),
        data=Arosa[Arosa$year%%2==1,], spar="m", start=list(f1=mean(thick),f2=0,f3=sin(csmonth)),

x <- seq(0,1,len=50)
u <- seq(0,1,len=50)

## calculate Bayesian confidence limits for all components of all functions <- intervals(, newdata=list(csyear=x,csmonth=u),
plot(, x.val=x)

## End(Not run)

[Package assist version 3.1.9 Index]