楼主: ffyyll13
15552 38

[求助]怎么求广义误差分布的分位数啊 [推广有奖]

11
ffyyll13 发表于 2007-5-18 09:19:00

兄弟,现在我想要问的是自由度怎么确定啊

12
yiyo900 发表于 2007-5-18 11:17:00

我知道的t-distribution pdf 有v自由度参数.

ged distribution pdf 有r 形状参数.

况且e-views @qged(p,r)已说明的很清楚,

只要 p and r 就可以算出分位数了.

(r你应该自己在程序中估计出来了)

还不够清楚?

[此贴子已经被作者于2007-5-20 7:51:29编辑过]

13
ffyyll13 发表于 2007-5-18 16:10:00

那我该怎么将多scalar t=@qdist(p,r)加到你给我的那个程序中去呢?谢了

这是你给我的程序:' Program to estimate a GARCH(1,1)-t model on the series fa.

'%path = @runpath+"../data/"
'cd %path
load jjsj
series d1 = 0
smpl @first @first
d1 = 1
smpl @all

'get starting values from Gaussian ARCH
equation eq1
eq1.arch fa c
show eq1.output
'declare and innitialize parameters
coef(1) mu = eq1.c(1)
coef(1) omega = eq1.c(2)
coef(1) alpha =eq1.c(3)
coef(1) beta =eq1.c(4)
coef(1) tdf=3

' Define pi
!pi=@acos(-1)

'set up GARCH(1,1)-t likelihood
logl ll_l
ll_l.append @logl logl
ll_l.append res=fa-mu(1)
ll_l.append sig2 =@recode(d1=1,omega(1)/(1-alpha(1)-beta(1)),omega(1)+alpha(1)*res(-1)^2+beta(1)*sig2(-1))
ll_l.append z =res^2/sig2/(tdf(1)-2)+1
ll_l.append logl = @gammalog((tdf(1)+1)/2)-@gammalog(tdf(1)/2)-log(!pi)/2-log(tdf(1)-2)/2-log(sig2)/2 - (tdf(1)+1)*log(z)/2

'estimate and display output
ll_l.ml(showopts,m=1000,c=1e-5)
show ll_l.output

那我该怎么将多scalar t=@qdist(p,r)加到你给我的那个程序中去呢?才能得直接出分位数呢?谢了

下面这几句话是什么意思呢?

series d1 = 0
smpl @first @first
d1 = 1
smpl @all

序列d1=0是什么意思呢?@first 又是什么函数呢?是不是在定义样本初值?为什么又让他们等于0又等于1呢?

[此贴子已经被作者于2007-5-18 16:57:59编辑过]

14
yiyo900 发表于 2007-5-19 08:12:00

1.在程序最后面,加入这一行

scalar quantile=@qtdist(0.05,tdf(1))

2.series d1 = 0

smpl @first @first

d1 = 1

smpl @all

就是建立一个series d1,第一个obs是1,余是0

1

0

0

若想學e-views编程,多看多翻EViews 5 Command Ref

15
ffyyll13 发表于 2007-5-19 10:26:00

好太感谢你拉 TDF是自由度吗,程序算出的结果quantile=-1.87014518238是分位数值吗,在这个程序里coef(1) tdf=3是什么意思呢?是建立长度为一的系数向量吗?为什么要让tdf=3呢?我现在已经补装上了ref文件,正在看,如果有什么问题希望你能进一步指教!别嫌我麻烦啊 呵呵

[此贴子已经被作者于2007-5-19 15:31:22编辑过]

16
ffyyll13 发表于 2007-5-19 16:57:00

差不多搞定了

这是我应用你先前给我的程序改过来的针对基金裕华的估计程序:

' Program to estimate a GARCH(1,1)-t model on the series yuhua.

'%path = @runpath+"../yuhua/"
'cd %yuhua
load jjsj
series d1 = 0
smpl @first @first
d1 = 1
smpl @all

'get starting values from Gaussian ARCH
equation eq1
eq1.arch yuhuat c
show eq1.output
'declare and innitialize parameters
coef(1) mu = eq1.c(1)
coef(1) omega = eq1.c(2)
coef(1) alpha =eq1.c(3)
coef(1) beta =eq1.c(4)
coef(1) tdf=3
!pi=@acos(-1)

'set up GARCH(1,1)-t likelihood
logl ll_l
ll_l.append @logl logl
ll_l.append res=yuhuat-mu(1)
ll_l.append sig2 =@recode(d1=1,omega(1)/(1-alpha(1)-beta(1)),omega(1)+alpha(1)*res(-1)^2+beta(1)*sig2(-1))
ll_l.append z =res^2/sig2/(tdf(1)-2)+1
ll_l.append logl = @gammalog((tdf(1)+1)/2)-@gammalog(tdf(1)/2)-log(!pi)/2-log(tdf(1)-2)/2-log(sig2)/2 - (tdf(1)+1)*log(z)/2

'estimate and display output
ll_l.ml(showopts,m=1000,c=1e-5)
show ll_l.output
scalar quantile=@qtdist(0.95,tdf(1))

程序执行出来的结果分别如下:Dependent Variable: YUHUAT
Method: ML - ARCH (Marquardt) - Normal distribution
Date: 05/19/07 Time: 17:10
Sample: 1 199
Included observations: 199
Convergence achieved after 76 iterations
Variance backcast: ON
GARCH = C(2) + C(3)*RESID(-1)^2 + C(4)*GARCH(-1)

Coefficient Std. Error z-Statistic Prob.

C 0.171256 0.145458 1.177360 0.2391

Variance Equation

C 1.336620 0.632853 2.112056 0.0347
RESID(-1)^2 0.288061 0.105933 2.719274 0.0065
GARCH(-1) 0.490229 0.167354 2.929295 0.0034

