vis.pfr(object, select = 1, xval = NULL, tval = NULL, deriv2 = FALSE,
theta = 50, plot.type = "persp", ticktype = "detailed", ...)
pfr
object, produced by pfr
object$smooth
). Not needed if only one
multivariate term is present.xval
is specified.TRUE
, plot the estimated second derivative surface along with
Bayesian confidence bands. Only implemented for the "slices" plot from either xval
or
tval
being specifiedpersp
plot.type="persp"
. Defaults to "detailed"
vis.gam
, plot.gam
, pfr
, persp
,
levelplot
################# DTI Example #####################
data(DTI)
## only consider first visit and cases (since no PASAT scores for controls),
## and remove missing data
DTI <- DTI[DTI$visit==1 & DTI$case==1 & complete.cases(DTI$cca),]
## Fit the PFR using FA measurements along corpus
## callosum as functional predictor with PASAT as response
## using 8 cubic B-splines for each marginal bases with
## third order marginal difference penalties.
## Specifying gamma>1 enforces more smoothing when using GCV
## to choose smoothing parameters
fit <- pfr(pasat ~ af(cca, basistype="te", k=c(8,8), m=list(c(2,3),c(2,3)), bs="ps"),
method="GCV.Cp", gamma=1.2, data=DTI)
## contour plot of the fitted surface
vis.pfr(fit, plot.type='contour')
## similar to Figure 5 from McLean et al.
## Bands seem too conservative in some cases
xval <- runif(1, min(fit$pfr$ft[[1]]$Xrange), max(fit$pfr$ft[[1]]$Xrange))
tval <- runif(1, min(fit$pfr$ft[[1]]$xind), max(fit$pfr$ft[[1]]$xind))
par(mfrow=c(2, 2))
vis.pfr(fit, deriv2=FALSE, xval=xval)
vis.pfr(fit, deriv2=FALSE, tval=tval)
vis.pfr(fit, deriv2=TRUE, xval=xval)
vis.pfr(fit, deriv2=TRUE, tval=tval)
Run the code above in your browser using DataLab