Learn R Programming

gamRR (version 0.7.0)

gamRR.boot: Calculate the RR for the GAM by using the bootstrap method

Description

To calculate the relative risk (RR) for the generalized additive model by using the bootstrap method

Usage

gamRR.boot(fit,ref,est,data,n.points,n.boot,plot,ylim)

Arguments

fit

an object of gam()

ref

a vector of the independent variables at referenced level, please note that the names of the variables in 'ref' should be matched to those in the model

est

character, to indicate which numeric variable should be calculated the RR, please note that the name of the variable in 'est' should be matched to which in the model

data

the name of the data in the gam()

n.points

integer, the number of points of 'est' to be estimated, the default is 10

n.boot

integer, the number of times for resampling, the default is 50

plot

logic, to indicate whehter to plot the rr, the default is TRUE

ylim

a vector of tow numeric number determinging the range of y axis

Value

data frame

a data frame including variables of 'x', 'rr', 'u', and 'l'

x

the value of 'est' variable

rr

the RR coresponding to 'est' variable

u

the 95 percent upper limit of the 'rr'

l

the 95 percent lower limit of the 'rr'

See Also

gamRR

Examples

Run this code
# NOT RUN {
#require("mgcv")
#dat <- gamSim(1,100,dist="poisson",scale=.25)
#fit <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=poisson,dat,method="REML")
#plot(fit,select=2)

#gamRR.boot(
# fit=fit,
# ref=c(x0=dat$x0[1],x1=dat$x1[1],x2=dat$x2[1],x3=dat$x3[1]),
# est="x1",
# data=dat,
# n.points=10,
# n.boot=10,
# plot=TRUE,
# ylim=NULL)
# }

Run the code above in your browser using DataLab