sas - SAS_STATE SPACE MODELS -
i hope of doing well. have question regarding state space models. know, using these models can compute error variances of irregular component , level component using 1 observable variable. example, assume have 1 variable; price of asser. state space models find level , irregular components of variable. use following codes in order compute that:
proc ucm data = work; model price (price observable variable); irregular plot = smooth; level checkbreak plot = smooth; estimate plot = residual; forecast plot = forecasts lead = 10 alpha = 0.5; run;
my problem is, need find error variances of irregular , level components each group. above mentioned code me find these variances using data of groups. simplicity, explain using simple data. have following datasheet:
group price 0.5 0.4 0.8 0.1 b 0.3 b 0.2 b 0.5
i want following datasheet:
group price error variances of irregular components (irr.c) error variances of level components 0.5 0.1 (assume er.variance of irr.c 0.1) 0.3 (assume er.variance of lev.c 0.3) 0.4 0.1 (assume er.variance of irr.c 0.1) 0.3 (assume er.variance of lev.c 0.3) 0.8 0.1 (assume er.variance of irr.c 0.1) 0.3 (assume er.variance of lev.c 0.3) 0.1 0.1 (assume er.variance of irr.c 0.1) 0.3 (assume er.variance of lev.c 0.3) b 0.3 0.2 (assume er.variance of irr.c b 0.2) 0.1 (assume er.variance of lev.c b 0.1) b 0.2 0.2 (assume er.variance of irr.c b 0.2) 0.1 (assume er.variance of lev.c b 0.1) b 0.5 0.2 (assume er.variance of irr.c b 0.2) 0.1 (assume er.variance of lev.c b 0.1)
i hope can explain issue. sorry misunderstanding.
data work; input group $ price; datalines; 0.5 0.4 0.8 0.1 b 0.3 b 0.2 b 0.5 ; run; proc print data=work; run; ods trace on; ods select parameterestimates; ods output parameterestimates=myestimates; proc ucm data=work; model price; group; irregular plot=smooth; level checkbreak plot=smooth; estimate plot=residual; forecast plot=forecasts lead=10 alpha=0.5; run; proc print data=myestimates; run; proc transpose data=myestimates(keep=group component estimate) out=transposedestimates; group; id component; run; proc print data=transposedestimates; run; proc sql; create table myresults select a.*, b.irregular irregularcomponent, b.level levelcomponent work a, transposedestimates b a.group=b.group; quit; proc print data=myresults; run;
Comments
Post a Comment