一个变量使用前要先定义
不管是
scale s=5;
vector v=seq(1:6)
matrix m=matrix(v,3,2);
boot=100
我定义 s2=NA*seq(1:boot)
主要是方便除错
如果还有NA,就表示程序有误.
e-views code
epoh 发表于 2011-8-1 18:30
一个变量使用前要先定义不管是scale s=5;vector v=seq(1:6)matrix m=matrix(v,3,2); boot=100 ...
## End(Not run)
## Not run: sim = mvBEKK.sim(series.count = 3, T = 1000) # simulate a 3 dimensional mgarch model with length of 1000eps = data.frame(sim$eps[[1]], sim$eps[[2]], sim$eps[[3]]) # encapsulateest = mvBEKK.est(eps) # estimate the simulated model ## End(Not run)
## Not run: sim = mvBEKK.sim(series.count = 3, T = 2500) ## End(Not run)
3 NP包 npplreg命令
# EXAMPLE 1 (INTERFACE=FORMULA): For this example, we simulate an# example for a partially linear model, and compare the coefficient# estimates from the partially linear model with those from a correctly# specified parametric model... ## LOAD DATA data(dcc_rets.csv) set.seed(123)=data[,2] n <- 250x1 <- rnorm(n)x2 <- rbinom(n, 5, .3) z1 <- rbinom(n, 2, .3)z2 <- rnorm(n) y <- 1 + x1 + x2 + z1 + sin(z2) + rnorm(n) # First, compute data-driven bandwidths. We override the default# tolerances for the search method as the objective function is# well-behaved (don't of course do this in general). This may take a few# minutes depending on the speed of your computer... bw <- npplregbw(formula=y~x1+ordered(x2)|ordered(z1)+z2, tol=.1, ftol=.1) # Next, compute the partially linear fit pl <- npplreg(bws=bw) # Print a summary of the model...
Q1:read.table,read.csv
回车的都是"data.frame"
研究金融商品孰悉这两个就行了
scan,还可回车list,有兴趣的话请看"帮助"
lngdpq=read.table("lngdpq.txt")
class( lngdpq) #[1] "data.frame"
dcc.rets=read.csv("dcc_rets.csv")
class(dcc.rets) #[1] "data.frame"
Q2:做时间序列分析,都要把读入的数据用命令timeSeries做成时间序列?
非也,用到的机会不多
numeric,matrix,data.frame,最常用
Q3:signalSeries这个命令是什么意思?
详细请看 Insightful\splus80\help\pg.pdf chap 5
在s-plus,create time series有两种
calendar-based and Non-calendar-based(signals)
calendar-based
timeSeries(pos = timeCalendar(d = 1:10, m = 1, y = 1998, format = "%02m/%02d/%Y"), data = data.frame(11:20))
Positions X1
01/01/1998 11
01/02/1998 12
01/03/1998 13
.............
01/10/1998 20
Non-calendar-based:
signalSeries(data = data.frame(x = 11:20),from=1)
Positions x
1 11
2 12
3 13
...........
10 20
Q4:fgarch(ret~1, ~figarch(1,1)) 这一步中这两个弯弯~是什么意思
详细请看帮助
?"~"
A formula is a call (i.e., of mode "call") to the ~ operator
Ex:
lm(Fuel ~ Weight)
lm(Fuel ~ Weight + Disp.)
lm(Fuel ~ Weight - 1) # no intercept
%%%%%%%%%
copulafit.m, statgetargs.m
你的安装方法错误
请参考底下安装Dynare Windows installer
及设好路径
执行时
也请参考Running and editing a Dynare example
http://www.dynare.org/documentation-and-support/quick-start
%%%%%%%%%%%%%%%%%
Starting Dynare (version 4.2.1).
Starting preprocessing of the model file ...
Found 6 equation(s).
Evaluating expressions...done
......
......
THEORETICAL MOMENTS
VARIABLE MEAN STD. DEV. VARIANCE
y 1.0847 0.0897 0.0080
c 0.8065 0.0529 0.0028
k 11.1870 1.2603 1.5883
a 0.0000 0.0340 0.0012
h 0.2917 0.0119 0.0001
b 0.0000 0.0340 0.0012
VARIANCE DECOMPOSITION (in percent)
e u
y 70.30 29.70
c 65.16 34.84
k 55.00 45.00
a 88.20 11.80
h 55.00 45.00
b 17.43 82.57
MATRIX OF CORRELATIONS
Variables y c k a h b
y 1.0000 0.8742 0.8548 0.9563 0.6237 0.7773
c 0.8742 1.0000 0.9704 0.8396 0.1656 0.6138
k 0.8548 0.9704 1.0000 0.7504 0.1739 0.7504
a 0.9563 0.8396 0.7504 1.0000 0.5906 0.5627
h 0.6237 0.1656 0.1739 0.5906 1.0000 0.5906
b 0.7773 0.6138 0.7504 0.5627 0.5906 1.0000
COEFFICIENTS OF AUTOCORRELATION
Order 1 2 3 4 5
y 0.9762 0.9530 0.9303 0.9081 0.8864
c 0.9949 0.9889 0.9819 0.9741 0.9656
k 0.9992 0.9971 0.9937 0.9891 0.9834
a 0.9641 0.9299 0.8973 0.8662 0.8365
h 0.9195 0.8442 0.7739 0.7082 0.6468
b 0.9641 0.9299 0.8973 0.8662 0.8365
Total computing time : 0h00m15s
epoh 发表于 2011-8-4 19:59
你的安装方法错误请参考底下安装Dynare Windows installer 及设好路径执行时也请参考Running and editing a ...
Function definitions are not permitted at the prompt or in scripts.
意思是script 里不能定义函数.
也就是原来demodynfeerror.m
要拆成9个文件
这跟R有很大的不同,使用时要小心.
demodynfeerror.m(pure script)
f_demodynerrorBS_del.m
f_demodynerrorBS_gam.m
......
......
demodynfeerror.rar
%%%%%%%%empiricalCDF
data=xlsread('stockindex.xls','B2:E57');
empiricalCDF(data)
ans =
0.2807 0.3509 0.1754 0.5789
0.8947 0.4737 0.3860 0.2982
0.7719 0.4561 0.8246 0.8070
....................................
....................................
epoh 发表于 2011-8-5 18:04
Function definitions are not permitted at the prompt or in scripts.意思是script 里不能定义函数.也就是 ...
计算:iotalbecoe.xls中所有行的和除以最后一列的和。
例如:K2/sum(K2:K11)
K3/sum(K2:K11)
………
K11/ sum(K2:K11)
Epoh老师,您好!
以上这个计算在matlab中实现计算?要求输出为excel格式。
在附件中。我是在excel中实现计算的,当时我想,要是在matlab中能实现计算,data=xlsread('iotablecoe.xls','B2:K11');
size(data) % 10 10
%你的数据有 10rows,10 columns
%你要取最后一个column,语法如下
data(:,10) %in R data[,10]
%你要取第一个row,语法如下
data(1,:) %in R data[1,]
%取总和
sum(data(1,:))
孰悉了这些指令
你可以自己来的.
别跟R的语法搞混就是了.
epoh 发表于 2011-8-6 14:08
data=xlsread('iotablecoe.xls','B2:K11');size(data) % 10 10 %你的数据有 10rows,10 columns%你 ...
epoh 发表于 2011-7-24 12:12
function u1cor = acf(amat,bmat,shockvar,yvar,dypos);
及impulse.m
由于作者并没对各种参数加予注解
扫码加好友,拉您进群

