Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
leebean337
 
Posts: n/a
Default WorksheetFunction Class - Random values from LogInv needed


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?


--
leebean337
------------------------------------------------------------------------
leebean337's Profile: http://www.excelforum.com/member.php...o&userid=31099
View this thread: http://www.excelforum.com/showthread...hreadid=507712

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default WorksheetFunction Class - Random values from LogInv needed

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

V2 better be greater than 0.

leebean337 wrote:

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?

--
leebean337
------------------------------------------------------------------------
leebean337's Profile: http://www.excelforum.com/member.php...o&userid=31099
View this thread: http://www.excelforum.com/showthread...hreadid=507712


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
leebean337
 
Posts: n/a
Default WorksheetFunction Class - Random values from LogInv needed


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: http://www.excelforum.com/member.php...o&userid=31099
View this thread: http://www.excelforum.com/showthread...hreadid=507712

  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default WorksheetFunction Class - Random values from LogInv needed

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

But maybe someone will chime in.

leebean337 wrote:

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: http://www.excelforum.com/member.php...o&userid=31099
View this thread: http://www.excelforum.com/showthread...hreadid=507712


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
Jerry W. Lewis
 
Posts: n/a
Default WorksheetFunction Class - Random values from LogInv needed

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

"leebean337" wrote:


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: http://www.excelforum.com/member.php...o&userid=31099
View this thread: http://www.excelforum.com/showthread...hreadid=507712




  #6   Report Post  
Posted to microsoft.public.excel.misc
Jerry W. Lewis
 
Posts: n/a
Default WorksheetFunction Class - Random values from LogInv needed

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

Jerry

"leebean337" wrote:


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?


--
leebean337
------------------------------------------------------------------------
leebean337's Profile: http://www.excelforum.com/member.php...o&userid=31099
View this thread: http://www.excelforum.com/showthread...hreadid=507712


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM
Generate random numbers between two values and with a given mean pinosan Excel Worksheet Functions 2 March 7th 05 02:04 PM
How can I get Positive values only from the random number generat. Markw3700 Excel Discussion (Misc queries) 1 January 21st 05 12:37 AM
Generating Correlated Random Values in Excel Randy Excel Discussion (Misc queries) 2 January 16th 05 09:50 PM


All times are GMT +1. The time now is 07:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"