[R] Constraining parameters using tag() in SUR model - ZELIG

Samantha Azzarello samantha.azzarello at cmegroup.com
Wed Sep 12 20:05:50 CEST 2012


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.



More information about the R-help mailing list