如何解释R的分位数回归面板数据模型的结果

发布于 2024-10-17 06:31:07 字数 2093 浏览 1 评论 0原文

如何解读R面板数据模型的结果? 对于我的数据,我估计了 Koenker(2004)关于面板数据分位数回归方法的建议的改编形式:

   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)

}在此处输入代码

 bdeduc2<-read.table("dados_rq.txt", header=T) 
 z<-c("inter","ne","no","su","co")
 X<-bdeduc2[,z]
 y<-bdeduc2$scoreedu
 s<-bdeduc2$uf
 w<-c(0.1,0.25,0.5,0.25,0.1)
taus<-c(0.1,0.25,0.5,0.75,0.9)
lambda<-1

但我不这样做知道识别以下结果:

$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

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)

}enter code here

 bdeduc2<-read.table("dados_rq.txt", header=T) 
 z<-c("inter","ne","no","su","co")
 X<-bdeduc2[,z]
 y<-bdeduc2$scoreedu
 s<-bdeduc2$uf
 w<-c(0.1,0.25,0.5,0.25,0.1)
taus<-c(0.1,0.25,0.5,0.75,0.9)
lambda<-1

But 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野鹿林 2024-10-24 06:31:07

看起来您适合回归并保存它,然后尝试在新会话中查看它,而无需加载分位数回归包(它为您提供列表摘要,而不是包中的对象摘要)。

确保加载了用于创建对象的包,然后再次进行摘要以查看是否为您提供了有意义的输出。

It looks like you fit the regression and saved it, then are trying to look at it in a new session without the quantile regression package loaded (it is giving you the list summary, not the object summary that is in the package).

Make sure that the package used to create your object is loaded, then do summary again to see if that gives you meaningful output.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文