Hi there
I am trying to create a function that will grab random values from a
given distribution (lognormal and beta in particular). I am currently
using the following code for lognormal:
dblValue = Application.WorksheetFunction.LogInv(Rnd(), v1, v2)
where v1 is my mean and v2 is my standard deviation. But each time I
try to run it, I get the error quot;Unable to get the LogInv property of
the Worksheet Function classquot;
Any suggestions?--
leebean337
------------------------------------------------------------------------
leebean337's Profile: www.excelforum.com/member.php...oamp;userid=31099
View this thread: www.excelforum.com/showthread...hreadid=507712What are the values in V1 and V2 when that line runs?
V2 better be greater than 0.
leebean337 wrote:
gt;
gt; Hi there
gt;
gt; I am trying to create a function that will grab random values from a
gt; given distribution (lognormal and beta in particular). I am currently
gt; using the following code for lognormal:
gt;
gt; dblValue = Application.WorksheetFunction.LogInv(Rnd(), v1, v2)
gt;
gt; where v1 is my mean and v2 is my standard deviation. But each time I
gt; try to run it, I get the error quot;Unable to get the LogInv property of
gt; the Worksheet Function classquot;
gt;
gt; Any suggestions?
gt;
gt; --
gt; leebean337
gt; ------------------------------------------------------------------------
gt; leebean337's Profile: www.excelforum.com/member.php...oamp;userid=31099
gt; View this thread: www.excelforum.com/showthread...hreadid=507712
--
Dave Peterson
Hey,
v1=8500 (mean)
v2=3000 (sd)
I figured out the first part of the problem, that being that my values
are too large and excel can't handle the resulting figures.
Also, when I change v1=ln(8500) and v2=ln(3000) I end up with a result
(and even a decent one!)
But I'm still concerned that I'm not actually suppose to modify my
specified mean and sd. What do you think?
Thanks--
leebean337
------------------------------------------------------------------------
leebean337's Profile: www.excelforum.com/member.php...oamp;userid=31099
View this thread: www.excelforum.com/showthread...hreadid=507712What version of Excel? Try just Application.LogInv(). Version of Excel
prior to 97 did not support the WorksheetFunction keyword.
Jerry
quot;leebean337quot; wrote:
gt;
gt; Hi there
gt;
gt; I am trying to create a function that will grab random values from a
gt; given distribution (lognormal and beta in particular). I am currently
gt; using the following code for lognormal:
gt;
gt; dblValue = Application.WorksheetFunction.LogInv(Rnd(), v1, v2)
gt;
gt; where v1 is my mean and v2 is my standard deviation. But each time I
gt; try to run it, I get the error quot;Unable to get the LogInv property of
gt; the Worksheet Function classquot;
gt;
gt; Any suggestions?
gt;
gt;
gt; --
gt; leebean337
gt; ------------------------------------------------------------------------
gt; leebean337's Profile: www.excelforum.com/member.php...oamp;userid=31099
gt; View this thread: www.excelforum.com/showthread...hreadid=507712
gt;
gt;
It's been way too long since my last stats course.
But maybe someone will chime in.
leebean337 wrote:
gt;
gt; Hey,
gt;
gt; v1=8500 (mean)
gt; v2=3000 (sd)
gt;
gt; I figured out the first part of the problem, that being that my values
gt; are too large and excel can't handle the resulting figures.
gt;
gt; Also, when I change v1=ln(8500) and v2=ln(3000) I end up with a result
gt; (and even a decent one!)
gt;
gt; But I'm still concerned that I'm not actually suppose to modify my
gt; specified mean and sd. What do you think?
gt;
gt; Thanks
gt;
gt; --
gt; leebean337
gt; ------------------------------------------------------------------------
gt; leebean337's Profile: www.excelforum.com/member.php...oamp;userid=31099
gt; View this thread: www.excelforum.com/showthread...hreadid=507712
--
Dave Peterson
See Help for LOGINV. You are attempting to calculate EXP(8500 3000*x) where
it should be true that ABS(x)lt;38.
EXP(8500) is about 12 orders of magnitude larger than the largest number
that Excel can calculate.
Jerry
quot;leebean337quot; wrote:
gt;
gt; Hey,
gt;
gt; v1=8500 (mean)
gt; v2=3000 (sd)
gt;
gt; I figured out the first part of the problem, that being that my values
gt; are too large and excel can't handle the resulting figures.
gt;
gt; Also, when I change v1=ln(8500) and v2=ln(3000) I end up with a result
gt; (and even a decent one!)
gt;
gt; But I'm still concerned that I'm not actually suppose to modify my
gt; specified mean and sd. What do you think?
gt;
gt; Thanks
gt;
gt;
gt; --
gt; leebean337
gt; ------------------------------------------------------------------------
gt; leebean337's Profile: www.excelforum.com/member.php...oamp;userid=31099
gt; View this thread: www.excelforum.com/showthread...hreadid=507712
gt;
gt;
- Nov 18 Sat 2006 20:10
WorksheetFunction Class
close
全站熱搜
留言列表
發表留言