原始数据如下:
代码如下
[LaTex]tsset t *趋势 constraint 1 [trend]L.trend = 1 constraint 2 [trend]L.slope = 1 constraint 3 [slope]L.slope = 1 constraint 4 [Y]A = 1 constraint 5 [Y]B = 1 constraint 6 [Y]C = 1 constraint 7 [Y]trend = 1 sspace (trend L.trend L.slope, state noconstant)(slope L.slope, state noerror noconstant)(Y A B C trend,noconstant), constraints(1/7) covstate(diagonal) predict D1 predict trend, state equation(trend) predict res, residuals local n = floor(3*_N/4) generate int q = quarter(t) twoway (scatter Y t in `n'/L, msymbol(none) mlabel(q) mlabposition(0) ytitle(上感) ylabel(#3)) (tsline D1 trend in `n'/L), nodraw name(G1) tsline res in `n'/L, nodraw name(RES) yline(0) graph combine G1 RES, name(G2) rows(2) graph drop G1 RES tsappend, add(60) predict D1, dynamic(td(12apr2018)) rmse(rftp) scalar z = invnormal(0.95) gen lb = D2 + z*rftp if t>=td(11apr2018) gen ub = D2 - z*rftp if t>=td(11apr2018) tsline D2 if t>=td(11apr2018) || tsrline lb ub if t>=td(11apr2018),xline(`=td(11apr2018)') legend(label(2 "90 \% CI")) name(DYN)[/LaTex]
问题在于我的dynamic()函数更本不能运行出结果,大佬帮帮忙啊 小萌新上路翻车了