plot.sback {wsbackfit}R Documentation

Default sback plotting

Description

Takes a fitted object produced by sback() and plots the estimates of the nonparametric functions on the scale of their respective covariates, no matter whether a particular nonparametric function is an additive component or a varying coefficient.

Usage

## S3 method for class 'sback'
plot(x, composed = TRUE, ask = TRUE, select = NULL, ...)

Arguments

x

an object of class sback as produced by sback().

composed

a logical value. If TRUE, the default, the function plots the estimates of the composed (linear plus nonlinear) nonparametric functions (see Details).

ask

a logical value. If TRUE, the default, the user is asked for confirmation, before a new figure is drawn.

select

Allows the plot for a single model term to be selected for printing. e.g. if you just want the plot for the second smooth term set select = 2.

...

other graphics parameters to pass on to plotting commands.

Details

For identifiability purposes, the estimating algorithm implemented in the wsbackfit package decomposes each nonparametric function in two components: a linear (parametric) component and a nonlinear (nonparametric) component. For plotting, the user can choose to plot these components either separately in one graph (composed = FALSE), or to only plot the resulting composed function (composed = TRUE). Also, for the varying coefficient terms, the plots show the estimated surface spanned by (g_j , X_j , Z_j).

Value

None

Author(s)

Javier Roca-Pardinas, Maria Xose Rodriguez-Alvarez and Stefan Sperlich

See Also

sback, summary.sback

Examples

library(wsbackfit)
################################################
# Gaussian Simulated Sample
###############################################
set.seed(123)
# Define the data generating process
n <- 1000
x1 <- runif(n)*4-2
x2 <- runif(n)*4-2
x3 <- runif(n)*4-2
x4 <- runif(n)*4-2
x5 <- as.numeric(runif(n)>0.6)

f1 <- 2*sin(2*x1)
f2 <- x2^2
f3 <- 0
f4 <- x4
f5 <- 1.5*x5

mu <- f1 + f2 + f3 + f4 + f5
err <- (0.5 + 0.5*x5)*rnorm(n)
y <- mu + err

df <- data.frame(x1 = x1, x2 = x2, x3 = x3, x4 = x4, x5 = as.factor(x5), y = y)

# Fit the model with a fixed bandwidth for each covariate
m0 <- sback(formula = y ~ x5 + sb(x1, h = 0.1) + sb(x2, h = 0.13) 
  + sb(x3, h = 0.1) + sb(x4, h = 0.1), kbin = 30, data = df)

plot(m0)


[Package wsbackfit version 1.0-5 Index]