I wonder if it is somehow possible to model the regression coefficient of a sum as a function of the sum's elements by any transformation of the model/the regressors.
If you ask yourself what the idea behind this is, you can imagine for example the effectiveness of advertising. Spending money in advertising results in a certain effect on the outcome (e.g. sales). But there is no "the" advertising since you spend money in different advertising channels like TV, print, digital etc.
Assume that our outcome is generated as ${\bf y} = \alpha + {\bf Adv} {\boldsymbol \beta}+ {\bf \boldsymbol \gamma} {\bf CV} + {\boldsymbol \epsilon}$, where ${\bf Adv}$ is a matrix of the channel-specific spendings in the different advertising channels and ${\bf CV}$ are some other variables that may correlate with both ${\bf y}$ and the advertising spendings. If I now regress the outcome on the sum of the advertising spendings, my $\beta$ for the sum of the spendings, i.e. the aggregated effect of the channel-specific spendings, is the weighted average of the individual betas weighted by the variance of the corresponding regressor.
This can be easily shown:
set.seed(2409)
n <- 1000 #number of observations
k <- 5 #number of regressors
beta <- rnorm(k, 5, 5) #true regression coefficients
var <- round(runif(k, 0.1, 10)) #variance of the regressors
coef <- numeric()
#this for loop runs the data generation and regression analysis 10,000 times
#and saves the regression coefficient
for (i in 1:10000){
x <- matrix(NA, n, k)
for (l in 1:k){
x[,l] <- rnorm(n, 0, sqrt(var[l]))
}
sumX <- rowSums(x)
y <- 2 + x%*%beta + rnorm(n,0,0.1)
model <- summary(lm(y~sumX))
coef[i] <- model$coefficients[2]
}
#this is the mean of the regression coefficients
mean(coef)
[1] 5.632283
#this is the weighted average of the true coefficients weighted by the
#variance of the regressors
beta%*%var/sum(var)
[,1]
[1,] 5.6326
I now wonder if there is any way to estimate the aggregated effect (i.e. the effect of the sum of the regressors) and the contribution of the sum elements to the aggregated effect in one model by any type of interactions. Coming back to the advertising example, we would be interested, for example, which channels in particular influence the overall advertising effectiveness and how exactly (strong / weak? positive / negative?). Of course, this is interesting to know because a realloction of the budget can lead to a higher overall effectiveness of advertising.
Of course there are also other applications for this. Imagine, for example, that you know how many units of a product you have distributed in total and how this number of units affects a certain success measure. But you also know exactly how many united you have distributed to e.g. which supermarket. Of course, it could make sense to distribute more to the markets that have a strong contribution to the overall effect and less to the markets with a weaker or even negative contribution.
I really hope, I could make my question clear and I am looking forward to your ideas!