BookmarkSubscribeRSS Feed
mawuli_0007
Calcite | Level 5

Please, can anyone help with PROC SSM code for this state space model?

Observation equation:

mawuli_0007_0-1657163093824.png
mawuli_0007_1-1657163093824.png

 

State equation:

mawuli_0007_2-1657163150971.png

 

mawuli_0007_3-1657163150971.png

where

 

mawuli_0007_4-1657163150971.png

 

Parameters:

mawuli_0007_5-1657163343639.png

 

3 REPLIES 3
rselukar
SAS Employee

Hello mawuli_0007,
Assuming that the rho*GDP_t term in the right hand side of your
state equation is, in fact, rho*GDP_(t-1), we can formulate your
model as follows:

Latent 2-dimensional state: alpha_t = (GDP_t, mu)
State equation:
alpha_t = T alpha_(t-1) + eta_t
alpha_1 = delta (i.e., both elements diffuse)

Where the 2-dimensional transition matrix is (displayed row-wise)
T = (rho 1-rho; 0 1).
eta_t is two-dimensional white noise with diagonal covariance
(sigma_sq_g, 0).
Note that your mu parameter is treated as a latent state in this
formulation
Even though you don't mention it, I will assume that the parameter
rho is a damping factor, i.e., 0 <= rho <= 1.

Let epsilon_t denote 2-dimensional white noise with full covariance matrix.
Then your observation equations are:
GDP_lt = alpha_t[1] + epsilon_t[1]
GDP_et = alpha_t[1] + epsilon_t[2]

 

PROC SSM code for this will be something like this:

 

proc ssm data=test;
id time .. ; *specify the time ID with proper interval;
parms rho / lower=0 upper=1;
parms G_sigma / lower=1.e-8;
zero = 0.0;
one = 1.0;
one_minus_rho = 1 - rho;

state alpha(2) t(g) = (rho one_minus_rho zero one)
cov(d)=(G_sigma zero) a1(2);
comp gdp = alpha[1];
comp mu = alpha[2]; *to output the estimated mu;

state noise(2) type=wn cov(g);
comp ep1 = noise[1];
comp ep2 = noise[2];

model gdp_l = gdp ep1;
model gdp_e = gdp ep2;

output out=for press;
run;

 

mawuli_0007
Calcite | Level 5

Hi Secular,

Thank you so much for code sample. You are correct the right hand side is rho*GDP_t-1 and rho < 1. Your code sample run without error, but did not produce any result except input data set information, model summary, and ID variable information. I am trying to replicate a working paper by Aruba et. al. (2013). The paper is entitled Improving GDP Measurement: A Measurement-Error Perspective. They used a slightly different state space representation than your formulation as follows:

 

State equation:

GDP_t = mu(1-rho) + rho*GDP_(t-1) + eta_Gt

 

alpha_t = K + T alpha_(t-1) + eta_t

 

where is K 3 by 1 matrix (displayed row-wise)

K =(mu(1-rho) 0 0)

  

T is 3 by 3 matrix (displayed row-wise)

T=(rho 0 0, 0 0 0, 0 0 0)

 

alpha_t is 3 by 1 matrix (displayed row-wise)

alpha_t = (GDP_t eta_It eta_Et)

 

Observation equation:

GDP_It = GDP_t + eta_It

GDP_Et = GDP_t + eta_Et

 

Y_t = Z alpha_t

 

where Y_t is 2 by 1 matrix (displayed row-wise)

Y_t = (GDP_It GDP_Et)

 

Z is 2 by 3 matrix (displayed row-wise)

Z = (1 1 0, 1 0 1)

 

alpha_t is 3 by 1 matrix (displayed row-wise)

alpha_t = (GDP_t eta_It eta_Et)

 

(eta_Gt, eta_It, eta_Et) ~iidN(0,∑) where

∑ is 3 by 3 matrix (displayed row-wise)

∑ = (sigma_sq_GG 0 0, 0 sigma_sq_II sigma_sq_IE, 0 sigma_sq_EI sigma_sq_EE)

 

 

My difficulty is with the constant K matrix in the state equation as I've not seen any example in the Proc SSM manual with the K matrix.

 

 

rselukar
SAS Employee

You will have to send me your full code (data and program) and the article for me to comment any further.  My email is rajesh.selukar@sas.com

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 776 views
  • 0 likes
  • 2 in conversation