Learn R Programming

npregfast (version 1.2.1)

plot.frfast: Visualization of frfast objects

Description

Useful for drawing the estimated regression function, first and second derivative (for each factor's level).

Usage

## S3 method for class 'frfast':
plot(x = model, y, fac = NULL, der = NULL,
  points = TRUE, xlab = model$name[2], ylab = model$name[1],
  ylim = NULL, main = NULL, col = "black", CIcol = "black",
  CIlinecol = "transparent", pcol = "grey80", abline = TRUE,
  ablinecol = "red", lty = 1, CIlty = 2, lwd = 1, CIlwd = 1,
  cex = 1.4, alpha = 0.2, ...)

Arguments

x
frfast object.
y
NULL.
fac
Vector which determines the level to take into account in the plot. By default is NULL.
der
Number or vector which determines any inference process. By default der is NULL. If this term is 0, the plot shows the initial estimate. If it is 1 or 2, it is designed for the first or se
points
Draw the original data into the plot. By default it is TRUE.
xlab
A title for the x axis.
ylab
A title for the y axis.
ylim
The y limits of the plot.
main
An overall title for the plot.
col
A specification for the default plotting color.
CIcol
A specification for the default confidence intervals plotting color (for the fill).
CIlinecol
A specification for the default confidence intervals plotting color (for the edge).
pcol
A specification for the points color.
abline
Draw an horizontal line into the plot of the second derivative of the model.
ablinecol
The color to be used for abline.
lty
The line type. Line types can either be specified as an integer (0 = blank, 1 = solid (default), 2 = dashed, 3 = dotted, 4 = dotdash, 5 = longdash, 6 = twodash). See details in par.
CIlty
The line type for confidence intervals. Line types can either be specified as an integer (0 = blank, 1 = solid (default), 2 = dashed, 3 = dotted, 4 = dotdash, 5 = longdash, 6 = twodash).
lwd
The line width, a positive number, defaulting to 1. See details in par.
CIlwd
The line width for confidence intervals, a positive number, defaulting to 1.
cex
A numerical value giving the amount by which plotting symbols should be magnified relative to the default. See details in par.
alpha
Alpha transparency for overlapping elements expressed as a fraction between 0 (complete transparency) and 1 (complete opacity).
...
Other options.

Value

  • Simply produce a plot.

Examples

Run this code
library(npregfast)
data(barnacle)

# Nonparametric regression without interactions
fit <- frfast(DW ~ RC, data = barnacle, nboot = 100) 
plot(fit)
plot(fit, der = 0)
plot(fit, der = 0, points = FALSE)
#plot(fit, der = 1, col = "red", CIcol = "blue")

# Nonparametric regression with interactions
fit2 <- frfast(DW ~ RC : F, data = barnacle, nboot = 100) 
plot(fit2)
plot(fit2, der = 0, fac = "lens")
#plot(fit2, der = c(0,1), fac = c("barca","lens"))

Run the code above in your browser using DataLab