If I have more than 2 variables related to the services of many places, and it is assigned an evaluation to each variable for each place, how can get by a matrix, the result of the mean value of the data.
I'm not sure if I got your question right. Do you want the mean by groups/places or just the grand mean?
Anyway, the answer is almost the same: you need a Projection matrix in order to calculate these means (which are, in fact, projections). This is the same as doing multiple linear regression.
Supose you have 4 groups/places (a categorical variable with 4 categories) and 3 continuous variables with informations obtained from individuals from these places.
1 - The first thing to do is to create dummy variables for 3 of those places (lefting one out).
2 - Then you bind them together to form a matrix (with dimentions n x 3). Let's call this matrix X
3 - Add a constant column (just ones) in the first column (now X dimensions are n x 4)
4 - Now take those three continuous variables and bind them together as columns of another matrix -- and let's call it Y (which has dimensions n x 3).
5 - Do the following:
B = ((X'X)^1)X'Y
(Where X' is the transpose of X -- and (X'X)^1 is the inverse of X'X. )
Now you will have a matrix of coeficients -- B (which is 4 x 3). The means you want are just linear combinations of these coeficients.
6 - So, build the following matrix:
A = | 1 0 0 0 |
| 1 1 0 0 |
| 1 0 1 0 |
| 1 0 0 1 |
7 - Do the following matrix multiplication:
AB
Now you will get a 4 x 3 matrix with the results you want. Each line represents a place/group (there were 4 groups) and column brings the variable means (there was 3 variables). You could do that in just one step, by multiplying A((X'X)^1)X'Y
If you want just the grand mean (instead of mean by places/groups) of each variable, replace X by just a columns of ones and just do ((X'X)^1)X'Y -- there is no need to go further and use A.