Description Usage Arguments Value Author(s) Examples
View source: R/plot.threshpt.R
Following four plots from a fitted threshpt
object are provided:
Plot 1: plot for a response variable on the natural cubic spline of a exposure variable
Plot 2: plot for fitted response values with other mean covariates and 95% confidence intervals
Plot 3: plot for fitted response values
Plot 4: deviance by threshold point plot
1 2 3 4 5 |
x |
A fitted |
select |
Select a plot type |
se |
When TRUE (default) upper and lower confidence interval lines are added to the plot 1 and 4. When FALSE, otherwise. |
expdf |
Degree of freedom of natural cubic spline function for the main exposure variable in plot 1; default value is four. |
xlim |
The x limits of the plot. |
ylim |
The y limits of the plot. |
xaxt |
A character which specifies the x axis type. |
yaxt |
A character which specifies the y axis type. |
col.value |
The color of main values or line in all kind of plot. |
col.preval |
The color of fitted value in plot 3. |
col.ci |
The color of confidence interval lines in plot 1 and 3. |
col.vline |
The color of vertical line that represents a optimum threshold in plot 2, 3 and 4. |
lwd |
Line width for plot 1 |
pch |
Either an integer specifying a symbol or a single character to be used in plotting points in plot 2 and 3. |
pch.preval |
Either an integer specifying a symbol or a single character to be used in plotting fitted values in plot 3. |
main |
Overall title of the plot. |
xlab |
A title for the x axis of the plot |
ylab |
A title for the y axis of the plot |
... |
Not used. |
Generated four kind of plots from a fitted threshpt
object
Youn-Hee Lim, Il-Sang Ohn, and Ho Kim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # read the Seoul data set and create lag variables
data(mort)
seoul = read6city(mort, 11)
seoul_lag = lagdata(seoul, c("meantemp", "mintemp", "meanpm10", "meanhumi"), 5)
# find a optimal threshold and conduct piecewise linear regression
mythresh = threshpt(nonacc ~ meantemp_m3 + meanpm10_m2 + meanhumi + ns(sn, 4*10) + factor(dow),
expvar = "meantemp_m3", family = "poisson", data = seoul_lag,
startrng = 23, endrng = 33, searchunit = 0.2)
# obtain plots
plot(mythresh, select = 1, se = TRUE, expdf=8, col.value = "blue", col.ci = "light blue")
plot(mythresh, select = 2, se = FALSE, col.vline = "orange")
plot(mythresh, select = 3, pch = 1, pch.preval = 2)
plot(mythresh, select = 4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.