quantile.gam | R Documentation |
This method can be used to get the estimated conditional quantiles of the response variable.
## S3 method for class 'gam'
quantile(x, probs, newdata, w = NULL, offset = NULL, ...)
x |
the output of a |
probs |
numeric vector of probabilities with values in (0,1). |
newdata |
Optional new data frame or list to be passed to predict.gam. |
... |
funther arguments to be passed to |
A matrix where each column is a vector of estimated quantiles responses.
The number of rows is equal to the number of responses in the fitted object or in newdata
.
library(mgcvUtils); library(MASS)
b <- gam(list(accel~s(times,k=20,bs="ad"),~s(times)),
data=mcycle,family=gaulss())
qfit <- quantile(b, c(0.05, 0.25, 0.5, 0.75, 0.95))
plot(mcycle, ylim = c(-160, 100))
for(ii in 1:ncol(qfit)){
lines(mcycle$times, qfit[ , ii], col = 2)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.