'Outcome variable not working when changed into a logarithmic function
I am conducting a staggered difference-in-difference analysis utilizing a very large dataset of companies with the outcome variable of profit (gp). This works fine but I now want to change the variable into a logarithmic variable, turning it into a log function titled log_gp_. The problem is that when I try to create a data.frame with the log_gp_ variable it turns over this message:
"Some variables were removed due to low variation, inadequate data needed for calculation: log_gp_"
Do you have any ideas as to why this error occurs and possibly how to fix it?
The following code works fine for me when I have just 'gp' as the covariate but not here as my covariate is 'log_gp'
rev_trends <- data.frame(est = get_covariate_balance(comb$att,
data = new,
covariates = c("log_gp"),
plot = F,
use.equal.weights = F),
time = -6:3)
ggplot(rev_trends, aes(x = time, y = log_gp)) +
geom_line() +
geom_point(size = 1) +
theme_classic() +
#scale_y_continuous(limits = c(0,0.6)) +
scale_x_continuous(breaks = -6:3,
labels = as.character(c(-6:1,
"0\n(Company\nPolitican)"))) +
labs(x = "Years Until Politician",
y = "Profit Gap Between Treatment\nand Control Companies") +
geom_hline(yintercept = 0, lty = 3)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
