plot.bcgam: 2D plots for 'bcgam' fits

Description Usage Arguments Details Author(s) Examples

View source: R/plot_bcgam.R

Description

2D plots of predicted values with interval estimates based on a bcgam object and one non-parametrically modelled predictor.

Usage

1
2
3
4
## S3 method for class 'bcgam'
plot(x, x1, interval = "credible", parameter = "mu",
  x1.grid = 100, level = 0.95, type = "l", col = 1, col.inter = col,
  lty = 1, lty.inter = 2, lwd = 1, lwd.inter = lwd, ylim = NULL, ...)

Arguments

x

Object of class inheriting from "bcgam".

x1

A non-parametrically modelled predictor in a bcgam fit. There is no default variable.

interval

Type of interval to plot. It can be either "credible" or "prediction". interval="prediction" only works for the gaussian family. In this case, the predictive posterior distribution is plotted. The default is "credible".

parameter

The type of parameter to be plotted. If parameter="eta", then the systematic component η is plotted. If parameter="mu", then the mean value μ obtained by transforming η using the inverse of the link function is plotted. The default is "mu". If interval="prediction", then this variable is ignored.

x1.grid

A positive integer that specifies how dense the x grid will be. The default is 100.

level

Tolerance/credible level. The default is 0.95.

type

What type of plot should be drawn. The default is for lines ("l").

col

Color of fitted values. The default is black (1).

col.inter

Color of interval estimates. If not specified, it takes the same value as col.

lty

What type of line should be drawn for fitted values. Ignored when a line is not being drawn. The default is a solid line (1).

lty.inter

What type of line should be drawn for interval estimates. The default is a dotted line (2).

lwd

The line width of fitted values, a positive number, defaulting to 1.

lwd.inter

The line width of interval estimates, a positive number, defaulting to 1.

ylim

The y limits of the plot. If ylim=NULL, then the minimum value of the lower bound estimates and the maximum value of the upper bound estimates are used. The default is NULL.

...

other parameters to be passed through to plotting functions.

Details

plot.bcgam produces 2D plots based on the bcgam object. Interval estimates are based on the specified level.

If there are more than one non-parametrically modelled predictors, then these will be evaluated at the largest values that are smaller than or equal to their median values. Categorical covariates will be evaluated at their mode. Also, continuous covariates will be evaluated at the largest values that are smaller than or equal to their median values.

This routine creates 2D plots based on the posterior distribution in the bcgam object.

Author(s)

Cristian Oliva-Aviles and Mary C. Meyer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
n<-50
x1<-(1:n/n)^{1/3}
x2<-log(1:n/n)
z<-as.factor(rbinom(n, 1, 0.6))
eta<-x1+x2+0.2*as.numeric(z)+rnorm(n, sd=0.2)
mu<-exp(eta)/(1+exp(eta))
y<-(mu<0.6)

bcgam.fit <- bcgam(y~sm.incr(x1)+sm.conc(x2, numknots=8)+z, nloop=10000, family="binomial")
plot(bcgam.fit, x1, parameter="mu", col=4, level=0.90)
plot(bcgam.fit, x2, parameter="eta", col=3, col.inter=2)

## End(Not run)

bcgam documentation built on May 2, 2019, 8:42 a.m.

Related to plot.bcgam in bcgam...