1

I am running a SUR regression with returns of 80 different banks as dependent variables. The independent variables are always the same. You should be able to recreate the regression using the code below, if necessary to answer my questions, which are:

  1. How can I test whether the average of the coefficient for "Event" for all 80 banks in the sample is equal to zero or not?

  2. How can I test whether subgroups in the sample, say the first 20 banks and the last 40 banks, have similar average coeffients for "Event" or if they are significantly different from each other?

    library("systemfit")
    library("plm")
    cyp3 <- read.table("https://pastebin.com/raw.php?i=/SpuUiaj7", sep=";", header=TRUE)
    cyp3panel<-pdata.frame(cyp3, c("id", "t"))
    cyp3sur<-systemfit(returns ~ Price + Pre + Event + Post + Zpre1 + Zevent1 + Zpost1 + Zpre2 + Zevent2 + Zpost2 + Zpre3 + Zevent3 + Zpost3, method = "SUR",data = cyp3panel)
    

Thanks for your help. Let me know if something is missing, please!

Dave13
  • 55
  • 5

1 Answers1

1

For this we may directly use linearHypothesis (see ?linearHypothesis.systemfit). In the first case we have

coefs <- coef(cyp3sur)
R1 <- matrix(0, nrow = 1, ncol = length(coefs))
R1[1, grep("Intercept", names(coefs))] <- 1
linearHypothesis(cyp3sur, R1)

where R1 has a single row since there is a single constraint. Note that I add coefficients 1 rather than 1 / 80 as they are equivalent (X + Y = 0 is the same as (X + Y) / 2 = 0). Using grep allows me to find positions of the intercepts.

Similarly, in the second case we have

R2 <- matrix(0, nrow = 1, ncol = length(coefs))
gr1 <- paste0("X", 1:20, "_Event")
gr2 <- paste0("X", 41:80, "_Event")
R2[1, names(coefs) %in% gr1] <- 1 / 20
R2[1, names(coefs) %in% gr2] <- -1 / 40
linearHypothesis(cyp3sur, R2)

Now I construct the variable names of interest with paste0 and use %in% to determine their position in coefs.

Julius Vainora
  • 47,421
  • 9
  • 90
  • 102
  • Thank you! I have three more questions regarding the second part of your answer: 1. What kind of test is run here? Is it a t-test that compares the means? 2. Why are the coefficients weighted? To correct for different sample size? 3. How would I have to change the code if I wanted to compare for example the 5th, 10th and 13th event coefficient to the 26th, 29th, 30th and 70th instead of the first 20 to the last 40? – Dave13 Jan 26 '19 at 14:15
  • 1
    @Dave13, 1) see the `test` argument in `?linearHypothesis.systemfit` and the Details section below, the default one is Theil's finite-sample F test (with approximate F distribution). 2) I'm weighting them to test exactly what you asked (about average). The hypothesis becomes (Event1 + ... Event20)/20 = (Event41 + ... + Event80)/40. 3) You could set `gr1 <- paste0("X", c(5, 10, 13), "_Event")`, `gr2 <- paste0("X", c(26, 28, 30, 70), "_Event")` and the weights as 1/3 and -1/4. Also note that you already have enough rep to vote on answers (https://stackoverflow.com/help/someone-answers). – Julius Vainora Jan 26 '19 at 14:19