Geometric mean

How do I find the geometric mean? I do not know the code. Thank you for help!

2 Answers



0



accepted

For a given x, you can calculate the geometric mean with the following code in GAUSS:


>> x = { 5, 20, 40, 80, 100 };
>> g_mu = exp(sumc(ln(x)/rows(x)));
>> g_mu
    31.697864



0



You can simplify it slightly to this:

g_mu = exp(meanc(ln(x)));

Your Answer

2 Answers

0
accepted

For a given x, you can calculate the geometric mean with the following code in GAUSS:


>> x = { 5, 20, 40, 80, 100 };
>> g_mu = exp(sumc(ln(x)/rows(x)));
>> g_mu
    31.697864

0

You can simplify it slightly to this:

g_mu = exp(meanc(ln(x)));

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.