Hi Stata users,
I have some problems with the calculation of matrix with database. For example, I have a database with 100 variables (x1-x100) and 200 observations. And I have also a matrix with values beta1-beta100, I need to do this calculation:
for each observation, I need to generate a new variable which is: x1*beta1+x2*beta2+x3*beta3+...+x100*beta100. This calculation will be repeated for the 200 observations.
So my question is (1) how to write the code to calculate the above formula, and (2) in a general way, if the number of my matrix values is larger than the number of variables in the database, for example, I have x1-x100 variables, but I have the matrix with values beta1-beta105, x variables could be partly matched to matrix according to their names, how shall I write the code?
Thank you very much.
Related Posts with How to do the calculation of matrix mutiplying database
doiplot - postestimation module after metan for plots that address asymmetry or heterogeneityDear All There is now a post-estimation command after metan to visualize studies in meta-analysis t…
How Can I Perform Panel Unit Root with Structural Breaks Especcially Fourier Panel KPSS TESTı want to briefly explain my data set. I have N:25 T:15 data set. I want to perform Fourier Panel KP…
How to replace dummy by same value of adjacent year for each id observation?Hi my data's dummy 'chaebol' has its value only when year = 2004. How can I replace the value of 199…
catplot - how to show n to the left of the bars, percentages within bars, and mean values outside the bars (to the right)Dear all, I am using the community-contributed command catplot from SSC in Stata 16.1 in order to p…
Identifying first and second re-admissions in a health datasetI am working with Stata/MP 15.1 and have appended two datasets. Database 1 includes a list of patie…
Subscribe to:
Post Comments (Atom)
0 Response to How to do the calculation of matrix mutiplying database
Post a Comment