Learn R Programming

locfit (version 1.5-9.9)

plot.locfit: Plot an object of class locfit.

Description

The plot.locfit function generates grids of ploting points, followed by a call to preplot.locfit. The returned object is then passed to plot.locfit.1d, plot.locfit.2d or plot.locfit.3d as appropriate.

Usage

# S3 method for locfit
plot(x, xlim, pv, tv, m, mtv=6, band="none", tr=NULL,
  what = "coef", get.data=FALSE, f3d=(d == 2) && (length(tv) > 0), ...)

Arguments

x

locfit object.

xlim

Plotting limits. Eg. xlim=c(0,0,1,1) plots over the unit square in two dimensions. Default is bounding box of the data.

pv

Panel variables, to be varied within each panel of a plot. May be specified as a character vector, or variable numbers. There must be one or two panel variables; default is all variables in one or two dimensions; Variable 1 in three or more dimensions. May by specified using either variable numbers or names.

tv

Trellis variables, to be varied from panel to panel of the plot.

m

Controls the plot resolution (within panels, for trellis displays). Default is 100 points in one dimension; 40 points (per dimension) in two or more dimensions.

mtv

Number of points for trellis variables; default 6.

band

Type of confidence bands to add to the plot. Default is "none". Other choices include "global" for bands using a global variance estimate; "local" for bands using a local variance estimate and "pred" for prediction bands (at present, using a global variance estimate). To obtain the global variance estimate for a fit, use rv. This can be changed with rv<-. Confidence bands, by default, are 95%, based on normal approximations and neglecting bias. To change the critical value or confidence level, or to obtain simultaneous instead of pointwise confidence, the critical value stored on the fit must be changed. See the kappa0 and crit functions.

tr

Transformation function to use for plotting. Default is the inverse link function, or the identity function if derivatives are requested.

what

What to plot. See predict.locfit.

get.data

If TRUE, original data is added to the plot. Default: FALSE.

f3d

Force the locfit.3d class on the prediction object, thereby generating a trellis style plot. Default: FALSE, unless a tv argument is' provided. Not available in R.

...

Other arguments to plot.locfit.1d, plot.locfit.2d or plot.locfit.3d as appropriate.

See Also

locfit, plot.locfit.1d, plot.locfit.2d, plot.locfit.3d, lines.locfit, predict.locfit, preplot.locfit

Examples

Run this code
x <- rnorm(100)
y <- dnorm(x) + rnorm(100) / 5
plot(locfit(y~x), band="global")
x <- cbind(rnorm(100), rnorm(100))
plot(locfit(~x), type="persp")

Run the code above in your browser using DataLab