用python 模拟GARCH 随机过程

import matplotlib.pyplot as plt  
import scipy as sp
sp.random.seed(12345)
n=1000          # n is the number of observations
n1=100          # we need to drop the first seveal observations
n2=n+n1         # sum of two numbers
alpha=(0.1,0.3)     # GARCH (1,1) coefficients alpha0 and alpha1, see Equation (3)
beta=0.2
errors=sp.random.normal(0,1,n2)
t=sp.zeros(n2)
t[0]=sp.random.normal(0,sp.sqrt(a[0]/(1-a[1])),1)

for i in range(1,n2-1):
    t[i]=errors[i]*sp.sqrt(alpha[0]+alpha[1]*errors[i-1]**2+beta*t[i-1]**2)

y=t[n1-1:-1]   # drop the first n1 observations
#title('GARCH (1,1) process')
x=range(n)
plt.plot(x,y)

  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值