R: Fit a GLD quantile regression parametrically or non...
GLD.quantreg
R Documentation
Fit a GLD quantile regression parametrically or non parametrically
Description
The GLD quantile regression can be: 1) Fixed intercept, allowing all other
coefficients to vary, 2) Only intercept is allowed to vary and 3) All
coefficients can vary. Minimisation is achieved numerically through least
squares between the proportion of estimated GLD error distribution below zero
versus the specified quantile for parametric approach. For non parametric
approach, minimisation is achieved using a least squares approach to find a
q-th quantile GLD line such that the percentage of observations below
the line corresponds to the q-th quantile.
Can either be "fixed" or left blank, blank indicates this parameter is
allowed to vary in quantile line estimation
slope
Can either be "fixed" or left blank, blank indicates this parameter is
allowed to vary in quantile line estimation
emp
Can either be TRUE (non parametric GLD quantile regression) or
FALSE (parametric GLD quantile regression), defaults to FALSE
Details
This is a wrapper function for fun.gld.all.vary,
fun.gld.slope.fixed.int.vary,
fun.gld.slope.vary.int.fixed.
Value
A matrix showing the estimated coefficients for the specified quantile
regression model, the objective function value and whether convergence is
reached in the optimisation process. A value of 0 indicates convergence is
reached. The convergence value is the same as the one from the optim
function.
Author(s)
Steve Su
References
Su (2014) "Flexible Parametric Quantile Regression Model" Statistics &
Computing
See Also
GLD.lm.full,fun.plot.q,
summaryGraphics.gld.lm
Examples
## 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)
## Not run:
## 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 parametric GLD 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")
## Non parametric quantile regression
GLD.quantreg(seq(0.1,.9,length=9),engel.fit.all,intercept="fixed",emp=T)
## End(Not run)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GLDreg)
Loading required package: GLDEX
Loading required package: cluster
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GLDreg/GLD.quantreg.Rd_%03d_medium.png", width=480, height=480)
> ### Name: GLD.quantreg
> ### Title: Fit a GLD quantile regression parametrically or non
> ### parametrically
> ### Aliases: GLD.quantreg
> ### Keywords: model
>
> ### ** Examples
>
>
> ## 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)
[,1]
[1,] "This analysis was carried out using FKML GLD"
[2,] "The error distribution was estimated using Maximum Likelihood Estimation"
[3,] "The optimisation procedure used was method and it has converged"
(Intercept) x L1 L2 L3 L4
0.05895140 3.01981005 -0.01457362 1.29930852 0.22981644 0.20182903
[1] 1
[1] 2
[1] 3
dev.new(): using pdf(file="Rplots965.pdf")
>
> ## Find median regression, use empirical method
>
> med.fit<-GLD.quantreg(0.5,fit,slope="fixed",emp=TRUE)
[1] 0.5
0.5
(Intercept) 0.02894985
x 3.01981005
Objective Value 0.00000000
Convergence 0.00000000
>
> ## Not run:
> ##D
> ##D ## Extract the Engel dataset
> ##D
> ##D library(quantreg)
> ##D data(engel)
> ##D
> ##D ## Fit GLD Regression along with simulations
> ##D
> ##D engel.fit.all<-GLD.lm.full(foodexp~income,data=engel,
> ##D param="fmkl",fun=fun.RMFMKL.ml.m)
> ##D
> ##D ## Fit parametric GLD quantile regression from 0.1 to 0.9, with equal spacings
> ##D ## between quantiles
> ##D
> ##D result<-GLD.quantreg(seq(0.1,.9,length=9),engel.fit.all,intercept="fixed")
> ##D
> ##D ## Non parametric quantile regression
> ##D
> ##D GLD.quantreg(seq(0.1,.9,length=9),engel.fit.all,intercept="fixed",emp=T)
> ##D
> ## End(Not run)
>
>
>
>
>
> dev.off()
png
2
>