I am modelling a huge database and I have to create a new variable that contains the value of the diagonal of the current database.
Basically on the x-axis and y-axis I have the same variables and I want to select the interaction term - you can think about it as the variance in the variance-covariance matrix. I have tried with MATA and the function diagonal() but I get errors.
Any help with the code? I would really appreciate it!