楼主: ywh19860616
29608 92

[问答] 怎么把这个矩阵保存到excel中 [推广有奖]

81
ywh19860616 发表于 2012-11-17 20:23:07
epoh 发表于 2012-11-17 20:14
哈哈!你忘了你提供的代码,不也是有w

这是在Heavy-tailed才用上
抱歉啊,epoh老师,现在明白了。
谢谢您的指导。
一份耕耘,一份收获。

82
ywh19860616 发表于 2012-11-18 14:10:23
epoh 发表于 2012-11-17 18:55
t-MSV with two-way granger causality:
请注意这次我改同MULTIVARIATE STOCHASTIC VOLATILITY MODELS ...
epoh老师,我想请教下,在您写的代码中
#coda.out1 <- read.coda("c:/Bugs/msv/coda1.txt", "c:/Bugs/msv/codaIndex.txt")
#densplot(coda.out1)
#plot(coda.out1)

plot(coda.out1)这句命令直接同时画出了trace 和density 图,
这个plot只有在library(R2WinBUGS)之后有这个功能,我想问下
如果我现在想分开来画trace和density,所以我想看这个环境下plot
的代码,应该如何查看?
一份耕耘,一份收获。

83
epoh 发表于 2012-11-18 14:31:26
ywh19860616 发表于 2012-11-18 14:10
epoh老师,我想请教下,在您写的代码中
#coda.out1
coda.pdf page 26/44
plot(x, trace = TRUE, density = TRUE, smooth = FALSE, bwf,
     auto.layout = TRUE, ask = dev.interactive(), ...)

#plot trace
   plot(x, trace = TRUE, density = F)
#plot density
   plot(x, trace = F, density = TRUE)
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
ywh19860616 + 5 + 5 + 5 谢谢epoh老师

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

