2-D Plot for Quantile Regression lines

Share:

Description

This function plots quantile regression lines from GLD.lm and one of fun.gld.slope.vary.int.fixed, fun.gld.slope.fixed.int.vary, fun.gld.slope.fixed.int.vary.emp, fun.gld.all.vary.emp, fun.gld.all.vary, fun.gld.slope.vary.int.fixed.emp, GLD.quantreg.

Usage

1
fun.plot.q(x, y, fit, quant.info, ...)

Arguments

x

A numerical vector of explanatory variable

y

A numerical vector of response variable

fit

An object from GLD.lm

quant.info

An object from one of fun.gld.slope.vary.int.fixed, fun.gld.slope.fixed.int.vary, fun.gld.slope.fixed.int.vary.emp, fun.gld.all.vary.emp, fun.gld.all.vary, fun.gld.slope.vary.int.fixed.emp, GLD.quantreg

...

Additional arguments to be passed to plot function, such as axis labels and title of the graph

Details

This is intended to plot only two variables, for quantile regression involving more than one explanatory variable, consider plotting the actual values versus fitted values by fitting a secondary GLD quantile model between actual and fitted values.

Value

A graph showing quantile regression lines

Author(s)

Steve Su

References

Su (2015) "Flexible Parametric Quantile Regression Model" Statistics & Computing May 2015, Volume 25, Issue 3, pp 635-650

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
## Dummy example

## Create dataset

set.seed(10)

x<-rnorm(200,3,2)
y<-3*x+rnorm(200)

dat<-data.frame(y,x)

## Fit FKML GLD regression with 3 simulations

fit<-GLD.lm.full(y~x,data=dat,fun=fun.RMFMKL.ml.m,param="fkml",n.simu=3)

## Find median regression, use empirical method

med.fit<-GLD.quantreg(0.5,fit,slope="fixed",emp=TRUE)

fun.plot.q(x=x,y=y,fit=fit[[1]],med.fit, xlab="x",ylab="y")

## Not run: 

## Plot result of quantile regression

## Extract the Engel dataset 

library(quantreg)
data(engel)

## Fit GLD Regression along with simulations

engel.fit.all<-GLD.lm.full(foodexp~income,data=engel,
param="fmkl",fun=fun.RMFMKL.ml.m)

## Fit quantile regression from 0.1 to 0.9, with equal spacings between 
## quantiles

result<-GLD.quantreg(seq(0.1,.9,length=9),engel.fit.all,intercept="fixed")

## Plot the quantile regression lines

fun.plot.q(x=engel$income,y=engel$foodexp,fit=engel.fit.all[[1]],result,
xlab="income",ylab="Food Expense")

## End(Not run)