Learn R Programming

gamRR (version 0.7.0)

gamRR: Calculate the RR for the GAM

Description

To calculate the relative risk (RR) for the generalized additive model

Usage

gamRR(fit,ref,est,data,n.points,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

plot

logic, to indicate whehter to plot the rr

ylim

a vector of tow numeric number

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.boot

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(
#  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,
#  plot=TRUE,
#  ylim=NULL)
# }

Run the code above in your browser using DataLab