[R] Constraining parameters using tag() in SUR model - ZELIG
Arne Henningsen
arne.henningsen at gmail.com
Wed Sep 12 23:01:04 CEST 2012
Dear Samantha
I suggest that you directly use the systemfit() command rather than
the wrapper function zelig(). You can impose parameter restrictions
with the arguments "restrict.matrix", "restrict.rhs", and
"restrict.regMat". You can use argument "restrict.matrix" to specify
the restrictions numerically (as a matrix) or symbolically (with
character strings). The (symbolical and numerical) imposition of
parameter restrictions is described in [1], page 18-19 and in the
documentation of systemfit() (with examples in the "Example" section).
Please do not forget to cite systemfit in your publications--no matter
whether you directly use it or through zelig(). Thanks!
[1] http://www.jstatsoft.org/v23/i04/paper
/Arne
On 12 September 2012 20:05, Samantha Azzarello
<samantha.azzarello at cmegroup.com> wrote:
> Hello all,
> I am following some standard code from Zelig manual when using a SUR
> (Seemingly Unrelated Regression Model) to constrain parameters across
> equations.
> Please see code below:
>
> setwd("C:/Research/Economics/SUR_FX/Model")
>
> # Seemingly Unrelated Regression
> # Load our library.
>
> library(Zelig)
> library(systemfit)
> library(zoo)
>
> # data.
>
> factors <- read.table("./RFactors.txt", header = TRUE)
> returns <- read.table("./RReturns.txt", header = TRUE)
>
> myData <- c(factors,returns)
>
> # This is our system of equations.
>
> mySys <- list(mu1 = USDEUR ~ USDRATE + tag(USDYC, "USDYC")+ USDCC + EURRATE
> + EURYC + EURLY,
> mu2 = USDGBP ~ USDRATE + tag(USDYC, "USDYC") + USDCC + GBPRATE + GBPYC +
> GBPLY,
> mu3 = USDCHF ~ USDRATE + tag(USDYC, "USDYC") + USDCC + CHFRATE + CHFYC +
> CHFLY,
> mu4 = USDSEK ~ USDRATE + tag(USDYC, "USDYC") + USDCC + SEKRATE + SEKYC +
> SEKLY,
> mu5 = USDNOK ~ USDRATE + tag(USDYC, "USDYC") + USDCC + NOKRATE + NOKYC +
> NOKLY,
> mu6 = USDJPY ~ USDRATE + tag(USDYC, "USDYC") + USDCC + JPYRATE + JPYYC +
> JPYLY,
> mu7 = USDSGD ~ USDRATE + tag(USDYC, "USDYC") + USDCC + SGDRATE + SGDYC +
> SGDLY,
> mu8 = USDAUD ~ USDRATE + tag(USDYC, "USDYC") + USDCC + AUDRATE + AUDYC +
> AUDLY,
> mu9 = USDCAD ~ USDRATE + tag(USDYC, "USDYC") + USDCC + CADRATE + CADYC +
> CADLY,
> mu10 = USDNZD ~ USDRATE + tag(USDYC, "USDYC") + USDCC + NZDRATE + NZDYC +
> NZDLY)
>
> # Here is our zelig function call.
>
> z.out <- zelig(mySys,"sur", myData)
>
> ------ After this I am getting error:
> Error in eval(expr, envir, enclos) : could not find function "tag"
>
> there exists no info (I could find anyways..) RE installing tag() seperate,
> also tag should be able to be used for the SUR model...
> Any help would be appreciated.
> Thanks
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Constraining-parameters-using-tag-in-SUR-model-ZELIG-tp4642927.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Arne Henningsen
http://www.arne-henningsen.name
More information about the R-help
mailing list