Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.9K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Applying estimators on data sets

Posted 10 years ago

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!

enter image description here

Attachments:
POSTED BY: David Niesse
2 Replies

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]]
POSTED BY: Sean Clarke

When programming you should almost always:

  • Define a function
  • After you define a function, always test it against some simple sample input

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

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard