1 / 21

Quantile regression- a very brief introduction

Quantile regression- a very brief introduction. Marian Scott NERC workshop, University of Glasgow December 2013. What shall we cover?. What do we mean by a quantile? Quantile regression Inference Other resources.

samira
Download Presentation

Quantile regression- a very brief introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Quantile regression- a very brief introduction Marian Scott NERC workshop, University of Glasgow December 2013

  2. What shall we cover? • What do we mean by a quantile? • Quantile regression • Inference • Other resources

  3. Usual Regression: response Y, considered as a function of explanatory variables x1,x2,...,xn, more formally, the standard regression is for the conditional mean of the response variable E(Y|X) = f(x1,x2,...,xn). However, we can build regression models for other parts of the distribution of Y, namely other quantiles, and hence the name quantile regression. Can be very useful when interested say in extremes of temperature, or rainfall since extremes are high quantiles of a distribution A quantile regression model

  4. What is a quantile?

  5. What is a quantile?

  6. QY (|X) by this we mean the conditional quantile of the response variable that we wish to model. In the standard regression model, QY (0.5|X) is for the median (rather than the mean), but is probably closest to the standard regression that you will be familiar with. QY (0.9|X) is the 90th percentile of the Y distribution, conditional on X. Or 90% of the values for Y are less than or equal to the specified function of X. What is a quantile?

  7. QY (|X) is a linear function, the parameter values are now also indexed by , e.g. 0 ()X0 + 1 ()X1 + 2 ()X2 Parameter estimates in linear quantile regression models have the same interpretation as those in other linear models, namely the rate of change in the response quantile of interest for unit changes in the explanatory after adjustment for the other explanatory variables. Parametric quantile regression

  8. Fitting a quantile regression model

  9. Parameter estimation

  10. Inference for a quantile regression model For a parametric quantile regression, we will naturally wish to estimate the parameters, and provide confidence intervals or hypothesis tests. We will also want to visualise the fitted line Just is in ordinary linear regression, these can be done for a simple quantile regression, using the summary and abline commands in the quantreg package. Diagnostics- unlike ordinary linear regression, there is less emphasis on diagnostics, such as residual plots but

  11. Inference for a quantile regression model Quite commonly we would fit and plot linear models for a series of quantiles and visually examine how whether they are parallel, fan out or even cross. Fanning out might indicate that the variance is not constant. Confidence intervals for the slope and intercept can be calculated (but is a challenge) and they too are commonly presented as a function of the quantile .

  12. Linear regression quantile

  13. Linear regression quantile Inference plots for a simple linear quantile regression (from Caren Marzban presentation downloaded Dec 2013)

  14. QR of temperature

  15. Rainfall quantiles

  16. This time the model includes smooth terms rather than a parametric function Qlog(flow)(0.99|x) = s1(time) + s2(day of year) + s3(time,day of year) +  This model was used to model the high quantiles (so extreme) river flow The data were daily, so that flow is considered to depend on a trend, s1 , when within the year (a seasonal component), s2 an interaction, s3 Non-parametric quantile regression

  17. Nonparametric quantile regression

  18. Quantile regression in R Within R, the quantreg package, fits regression models to any quantile fit1 <- rq(y ~ x, tau = 0.5, data = ???) Tau is the quantile (in this case the 50th so a median regression)

  19. Additive quantile regression in R Fitting additive models for the quantiles is more complex, but can be done in the quantreg package, using rqss fit1 <- rqss(y ~ x1 +qss(x2 , lambda=3), tau = 0.5, data = ???) Tau is the quantile (in this case the 50th so a median regression) qss indicates that x2 will appear in a smooth fashion, lambda is the smoothing parameters. These methods are very data hungry!!!

  20. Case studies The environmental examples we will examine include species density, daily river flow, and also maximum daily temperature for 30 years for the city of Twente in the Netherlands (downloaded from the Dutch meteorological organisation). There is a separate handout and a scriptfile quantcase.r

  21. References • Cade B, Noon B. (2003). A gentle introduction ro quantile regression for ecologists. Front Ecol Environ 1(8) 412-420 • Koenker R,. (2003). Quantile regression in R: A vignette. Ecology 84(8), 2034-2041. • Also web pages of R Koenker give some further examples of the use of QR in ecology.

More Related