楼主: nsjwzx2022
347 0

[数据求助] 时间序列可以用bbotstrap 吗? [推广有奖]

  • 1关注
  • 4粉丝

已卖:858份资源

院士

89%

还不是VIP/贵宾

-

威望
10
论坛币
26366 个
通用积分
214.4455
学术水平
0 点
热心指数
1 点
信用等级
0 点
经验
15104 点
帖子
1131
精华
0
在线时间
225 小时
注册时间
2022-8-16
最后登录
2026-1-17

楼主
nsjwzx2022 发表于 2025-7-16 19:06:25 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
可以,但不能直接套用 i.i.d 自助法。  
时间序列存在自相关和依赖结构,简单重抽样会破坏时序关系。正确做法是用专门的时间序列自助法(Time-series Bootstrap)。下面给出 4 种常用方案、适用场景、Stata/Python 命令模板以及实现要点。

---

✅ 1 残差自助(Residual Bootstrap)  
思路:先拟合模型(AR/ARIMA/回归),再对残差做 i.i.d 重抽样,把新残差加回拟合值,生成新序列。  
适用:AR(p)、ARIMA、线性回归模型。  
Stata  
```stata
1. 拟合 AR(1)
arima y, ar(1)
predict e, residuals
predict yhat, xb
2. 残差自助 B=999 次
bootstrap _b, reps(999) seed(123) saving(ar1_boot, replace): ///
    arima y, ar(1)
```
Python  
```python
from statsmodels.tsa.arima.model import ARIMA
import numpy as np
model = ARIMA(y, order=(1,0,0)).fit()
e = model.resid
y_hat = model.fittedvalues
B = 999
y_star = np.empty((len(y), B))
for b in range(B):
    e_star = np.random.choice(e, size=len(e), replace=True)
    y_star[:,b] = y_hat + e_star
```

---

✅ 2 区块自助(Block Bootstrap)  
思路:把序列切成连续块,随机重抽块后拼接,保留局部依赖结构。  
变体:  
- 移动块(Moving Block)  
- 环形块(Circular Block)  
- 平稳块(Stationary Block,块长随机几何分布)  

Stata(需安装 `tsbootstrap` 用户包)  
```stata
net install tsbootstrap, from("https://raw.githubusercontent.com/sergiocorreia/stata-tsbootstrap/master/")
tsbootstrap y, block(l(8)) reps(999) seed(123) clear
```
Python  
```python
from arch.bootstrap import MovingBlockBootstrap, CircularBlockBootstrap, StationaryBootstrap
bs = StationaryBootstrap(8, y)   # 期望块长=8
for data in bs.bootstrap(999):
    y_star = data[0][0]
```

---

✅ 3 筛法自助(Sieve Bootstrap)  
思路:用高阶 AR(∞) 近似任意线性过程,对其残差重抽样。  
适用:未知或非线性依赖结构,但仍以线性 AR 为骨架。  
Stata(无官方命令,可自编):  
```stata
用高阶 AR 近似
varsoc y, maxlag(12)
local p = r(p)
reg y L(1/`p').y
predict e, residuals
重抽样同方案1
```

---

✅ 4 频域自助(Frequency-Domain Bootstrap)  
思路:对傅里叶系数重抽样,再逆变换回时域,避免选块长度难题。  
适用:长记忆、周期序列。  
Python(简略示例)  
```python
import numpy.fft as fft
D = fft.fft(y)
idx = np.random.choice(len(D), len(D), replace=True)
D_star = D[idx]
y_star = fft.ifft(D_star).real
```

---

⚠️ 注意事项  
| 问题 | 解决方案 |
|---|---|
| 非平稳序列 | 先差分或去趋势,再自助 |
| 异方差 | 残差自助改用 Wild Bootstrap(乘以 ±1 随机权重) |
| 最优块长 | 经验公式 `b ≈ n^(1/3)`,或数据驱动选择(如 `bw.crit` 函数) |

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:bots 时间序列 Trap BOT RAP

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

本版微信群
扫码
拉您进交流群
GMT+8, 2026-1-24 18:47