Hello everybody, I have the following mata output on my stata screen.
It is a matrix with two columns and 64 rows. The 64 rows of the matrix are dividen into 4 subgroups, i.e. there are 16 variables separated by quarterly data. The first 4 rows represent the variable A (for first, second, third and fourth quarter) , the next four rows represent the variable B and so on.
What I want to do is, take the average of the first 4 rows (i.e. variable A) of the column y1 and divided by the maximum number of the first 4 rows of the column r1. And i want to do that four each of the 16 soubroups.
For example, for group A would be: ((55,9+55,1+52,7+54,2)/4)/4,22
Also, I can told you that what I need is the variation coefficient, so the column y1 represent the estimate coefficient and r1 is the standard error.
I think that the for value command would help, however I do not how to generate.
For example, I have the following command, however, only take each of the rows and divided by r1 over y1:
forval i = 1/`rows' {
mat CV[`i',1] = 100*sqrt(variances[`i',1])/means[`i',1]
}
mat list CV
I would really appreciate any help.
It is a matrix with two columns and 64 rows. The 64 rows of the matrix are dividen into 4 subgroups, i.e. there are 16 variables separated by quarterly data. The first 4 rows represent the variable A (for first, second, third and fourth quarter) , the next four rows represent the variable B and so on.
What I want to do is, take the average of the first 4 rows (i.e. variable A) of the column y1 and divided by the maximum number of the first 4 rows of the column r1. And i want to do that four each of the 16 soubroups.
For example, for group A would be: ((55,9+55,1+52,7+54,2)/4)/4,22
Also, I can told you that what I need is the variation coefficient, so the column y1 represent the estimate coefficient and r1 is the standard error.
I think that the for value command would help, however I do not how to generate.
For example, I have the following command, however, only take each of the rows and divided by r1 over y1:
forval i = 1/`rows' {
mat CV[`i',1] = 100*sqrt(variances[`i',1])/means[`i',1]
}
mat list CV
I would really appreciate any help.