Learn R Programming

npregfast (version 1.3.0)

plotdiff: Visualization of the differences between the estimated curves for two factor's levels

Description

Useful for drawing the differences between the estimation of curves (initial estimate, first or second derivative) for two factor's levels. Missing values of factor's levels is not allowed.

Usage

plotdiff(model, level2, level1, der = NULL, est.include = FALSE, xlab = model$name[2], ylab = model$name[1], ylim = NULL, main = NULL, col = "black", CIcol = "black", CIlinecol = "transparent", abline = TRUE, ablinecol = "red", lty = 1, CIlty = 2, lwd = 1, CIlwd = 1.5, alpha = 0.2, ...)

Arguments

model
Parametric or nonparametric regression out obtained by frfast function.
level2
Second factor's level at which to perform the differences between curves.
level1
First factor's level at which to perform the differences between curves.
der
Number or vector which determines any inference process. By default der is NULL. If this term is 0, the plot shows the differences between estimated regression functions. If it is 1 or 2, it is designed for the first or second derivative, respectively.
est.include
Draws the estimates of the model. By default it is FALSE.
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.
CIlinecol
A specification for the default confidence intervals plotting color (for the edge).
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.
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 with interactions
fit2 <- frfast(DW ~ RC : F, data = barnacle, nboot = 100) 
plotdiff(fit2, level2 = "lens", level1 = "barca")
plotdiff(fit2, level2 = "lens", level1 = "barca", der = 1, col = "blue", CIcol = "grey")
plotdiff(fit2, "lens", "barca", der = c(0, 1), ylim = c(-0.05, 0.05))



Run the code above in your browser using DataLab