1 year ago

#382691

test-img

chilrai

Stargazer: decrease number of columns to match amount of dependent variables

I have 2 different dependent variables. For each dependent variable, I have 2 independent variables. In total, I have 4 regressions which could be presented in 2 columns. However, when put into the stargazer() -function in R the output is on 4 different columns as follows:

enter image description here

The code string in R used in this is as follows:

Library(datasets)
Library(stats)
#data
data1 <- EuStockMarkets
data1 <- ts(data1)
#lagged values
lags <- lag(data1) 
#whole sample
data <- cbind(data1,lags)
#dependent
x1 <- data[,1]
x2 <- data[,2]
#independent
y1 <- data[,3]
y2 <- data[,4]  
#regressions
reg1 <- lm(x1 ~ y1)
reg2 <- lm(x1 ~ y2)
reg3 <- lm(x2 ~ y1)
reg4 <- lm(x2 ~ y2)
#stargazer
library(stargazer)
stargazer(reg1,reg2,reg3,reg4, type = "text",report = ('vc*t'),omit = c("Constant"),single.row = TRUE, title = "In sample predictability")

Is it somehow possible to summarize the stargazer output to only include 2 columns? Namely in this case (referring to the code attached) x1 and x2.

Thank you in advance!

r

regression

stargazer

0 Answers

Your Answer

Accepted video resources