Question of "Quantile Regression for Longitudinal Data"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Question of "Quantile Regression for Longitudinal Data"

Helen Chen
Hi,

I am trying to estimate a quantile regression using panel data. I am trying to use the model that is described in Dr. Koenker's article. So I use the code the that is posted in the following link:

http://www.econ.uiuc.edu/~roger/research/panel/rq.fit.panel.R

How to estimate the panel data quantile regression if the regression contains no constant term? I tried to change the code of rq.fit.panel by delect "X=cbind(1,x)" and would like to know is that correct ?


Thanks
I really would appreciate some suggestions.
Best
Helen Chen
Reply | Threaded
Open this post in threaded view
|

Re: Question of "Quantile Regression for Longitudinal Data"

Tirthankar Chakravarty
This is a nontrivial problem. This comes up often on the Statalist
(-qreg- is for  cross-section quantile regression):
"
You want to fit a plane through the origin using the L-1 norm.
This is not as easy as with L-2 norm (LS), as it is more
than a matter of dropping a constant predictor yet otherwise using the
same criterion of fit. You are placing another constraint on a
problem that already does not have a closed-form solution,
and it does not surprise me that -qreg- does not support this.
" (N.J. Cox)
http://www.stata.com/statalist/archive/2007-10/msg00809.html

You will probably have to program this by hand. Note also the
degeneracy conditions in Koenker (2003, pg. 36--). I am not sure how
this extends to panel data though.

References:
@book{koenker2005qre,
  title={{Quantile Regression; Econometric Society Monographs}},
  author={Koenker, R.},
  year={2005},
  publisher={Cambridge University Press}
}

T

On Sun, Apr 26, 2009 at 8:24 AM, Helen Chen <[hidden email]> wrote:

>
> Hi,
>
> I am trying to estimate a quantile regression using panel data. I am trying
> to use the model that is described in Dr. Koenker's article. So I use the
> code the that is posted in the following link:
>
> http://www.econ.uiuc.edu/~roger/research/panel/rq.fit.panel.R
>
> How to estimate the panel data quantile regression if the regression
> contains no constant term? I tried to change the code of rq.fit.panel by
> delect "X=cbind(1,x)" and would like to know is that correct ?
>
>
> Thanks
> I really would appreciate some suggestions.
> Best
> Helen Chen
> --
> View this message in context: http://www.nabble.com/Question-of-%22Quantile-Regression-for-Longitudinal-Data%22-tp23239896p23239896.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Question of "Quantile Regression for Longitudinal Data"

Roger Koenker-2
I was trying to resist responding to this question since the original  
questioner
had already been admonished twice  last october about asking questions
on R-help about posted code that was not only not a part of R-base,
but not even a part of an R package.  But the quoted comment about
Stata is too enticing a provocation to resist.

First, it should be said that omitting intercepts in any regression  
setting
should be undertaken "at one's peril"  it is generally a very dangerous
activity, somewhat akin to fitting interactions without main effects,  
but if
there is a good rational for it, it is no different in principle for  
median
regression than for mean regression.  It may well be that Stata  
prohibits
this sort of thing out of some sort of paternalistic motive, but in R  
the
usual formula convention  y ~ x1 + x2 -1 suffices.  Of course it  
situations
in which such a formula is used for several quantiles it should be  
understood
that it is forcing each conditional quantile function through the origin
effectively implies that the conditional distribution degenerates to a  
point
mass  at the origin.