R-squared -0.012324 Mean dependent var 0.438428
Adjusted R-squared -0.027899 S.D. dependent var 2.412696
S.E. of regression 2.446119 Akaike info criterion 4.493790
Sum squared resid 1166.783 Schwarz criterion 4.559987
Log likelihood -443.1321 Durbin-Watson stat 1.836723

LogL: LL_L
Method: Maximum Likelihood (Marquardt)
Date: 05/19/07 Time: 17:10
Sample: 1 199
Included observations: 199
Evaluation order: By observation
Estimation settings: tol= 1.0e-05, derivs=accurate numeric
Initial Values: MU(1)=0.17126, OMEGA(1)=1.33662, ALPHA(1)=0.2880
6, BETA(1)=0.49023, TDF(1)=3.00000
Convergence achieved after 23 iterations

Coefficient Std. Error z-Statistic Prob.

MU(1) 0.179415 0.149171 1.202750 0.2291
OMEGA(1) 1.275241 0.781697 1.631376 0.1028
ALPHA(1) 0.296658 0.134556 2.204720 0.0275
BETA(1) 0.516720 0.201011 2.570609 0.0102
TDF(1) 9.226873 9.278601 0.994425 0.3200

Log likelihood -442.3448 Akaike info criterion 4.495928
Avg. log likelihood -2.222838 Schwarz criterion 4.578674
Number of Coefs. 5 Hannan-Quinn criter. 4.529417

结果应该上半部分是残差服从正态分布下的结果吧,下半部分是残差服从t分布的结果吧,另外我把你这里的 quantile=@qtdist(0.05,tdf(1))里的0.05改成了0.95,分位数计算结果为scarlar quantile=1.827994,不知对否?

[此贴子已经被作者于2007-5-19 17:15:49编辑过]

17
ffyyll13 发表于 2007-5-19 18:07:00

在对广义误差分布的编程中又出现问题了

这是我针对广义误差分布编制的程序:

' Program to estimate a GARCH(1,1)-generalized error distributed model on the series yuhua.

'%path = @runpath+"../yuhua/"
'cd %yuhua
load jjsj
series d1 = 0
smpl @first @first
d1 = 1
smpl @all

'get starting values from Gaussian ARCH
equation eq1
eq1.arch yuhuat c
show eq1.output
'declare and innitialize parameters
coef(1) mu = eq1.c(1)
coef(1) omega = eq1.c(2)
coef(1) alpha =eq1.c(3)
coef(1) beta =eq1.c(4)
coef(1) nu(1)=2


'set presample values of expressions in logl
smpl s0
series sig = omega(1)
series res =0
logl ll_l
ll_l.append @logl logl
ll_l.append @logl logll
ll_l.append loggaml=@gammalog(1/mu(1))
ll_l.append loglam=-log(2)/nu(1)+0.5*(loggaml-@gammalog(3/nu(1)))

ll_l.append sig2=omega(1)+alpha(1)*res(-1)^2+beta(1)*sig2(-1)
ll_l.append res =y-mu(1)
ll_l.append z=res/@sqrt(sig2)
ll_l.append logll =log(nu(1))-loglam-(1+1/nu(1))*log(2)-loggaml-
0.5*@abs(z/exp(loglam))^nu(1)-0.5*log(sig2)
' estimate and display output
smpl sl
ll l.ml(showopts,m=1000,c=1e-5)
show ll l.output
scalar quantie=@qged(0.95,r)

运行结果如下:

Date: 05/19/07 Time: 18:01
Sample: 1 199
Included observations: 199
Convergence achieved after 76 iterations
Variance backcast: ON
GARCH = C(2) + C(3)*RESID(-1)^2 + C(4)*GARCH(-1)

Coefficient Std. Error z-Statistic Prob.

C 0.171256 0.145458 1.177360 0.2391

Variance Equation

C 1.336620 0.632853 2.112056 0.0347
RESID(-1)^2 0.288061 0.105933 2.719274 0.0065
GARCH(-1) 0.490229 0.167354 2.929295 0.0034

R-squared -0.012324 Mean dependent var 0.438428
Adjusted R-squared -0.027899 S.D. dependent var 2.412696
S.E. of regression 2.446119 Akaike info criterion 4.493790
Sum squared resid 1166.783 Schwarz criterion 4.559987
Log likelihood -443.1321 Durbin-Watson stat 1.836723

并出现以下问题:

[求助]怎么求广义误差分布的分位数啊

另外我该怎么将@qged这个函数加入到程序中去,在程序中最后一行加入scalar quantie=@qged(0.95,r),但这个r我不知道怎么定义,请指教

[此贴子已经被作者于2007-5-19 18:15:52编辑过]

18
ffyyll13 发表于 2007-5-19 18:08:00
'set presample values of expressions in logl
smpl s0
series sig = omega(1)
series res =0
这段话又是什么意思啊

[此贴子已经被作者于2007-5-19 18:14:02编辑过]

19
yiyo900 发表于 2007-5-20 07:46:00

1.EViews 5 Command Ref在

C:\Program Files\EViews5\Docs

2.程序修改如附件

jjsj_garchged

[此贴子已经被作者于2007-5-24 7:39:29编辑过]

118408.rar
下载链接: https://bbs.pinggu.org/a-118408.html

639 Bytes

[求助]怎么求广义误差分布的分位数啊

本附件包括:

  • jjsj_garchged.prg

20
ffyyll13 发表于 2007-5-20 09:43:00

再次表示感谢!这段时间辛苦你了!

118464.gif

[此贴子已经被作者于2007-5-20 9:51:05编辑过]

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-27 20:50