Page 1 of 1

MSVAR in stock return

Posted: Tue May 21, 2019 10:31 am
by fan
Dear Tom,
I am trying to test how the presidential elections can affect the trends in the US stock market. I am thinking the following empirical model: Rt=U(St)+β[Rt-1-U(St-1)]+δ(St)Vt, P(St|St-1)=exp(C+γ1(pre-election_8)+ γ2(post-election_8) /1+ exp(C+γ1(pre-election_8)+ γ2(post-election_8). Pre-election and post-election are the dummy variables if the month is in the specified period before or after an election. Would you please kindly let me know if the model is reasonable to you? Following is my code. Many Thanks

Code: Select all


Set return= 100.0*log(price/price{1})
Compute nlags=1
Compute gstart=1927:1, gend=2019:03
@MSVARSetuo(lags=nlags, switch=mh)
# return
Nolin(parment=common) mu phi sigma
frml loglmsvar = log(%MSVarProb(t))
dec equation p1eq p2eq
dec vector   v1   v2
nonlin(parmset=tv) v1 v2

function %MSPTV time
type rect %MSPTV
type integer time

local rect p(1,2)
compute p(1,1)=%logistic(%eqnvalue(p1eq,time,v1),1.0)
compute p(1,2)=%logistic(%eqnvalue(p2eq,time,v2),1.0)
compute %MSPTV=p
end

@MSPChangeFnc %MSPTV

function TVPInit
type vector TVPInit

compute p=%MSPTV(gstart)
compute TVPInit=%MSVARInit()
end

equation p1eq *
# constant pre_election_8 post_election_8
equation p2eq *
# constant pre_election_8 post_election_8

compute v1=log(.70/(1-.70))*%unitv(%eqnsize(p1eq),1)
compute v2=log(.05/(1-.05))*%unitv(%eqnsize(p2eq),1)

maximize(parmset=tv+common,start=(pstar=TVPInit()),$
pmethod=simplex,piters=10,method=bfgs) loglmsvar gstart gend