I am new to Mathematica and I am facing some problems. I am doing a Monte-Carlo-Simulation. Therefore i programmed estimators and a table of 10.000 data sets. In the next step I am trying to apply my estimator to the data set in order to get the estimated slope of each data set. The problem is that my estimator does not recognise the values in the list as x and y values I think. I hope my problem is easier to understand by having a look at an image of the code.
Has someone a hint of what I am doing wrong? Many thanks already!
There are a lot of way you could define a function like betag1.
The most straightforward and illustrative would be to define it with a helper function, like this:
pairToRatio[{x_, y_}] := y/x; betag1[list_] := Mean[Map[pairToRatio, list]]
When programming you should almost always:
In your code, DGP is a function. It uses the correct syntax and appears to work as you show.
"betag1" is not a function. It does not use the syntax for creating a function. Please try using "betag1" as a function on a simple example. You will see that it doesn't work. Please see the documentation for more information on how to write a function in Mathematica: https://reference.wolfram.com/language/tutorial/DefiningFunctions.html