WorksheetFunction Class - Random values from LogInv needed

L

leebean337

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 "Unable to get the LogInv property of
the Worksheet Function class"

Any suggestions?
 
D

Dave Peterson

What are the values in V1 and V2 when that line runs?

V2 better be greater than 0.
 
L

leebean337

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
 
G

Guest

What version of Excel? Try just Application.LogInv(). Version of Excel
prior to 97 did not support the WorksheetFunction keyword.

Jerry
 
D

Dave Peterson

It's been way too long since my last stats course.

But maybe someone will chime in.
 
G

Guest

See Help for LOGINV. You are attempting to calculate EXP(8500+3000*x) where
it should be true that ABS(x)<38.

EXP(8500) is about 12 orders of magnitude larger than the largest number
that Excel can calculate.

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top