Hello Community,
I am trying to figure out a tricky calculation with mata: First, I need to raise a non-integer number. namely 2.71282, to the power of each cell of a vector [1,2]. For illustration purposes, lets say I have a vector with the values 0.5 and 3.5 and now I want Stata to compute 2.71282^0.5 and 2.71282^3.5 and store the results yet again in a new matrix. In reality my vector contains 60 cells; that is why I would love some automatization here. In a second step I am raising each cell of the new vector to the power of 0.5. So both steps somehow resemble each other, however I am failing at both
I am a stata-beginner and originally inteded to go through the vector with the foreach command but I just don't know how to access the individual cells of the vector.
I would be extremely grateful if someone could give me a hint!
Thank a lot and Kind regards,
Mascha
I am trying to figure out a tricky calculation with mata: First, I need to raise a non-integer number. namely 2.71282, to the power of each cell of a vector [1,2]. For illustration purposes, lets say I have a vector with the values 0.5 and 3.5 and now I want Stata to compute 2.71282^0.5 and 2.71282^3.5 and store the results yet again in a new matrix. In reality my vector contains 60 cells; that is why I would love some automatization here. In a second step I am raising each cell of the new vector to the power of 0.5. So both steps somehow resemble each other, however I am failing at both
I am a stata-beginner and originally inteded to go through the vector with the foreach command but I just don't know how to access the individual cells of the vector.
I would be extremely grateful if someone could give me a hint!
Thank a lot and Kind regards,
Mascha
Comment