84
ywh19860616 发表于 2012-11-18 14:38:35
epoh 发表于 2012-11-18 14:31
coda.pdf page 26/44
plot(x, trace = TRUE, density = TRUE, smooth = FALSE, bwf,
     auto.layout  ...
太感谢epoh老师,明白了。
一份耕耘,一份收获。

85
zhangtao 发表于 2012-11-20 08:31:44
epoh 发表于 2012-11-18 14:31
coda.pdf page 26/44
plot(x, trace = TRUE, density = TRUE, smooth = FALSE, bwf,
     auto.layout  ...
dccdata.txt (25.87 KB)
epoh老师,您好!
    1、附件中的数据做dccgarch数据太少,您看在R中如何能实现自体抽样扩大
样本数据量,以比较准确地做出dccgarch估计?
    2、如何修改以下程序,用我附件中的dccdata.txt中的数据进行估计?
非常感谢!

# Simulating data from the original DCC-GARCH(1,1) process
  nobs <- 1000; cut <- 1000
  a <- c(0.003, 0.005, 0.001)
  A <- diag(c(0.2,0.3,0.15))
  B <- diag(c(0.75, 0.6, 0.8))
  uncR <- matrix(c(1.0, 0.4, 0.3, 0.4, 1.0, 0.12, 0.3, 0.12, 1.0),3,3)
  dcc.para <- c(0.01,0.98)
  dcc.data <- dcc.sim(nobs, a, A, B, uncR, dcc.para, model="diagonal")

# Estimating a DCC-GARCH(1,1) model
  dcc.results <- dcc.estimation(inia=a, iniA=A, iniB=B, ini.dcc=dcc.para,
        dvar=dcc.data$eps, model="diagonal")

# Parameter estimates and their robust standard errors
  dcc.results$out


数学好就是要天天学

86
epoh 发表于 2013-4-7 20:25:32
ywh19860616 发表于 2012-11-18 14:10
epoh老师,我想请教下,在您写的代码中
#coda.out1
老兄,R package BayesPanel
应该适合你参考.
   http://cran.r-project.org/src/contrib/Archive/BayesPanel/
#####
library(BayesPanel)
library(plm)
data(Gasoline)
est <- BayesPanel(lgaspcar~lincomep+lrpmg+lcarpcap|lincomep,
                     data=Gasoline, index = c("country"),
                     control = list(verbose=10, thin=100) )

Summary Statistics for Posterior Distribution:


The Model Specification is:
BayesPanel(formula = lgaspcar ~ lincomep + lrpmg + lcarpcap |
    lincomep, data = Gasoline, index = c("country"), control = list(verbose = 10,
    thin = 100))


Posterior Estimates of Fixed Effect Coefficients:

Iterations = 1001:10901
Thinning interval = 100
Number of chains = 1
Sample size per chain = 100

1. Empirical mean and standard deviation for each variable,
   plus standard error of the mean:

               Mean      SD Naive SE Time-series SE
(Intercept)  2.1868 0.44051 0.044051       0.044051
lincomep     0.3698 0.11068 0.011068       0.011068
lrpmg       -0.3246 0.04666 0.004666       0.004666
lcarpcap    -0.4641 0.04210 0.004210       0.004210

2. Quantiles for each variable:

               2.5%     25%     50%     75%   97.5%
(Intercept)  1.2418  1.9139  2.2340  2.5018  2.9245
lincomep     0.1246  0.3160  0.3750  0.4464  0.5572
lrpmg       -0.4198 -0.3548 -0.3187 -0.2957 -0.2389
lcarpcap    -0.5451 -0.4930 -0.4646 -0.4355 -0.3859



Posterior Mean Estimates of Random Coefficients:
          (Intercept)     lincomep
AUSTRIA   1.910348096  0.333092578
BELGIUM  -0.215327621 -0.001088742
CANADA    1.152187949  0.090922766
DENMARK  -1.838407500 -0.324946283
FRANCE    0.612314329  0.140129525
GERMANY   1.802215674  0.350771888
GREECE    1.312208989  0.180310358
IRELAND   1.587910877  0.229149729
ITALY     0.004301386  0.040926582
JAPAN    -4.191993903 -0.689216994
NETHERLA -2.400792420 -0.383283336
NORWAY   -0.131194057 -0.004403345
SPAIN    -1.114354594 -0.126608625
SWEDEN    0.258225455  0.032832038
SWITZERL  1.005269013  0.171583757
TURKEY   -2.224410353 -0.353748547
U.K.      1.538322575  0.270546584
U.S.A.    1.592090810  0.174681097


Posterior Estimates of Variance Structure for Random Coefficients:

Iterations = 1001:10901
Thinning interval = 100
Number of chains = 1
Sample size per chain = 100

1. Empirical mean and standard deviation for each variable,
   plus standard error of the mean:

                           Mean      SD Naive SE Time-series SE
(Intercept):(Intercept) 2.86597 1.06173 0.106173       0.153698
lincomep:(Intercept)    0.45888 0.16832 0.016832       0.023458
lincomep:lincomep       0.07573 0.02713 0.002713       0.002824

2. Quantiles for each variable:

                           2.5%     25%     50%     75%  97.5%
(Intercept):(Intercept) 1.51928 2.15398 2.58854 3.32357 5.3332
lincomep:(Intercept)    0.23322 0.34598 0.42955 0.53947 0.8216
lincomep:lincomep       0.03904 0.05631 0.07156 0.09101 0.1302



Posterior Estimates of Variance:

Iterations = 1001:10901
Thinning interval = 100
Number of chains = 1
Sample size per chain = 100

1. Empirical mean and standard deviation for each variable,
   plus standard error of the mean:

          Mean             SD       Naive SE Time-series SE
     0.0087293      0.0007850      0.0000785      0.0000785

2. Quantiles for each variable:

    2.5%      25%      50%      75%    97.5%
0.007159 0.008182 0.008735 0.009255 0.010253


已有 1 人评分学术水平 热心指数 信用等级 收起 理由
ywh19860616 + 5 + 5 + 5 谢谢epoh老师的关注

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

87
ywh19860616 发表于 2013-4-7 20:49:06
epoh 发表于 2013-4-7 20:25
老兄,R package BayesPanel
应该适合你参考.
   http://cran.r-project.org/src/contrib/Archive/Bayes ...
epoh老师,谢谢您
这个package我当时看到了,但是好像因为一些
原因被cran移除了。您怎么还可以使用?哈哈
而且我看没有提供下载到本地安装的zip文件,只有
提供原代码文件。
一份耕耘,一份收获。

88
epoh 发表于 2013-4-7 21:01:19
ywh19860616 发表于 2013-4-7 20:49
epoh老师,谢谢您
这个package我当时看到了,但是好像因为一些
原因被cran移除了。您怎么还可以使用?哈 ...
的确只有原代码,
须要自行下载"Gnu Scientific Library" build package
   BayesPanel_0.1-2.zip (34.83 KB)
已有 2 人评分学术水平 热心指数 信用等级 收起 理由
kk22boy + 5 + 5 + 5 呵呵,服务好到位哦
ywh19860616 + 5 + 5 + 5 非常谢谢您的帮助

总评分: 学术水平 + 10  热心指数 + 10  信用等级 + 10   查看全部评分

89
ywh19860616 发表于 2013-4-7 21:29:51
epoh 发表于 2013-4-7 21:01
的确只有原代码,
须要自行下载"Gnu Scientific Library" build package
好的,非常感谢epoh老师
我先按照您给的codes学习下
一份耕耘,一份收获。

90
ywh19860616 发表于 2013-4-8 10:40:21
epoh 发表于 2013-4-7 21:01
的确只有原代码,
须要自行下载"Gnu Scientific Library" build package
epoh老师,您自行build package可以正常安装,但是
在R2.15.2运行library(BayesPanel)时出现一个错误提示框:
没有找到libgsl-0.dll,因此这个应用程序未能启动。重新安装应用
程序可能会修复此问题。

您是用哪个版本的R软件?
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
epoh + 3 + 3 + 3 好问题

总评分: 学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

一份耕耘,一份收获。

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

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