Second,  I would like to remark that "closed-form solutions" are in  
the eye
of the beholder, and many people who can recall the infamous formula:

        betahat = (X'X)^{-1} X'y

would be hard pressed to  dredge up enough linear algebra to use the
formula for anything more than the bivariate case on  the proverbial
desert island  without the aid of their trusty  laptop "Friday".

Finally,  cbind(1,x) does introduce an intercept in the code  
originally asked
about, so if you don't want an intercept don't do that, but be sure  
that that is
really want you want to do.


url:    www.econ.uiuc.edu/~roger                Roger Koenker
email   [hidden email]                       Department of Economics
vox:    217-333-4558                            University of Illinois
fax:    217-244-6678                            Champaign, IL 61820


On Apr 26, 2009, at 6:35 AM, Tirthankar Chakravarty wrote:

> This is a nontrivial problem. This comes up often on the Statalist
> (-qreg- is for  cross-section quantile regression):
> "
> You want to fit a plane through the origin using the L-1 norm.
> This is not as easy as with L-2 norm (LS), as it is more
> than a matter of dropping a constant predictor yet otherwise using the
> same criterion of fit. You are placing another constraint on a
> problem that already does not have a closed-form solution,
> and it does not surprise me that -qreg- does not support this.
> " (N.J. Cox)
> http://www.stata.com/statalist/archive/2007-10/msg00809.html
>
> You will probably have to program this by hand. Note also the
> degeneracy conditions in Koenker (2003, pg. 36--). I am not sure how
> this extends to panel data though.
>
> References:
> @book{koenker2005qre,
>  title={{Quantile Regression; Econometric Society Monographs}},
>  author={Koenker, R.},
>  year={2005},
>  publisher={Cambridge University Press}
> }
>
> T
>
> On Sun, Apr 26, 2009 at 8:24 AM, Helen Chen <[hidden email]>  
> wrote:
>>
>> Hi,
>>
>> I am trying to estimate a quantile regression using panel data. I  
>> am trying
>> to use the model that is described in Dr. Koenker's article. So I  
>> use the
>> code the that is posted in the following link:
>>
>> http://www.econ.uiuc.edu/~roger/research/panel/rq.fit.panel.R
>>
>> How to estimate the panel data quantile regression if the regression
>> contains no constant term? I tried to change the code of  
>> rq.fit.panel by
>> delect "X=cbind(1,x)" and would like to know is that correct ?
>>
>>
>> Thanks
>> I really would appreciate some suggestions.
>> Best
>> Helen Chen
>> --
>> View this message in context: http://www.nabble.com/Question-of-%22Quantile-Regression-for-Longitudinal-Data%22-tp23239896p23239896.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> To every ω-consistent recursive class κ of formulae there correspond
> recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
> belongs to Flg(κ) (where v is the free variable of r).
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Question of "Quantile Regression for Longitudinal Data"

ywh123
I've used the function rq.fit.sfn  and rq.fit.panel to estimate a quantile regression on a panel data set.Now I would like to compute an statistic to measure the goodness of fit of this model (T-statistics and   P-value ).

 Does someone know how could I do that?

best wish
Reply | Threaded
Open this post in threaded view
|

Re: Question of "Quantile Regression for Longitudinal Data"

RKoenker
<quote author="ywh123">
I've used the function rq.fit.sfn  and rq.fit.panel to estimate a quantile regression on a panel data set.Now I would like to compute an statistic to measure the goodness of fit of this model (T-statistics and   P-value ).

 Does someone know how could I do that?


For formal inference you are better off using rqss() in the quantreg package, but beware that formal
inference for shrinkage estimators is still an active research topic.

For goodness of fit statistics like the usual regression R^2, see FAQ() item 4 in the quantreg package.


url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoenker@uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Urbana, IL 61801
Reply | Threaded
Open this post in threaded view
|

Re: Question of "Quantile Regression for Longitudinal Data"

ywh123
Thanks for your help
RKoenker

I want to deal with the problem through  bootstrap.so I can get p-value and T-statistics.
Do you think so?
Reply | Threaded
Open this post in threaded view
|

Re: Question of "Quantile Regression for Longitudinal Data"

mirelleab
How to interprete the results of panel data models of R? I estimate a adapted form of Koenker's (2004) suggestion for a quantile regression approach with panel data, for my data:

  rq.fit.panel <- function(X,Y,s,w,taus,lambda)

   {
require(SparseM)
    require(quantreg)

 K <- length(w)
if(K != length(taus))
stop("length of w and taus must match")
 X <- as.matrix(X)
     p <- ncol(X)
     n <- length(levels(as.factor(s)))
     N <- length(y)
if(N != length(s) || N != nrow(X))
stop("dimensions of y,X,s must match")
     Z <- as.matrix.csr(model.matrix(~as.factor(s)-1))
     Fidelity <- cbind(as(w,"matrix.diag.csr") %x% X,w %x% Z)
     Penalty <- cbind(as.matrix.csr(0,n,K*p),lambda*as(n,"matrix.diag.csr"))
     D <- rbind(Fidelity,Penalty)
     y <- c(w %x% y,rep(0,n))
 a <- c((w*(1-taus)) %x% (t(X)%*%rep(1,N)),
 sum(w*(1-taus)) * (t(Z) %*% rep(1,N)) + lambda * rep(1,n))
 rq.fit.sfn(D,y,rhs=a)
 }
       
But i don't have the estimate significances, i don't know identify the results below:

$coef
 [1]  1.02281339 -0.18750668 -0.13688807 -0.04180458 -0.01367417  1.02872440 -0.18055062 -0.13003224 -0.03829135 -0.01409369  1.03377335 -0.16649845 -0.11669812

[14] -0.03854060 -0.01438620  1.03851101 -0.15328087 -0.10440359 -0.03871744 -0.01465492  1.04330584 -0.14660960 -0.09670756 -0.03465501 -0.01430647 -0.29187982

[27] -0.21831160 -0.11295134 -0.21530494 -0.15664777 -0.13840296 -0.03224749 -0.11692122 -0.11237144 -0.15112171 -0.10385352 -0.08385934 -0.16090525 -0.30349309

[40] -0.16121494 -0.03106264 -0.16299994 -0.03182579 -0.22271685 -0.08251486 -0.29031224 -0.19680023 -0.20004209 -0.05601186 -0.21140762 -0.04254752 -0.01864703

$ierr
[1] 0

$it
[1] 16

$time
[1] 0

##summary rq

 summary(rq)

     Length Class  Mode  
coef 52     -none- numeric
ierr  1     -none- numeric
it    1     -none- numeric
time  1     -none- numeric

Anybody help me?
Reply | Threaded
Open this post in threaded view
|

Re: Question of "Quantile Regression for Longitudinal Data"

mirelleab
Quantile Regression for Longitudinal Data
Reply | Threaded
Open this post in threaded view
|

The other Question of "Censored Quantile Regression for Longitudinal Data"

newhonewind
How to solve the panel data of cqr by writing the R code or using the "quantreg" ?
Thank you!