frame_ald: Density function plot of the error term for quantile...

Description Usage Arguments Value Examples

View source: R/frame_ald.R

Description

density function plot of the error term on each quantile

Usage

1
frame_ald(y, x, tau, smooth, error, iter)

Arguments

y

vector, dependent variable of quantile regression

x

matrix, matrix consisted independent variables of quantie regression

tau

sigle number or vector, quantiles

smooth

sigular, default is 100, the larger the smoother of density function

error

the convergence maximum error

iter

maximum iterations of the EM algorithm

Value

dataframe to plot the density function of the error term

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(ggplot2)
data(ais)
x <- matrix(ais$LBM, ncol = 1)
y <- ais$BMI
tau = c(0.1, 0.5, 0.9)
ald_data <- frame_ald(y, x, tau, smooth = 10, error = 1e-6,
                  iter = 2000)
ggplot(ald_data) +
   geom_line(aes(x = r, y = d, group = obs, colour = tau_flag)) +
   facet_wrap(~tau_flag, ncol = 1, scale = "free") +
   xlab('') +
   ylab('Asymmetric Laplace Distribution Density Function')

quokar documentation built on May 2, 2019, 6:39 a.m.