*;考虑…;统计;时间序列的例子。从图形你会想到: 数据会是什么样子的, 可能的模式及它们的意义, 可能的预测,如何点图,…… ;Examples: Economic and financial time series Beverage wheat price annual index series from 1500-1864 ;Examples: Economic and financial time series Beverage wheat price annual index series from 1810-1864 ;Examples: Physical time seriesAverage air temperature (deg C) at Recife, Brazil, in successive months from 1953-1962;Examples: Marketing time series Sales of an industrial beater in successive months from January 1965 to November 1971.;Examples: Finance The Percentage of Beijing Residents Long-term Deposit Over the Total Balance;Examples: Process control data;术语;看看这个时间序列Passengers in China’s Airports;看看这个时间序列Passengers in China’s Airports;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;*;状态空间的计算例子;Model (Shumway notation)Transition equation and observation equation;#A Biometrical Example
x=scan(c:/xzwu/2009/berkeley/ts/shumway/mydata/Jones.dat,na=0)
y=matrix(x,91,3);
y=as.data.frame(y)
names(y)=c(log(white blood count),log(platelet),hematocrit(HCT))
par(mfrow=c(3,1))
plot(ts(y[,1]),type=o,ylab=LWC)
plot(ts(y[,2]),type=o,ylab=LP)
plot(ts(y[,3]),type=o,ylab=HCT)
par(mfrow=c(1,1))
;也能有m个时滞(lag),如VAR(m)那样;#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#
#-- assumes ss0 has been sourced --#
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#
# -- Read Data --
y1=scan(c:/xzwu/2009/berkeley/ts/shumway/mydata/HL.dat)
y2=scan(c:/xzwu/2009/berkeley/ts/shumway/mydata/Folland.dat)
# -- Function to Calculate Likelihood --
Linn=function(para){
cQ=para[1] # sigma_w
cR1=para[2] # 11 element of chol(R)
cR2=para[3] # 22 element of chol(R)
cR12=para[4] # 12 element of chol(R)
cR=matrix(c(cR1,0,cR12,cR2),2) # put the matrix together
kf=Kfilter0(num,y,A,mu0,Sigma0,Phi,cQ,cR)
return(kf$like)
}
# -- Setup --
y=cbind(y1,y2) # y is data matrix (108 x 2)
num=nrow(y)
A=matrix(1,2,1) # A is a 2x1 matrix of 1s - same for
原创力文档

文档评论(0)