You are on page 1of 37

This workbook holds the latest version of our implementation of FMRG, which can be used via the formula

=RANDOM()

This is the random function, using FMRG This is Excel RAND()


#MACRO? 0,572011928

Hit F9 to recalculate

This is the NormalRandom function using FMRG with mean 0, SD 2


#VALUE!
This is the NormalRandom function using FMRG with mean 100, SD 50
#VALUE!

Sorting Routine: Original Data to be Sorted by column 2 Sorted Output


100 39 6666 109 36 1111
101 38 3333 102 37 2222
102 37 2222 101 38 3333
109 36 1111 100 39 6666
a the formula =RANDOM()
http://www.vbapi.com/articles/64bit/

------------------------------------------------------------------------

Faking 64-bit Integers

Introduction

Usually, the intrinsic Visual Basic data types are sufficient to read information from and send information to API functions. The two most i
However, 32 bits of integer data are not always enough. For some functions, a 64-bit integer data type is necessary to encompass the en

The Currency Data Type

Fortunately, all is not lost! Visual Basic has the Currency data type. The Currency data type was initially created by the designers of Visu
Internally, the Currency data type actually is a 64-bit integer. However, Visual Basic scales down by a factor of 10,000 to produce four dig

Example

Here is an example of how the Currency data type can be used to display a 64-bit integer retrieved from an API function. The GetDiskFre
After retrieving the information from the function, the following code copies it into a Currency-type variable. Then, after multiplying it by 1
Dim userbytes As ULARGE_INTEGER ' bytes free to user
Dim totalbytes As ULARGE_INTEGER ' total bytes on disk
Dim freebytes As ULARGE_INTEGER ' free bytes on disk
Dim tempval As Currency ' display buffer for 64-bit values
Dim retval As Long ' return value of function

' Get information about the C: drive.


retval = GetDiskFreeSpaceEx("C:\", userbytes, totalbytes, freebytes)
' Copy totalbytes into the Currency data type.
CopyMemory tempval, totalbytes, 8
' Multiply by 10000 to move Visual Basic's decimal point to the end of the actual number.
tempval = tempval * 10000
' Display the total number of bytes on C:.
Debug.Print "Free Space on the C: drive:"; tempval; "bytes"

Manipulating 64-bit Integers

Although you may be storing a true 64-bit integer inside a Currency data type, Visual Basic believes there is a decimal point inside the va

Addition and Subtraction

No conversion factor is necessary to add or subtract 64-bit integers from one another. Simply add or subtract Currency types as you wou

Multiplication

When multiplying two 64-bit integers in Currency form, you must multiply the result by 10,000 to move the decimal point to the proper pla
product = 10000 * first * second

Division

Like multiplication, division of two 64-bit integers in Currency form requires a correction factor. However, in this case, the quotient must b
quotient = dividend / divisor / 10000

Limitations
Although using the Currency data type to "fake" 64-bit integer support in Visual Basic should work in most cases, there remains the prob
Of course, this limitation does not apply to 64-bit integers that do not need to be displayed for the user. The Currency data type itself can
Back to the Article list.

------------------------------------------------------------------------
Last Modified: XXUPDATEXX
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/articles/64bit/index.html
ion to API functions. The two most important and frequently used data types are String and Long, which is a 32-bit integer data type. Since Windows is
e is necessary to encompass the entire range of possible information. The ULARGE_INTEGER structure used by the API stores such a 64-bit integer b

ally created by the designers of Visual Basic to allow precise computations to be made on monetary values. The Single and Double floating-point data t
a factor of 10,000 to produce four digits after the decimal point. So, although the data type is a 64-bit integer, Visual Basic will display the value of any C

om an API function. The GetDiskFreeSpaceEx reports all of its data as 64-bit integers. For disk space, 32-bit integers are too small; otherwise, the func
iable. Then, after multiplying it by 10000 to move Visual Basic's decimal point, the free space of drive C: is properly stated.

here is a decimal point inside the value whether you want one there or not. Therefore, you must take care when performing some arithmetic operations

subtract Currency types as you would any other data type values.

e the decimal point to the proper place. However, if you wait to multiply by 10,000 until after you calculate the initial product, it is very possible that you

ver, in this case, the quotient must be divided by 10,000. To minimize internal rounding off of significant digits, you should divide by 10,000 only after ca
most cases, there remains the problem of data range. Because the value must be multiplied by 10,000 to display properly, values at the extremes of th
er. The Currency data type itself can store the entire 64-bit range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Note, however, that
nteger data type. Since Windows is a 32-bit operating system, it almost exclusively uses 32-bit integers throughout its API.
he API stores such a 64-bit integer by separating it into high-order and low-order halves of 32 bits each. This format is, sadly, not convenient for actuall

gle and Double floating-point data types are insufficient because they can only support a limited number of significant digits. Beyond that number of dig
Basic will display the value of any Currency-type variable as having a decimal point followed by four digits. Therefore, in order to display a 64-bit value

rs are too small; otherwise, the function would be limited to hard drives having a total storage space of less than 4.0 GB. Clearly, this is too small for m

rforming some arithmetic operations on true 64-bit values. This involves moving the decimal point to preserve the actual integer, instead of the value Vi

product, it is very possible that you will have lost part of the calculation due to internal rounding off. Therefore, to multiply two 64-bit integers in Currenc

hould divide by 10,000 only after calculating the initial quotient. To divide two 64-bit integers in Currency form, use the following formula:
operly, values at the extremes of the 64-bit integer range will cause an Overflow error if you try to display them. Thus, the Currency form of 64-bit integ
6,854,775,807. Note, however, that at these extremes, the methods presented earlier for multiplying and dividing these values may fail. They depend o
is, sadly, not convenient for actually reading the data in the structure. To easily read and write to these structures, a 64-bit integer data type is necessa

nt digits. Beyond that number of digits, some rounding occurs. The Currency data type combines the exactness of integer data types with a few fixed d
re, in order to display a 64-bit value copied into the variable correctly, you must first multiply the variable by 10,000. This will shift the decimal point four

0 GB. Clearly, this is too small for modern disks!

ctual integer, instead of the value Visual Basic believes you are storing inside of it.

ultiply two 64-bit integers in Currency form, use the following formula:

he following formula:
us, the Currency form of 64-bit integers in Visual Basic has a display range from -372,036,854,775,808 to 372,036,854,775,807. So while you cannot us
ese values may fail. They depend on having the "extra room" available in the storage space that may not be present past the trillions. Again, however, d
a 64-bit integer data type is necessary. And alas, Visual Basic has no true 64-bit integer data type.

nteger data types with a few fixed decimal places to allow subdivisions of a currency unit (such as a cent).
This will shift the decimal point four places to the right, resulting in the display of the actual value.
854,775,807. So while you cannot use the full range of 64-bit values, nevertheless these fake 64-bit integers greatly extend the range offered by the intr
t past the trillions. Again, however, despite these limitations, using the Currency data type as a pseudo-64-bit integer data type makes it significantly ea
extend the range offered by the intrinsic 32-bit data type.
er data type makes it significantly easier to use those API functions that, like GetDiskFreeSpaceEx, use 64-bit values in their parameters.
s in their parameters.
Variable Var1 52 52
Number Obs 10000 Histogram of Var1
Number Non-missing 10000
Number Missing 0
Number of Unique values 10000
Mean 0,0
SD 5,0
Min -5,0
25th Percentile -3,6
Median -1,5
75th Percentile 1,8
Max 46,2

-5 5 15 25 35 45

Data Source: Sheet1!$B$2:$B$10001


Note: Class intervals include the left endpoint, but not the right endpoint.
45
-5 0
-5 1835
-4 1835
-4 1455
-3 1455
-3 1181
-2 1181
-2 1003
-1 1003
-1 865
0 865
0 706
1 706
1 587
2 587
2 437
3 437
3 321
4 321
4 312
5 312
5 242
6 242
6 207
7 207
7 166
8 166
8 119
9 119
9 80
10 80
10 91
11 91
11 63
12 63
12 61
13 61
13 52
14 52
14 38
15 38
15 24
16 24
16 28
17 28
17 24
18 24
18 19
19 19
19 14
20 14
20 11
21 11
21 9
22 9
22 10
23 10
23 3
24 3
24 5
25 5
25 5
26 5
26 5
27 5
27 4
28 4
28 2
29 2
29 2
30 2
30 2
31 2
31 3
32 3
32 5
33 5
33 0
34 0
34 0
35 0
35 2
36 2
36 0
37 0
37 0
38 0
38 0
39 0
39 0
40 0
40 0
41 0
41 0
42 0
42 0
43 0
43 0
44 0
44 1
45 1
45 0
46 0
46 1
47 1
47 0
Results of Monte Carlo Simulation
Sample Simulation
Number $B$66 Stats
1 -0,629 1000 repetitions
2 -1,833 1 seconds Summary Statistics
3 -0,911 Average -0,039
4 -0,01 SD 1,3860
5 0,39 Max 6,338
6 -6,08 Min -9,162
7 0,79
8 -0,14 Histogram of $B$66
9 1,52
10 -1,04
11 -1,745
12 0,643
13 -0,447
14 0,549
15 0,269
16 0,645
17 -0,338
18 1,571
19 -1,399
20 -0,572 -9,5 -7,5 -5,5 -3,5 -1,5 0,5
21 0,745
22 0,276
23 0,064
24 0,943
25 1,115
26 -1,418
27 -2,269
28 -0,165
29 -0,878
30 0,772
31 -0,178
32 0,553
33 -0,886
34 -1,492
35 3,117
36 0,941
37 0,366
38 -0,340
39 1,689
40 -0,032
41 0,519
42 -0,546
43 -1,098
44 0,707
45 0,681
46 1,646
47 -1,525
48 1,640
49 1,021
50 2,157
51 2,010
52 0,066
53 0,565
54 -0,553
55 0,099
56 0,333
57 1,550
58 -0,620
59 0,943
60 -2,380
61 1,699
62 0,815
63 0,770
64 -1,860
65 -1,363
66 -1,344
67 -1,514
68 -0,433
69 -1,581
70 -0,956
71 2,169
72 1,232
73 1,578
74 1,356
75 -0,946
76 -0,206
77 -0,968
78 0,301
79 0,745
80 -0,137
81 -0,757
82 -1,987
83 -0,025
84 -0,047
85 1,343
86 -0,838
87 -0,871
88 -0,621
89 -1,107
90 -0,385
91 0,863
92 1,399
93 -0,015
94 0,830
95 -0,314
96 -1,705
97 -0,049
98 -0,365
99 1,333
100 -0,034
Only the first 100 repetitions are displayed on this worksheet.
mmary Statistics Notes

Histogram of $B$66

7,5 -5,5 -3,5 -1,5 0,5 2,5 4,5 6,5


0
0,129032 0
0,258065 3
0,387097 4
0,516129 8
0,645161 4
0,774194 9
0,903226 9
1,032258 12
1,16129 8
1,290323 3
1,419355 6
1,548387 7
1,677419 6
1,806452 6
1,935484 2
2,064516 5
2,193548 2
2,322581 3
2,451613 2
2,580645 1
2,709677 0
2,83871 0
2,967742 0
3,096774 0
3,225806 0
3,354839 0
3,483871 0
3,612903 0
3,741935 0
3,870968 0
4 0
0 $B$66

-9,5 0
-9,5 1
-9 1
-9 0
-8,5 0
-8,5 1
-8 1
-8 0
-7,5 0
-7,5 0
-7 0
-7 0
-6,5 0
-6,5 1
-6 1
-6 0
-5,5 0
-5,5 2
-5 2
-5 2
-4,5 2
-4,5 2
-4 2
-4 6
-3,5 6
-3,5 8
-3 8
-3 9
-2,5 9
-2,5 19
-2 19
-2 50
-1,5 50
-1,5 89
-1 89
-1 136
-0,5 136
-0,5 199
0 199
0 174
0,5 174
0,5 127
1 127
1 71
1,5 71
1,5 48
2 48
2 21
2,5 21
2,5 11
3 11
3 10
3,5 10
3,5 6
4 6
4 3
4,5 3
4,5 2
5 2
5 1
5,5 1
5,5 0
6 0
6 1
6,5 1
6,5 0
This sheet documents and demonstrates two array functions which generate correlated normal random variables.

Function BiVarNormal(mean1 As Double, SD1 As Double, mean2 As Double, SD2 As Double, rho As Double) As Variant
Function MultivarNormal(nvars As Integer, corrRange As Range, meansRange As Range, SDsrange As Range) As Variant
The functions are volatile.
MultivarNormal requires ranges as input.
corrRange contains the correlation matrix for the random variables--only the lower triangular part is used.
meansRange contains the vector of means.
SDsRange contains the vector of SDs.
Both meansRange and SDsRange must be column vectors.
The output is a row vector.
Up to 256 correlated normals are allowed. As n increases, so does computation time. Since the function is
volatile, it recalculates every time you make a change to the Excel sheet. This can slow things down considerably.
One remedy is to use Tools:Options:Calculation to set calculation to manual.

Error handling:
We guard against negative SDs.
We guard against correlations which are greater than 1.
For Multivar, there is an error message box that warns if the variance-covariance matrix isn't positive definite and no
In Multivar, we check to see that all the diagonal entries are 1.
We check to see that the arrays all have the proper dimensions.
Examples

Bivar: #VALUE! #VALUE! #VALUE! I use the GetFormula macro to indicate what these formulas

Multivar: #VALUE! #VALUE! #VALUE! #VALUE!

CorrRange MeansRangeSDsRange
1 0 1
0,2 1 10 1
0,3 0,4 1 100 1

Using the BiVarNormal and MultiVarNormal functions:

Run MCSim.xla on the Output Testing cells to see that they match the user input.

BiVarNormal MultiVarNormal
corrRange meansRange SDsRange
{=BiVarNormal(0, 1, 0, 2, 0.9)} 1 0 1
0,9 1 10 1
0,1 0,5 1 20 1

x1 x2 x1 x2 x3 An important note on creating this table:


#VALUE! #VALUE! #VALUE! #VALUE! #VALUE! (1) We selected cells E47 to G47.
(2) Then we copied the formula into the formula
#VALUE! #VALUE! #VALUE! #VALUE! #VALUE!
(3) We then made the references absolute rathe
#VALUE! #VALUE! #VALUE! #VALUE! #VALUE! relative. Thus the formula reads:
#VALUE! #VALUE! #VALUE! #VALUE! #VALUE! =MultivarNormal(3,$E$41:$G$43,$H$41:$H$43
that is it includes the dollar signs.
(4) Then we hit ctrl-shift-enter.
(5) Then we filled down the 3 cells E47 to G47 in
the formulas into rows 48 to 59. The absolute re
meant that the formulas always referred to the s
correlation matrix, means and SD vectors.
An important note on creating this table:
(1) We selected cells E47 to G47.
(2) Then we copied the formula into the formula
(3) We then made the references absolute rathe
relative. Thus the formula reads:
=MultivarNormal(3,$E$41:$G$43,$H$41:$H$43
#VALUE! #VALUE! #VALUE! #VALUE! #VALUE! that is it includes the dollar signs.
#VALUE! #VALUE! #VALUE! #VALUE! #VALUE! (4) Then we hit ctrl-shift-enter.
#VALUE! #VALUE! #VALUE! #VALUE! #VALUE! (5) Then we filled down the 3 cells E47 to G47 in
#VALUE! #VALUE! #VALUE! #VALUE! #VALUE!
the formulas into rows 48 to 59. The absolute re
meant that the formulas always referred to the s
#VALUE! #VALUE! #VALUE! #VALUE! #VALUE!
correlation matrix, means and SD vectors.
#VALUE! #VALUE! #VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE! Another solution would be to name the ranges c
#VALUE! #VALUE! #VALUE! correlation matrix, means and SD vectors.
#VALUE! #VALUE! #VALUE!

Output Testing Output Testing


r #VALUE! 1 #VALUE! #VALUE!
#VALUE! 1 #VALUE! #VALUE!
#VALUE! #VALUE! 1 #VALUE! #VALUE!
ndom variables.

As Double) As Variant
nge As Range) As Variant

gular part is used.

own considerably.

x isn't positive definite and no results are produced.

indicate what these formulas contain

e on creating this table:


ls E47 to G47.
the formula into the formula box.
he references absolute rather than
ormula reads:
$E$41:$G$43,$H$41:$H$43,$I$41:$I$43)
e dollar signs.
-shift-enter.
own the 3 cells E47 to G47 in order to get
ws 48 to 59. The absolute reference
mulas always referred to the same
means and SD vectors.
e on creating this table:
ls E47 to G47.
the formula into the formula box.
he references absolute rather than
ormula reads:
$E$41:$G$43,$H$41:$H$43,$I$41:$I$43)
e dollar signs.
-shift-enter.
own the 3 cells E47 to G47 in order to get
ws 48 to 59. The absolute reference
mulas always referred to the same
means and SD vectors.

ould be to name the ranges containing the


means and SD vectors.
4 mar 97 Added SDModule

16 mar 97 Added Max and Min to SDModule with passing arguments

12 apr 97 Added Matrix Routines module

10 mai 97 Added Blank Row Deleter module

17 mai 97 Added SumStats as alternative to BasicFour to SDModule


' This routine doesn't dimension the variables:data, mean, SD, Min, Max
' so can be used when these variables aren't doubles.

5 mar 98 Changed Qsort code to accept Long instead of Integer

29 mai 98 Changed Function pivotValue to deal with Qsort's problems with already sorted lists
Old version of Function is pivotValueOld.
I've written a revision to Function pivotValue in the random number and sorting module. The old version is
stored as Function pivotValueOld in case we need to go back to it. I've tested my revision and it seems to
I didn't time it, but I think that it's slower because of extra steps in the new version (finding the median of th

The old version very mechanically picked a pivot value (the value which is used to divide the list in two
--everything bigger goes into one list, everything smaller into another). This caused problems for lists that

The new version takes as the pivot value the median of three numbers, x(left), x (right), and x(middle)
where x() is the list being sorted and left is the first element of the list, right is the last and middle is in the m

E.g. if you are currently sorting x(50) through x(100) the pivot value would be based on the median of
x(50), x(100) and x(75). The function actually returns an integer. Suppose
x(50) = 1000
x(75) = 1200
x(100) = 995.
Then x(50) is the median value and the function would return 50.
Qsort then takes x(50) as the value which it will use as the value to make a partition of the original set.
The key code is here
p = pivotValue(x, l, r, M) [the function I revised]
If (p <> -1) Then [when p = -1, there's nothing to sort, so don't do what follows]
pv = x(p, M) [this would make pv = 1000 in my example above]
Call MyPartition(x, l, r, pv, k, n, M) [this reorders the list to put to the left everything
below 1000 and to the right everything above 1000]

All this is nicely explained along with a helpful diagram in Mark Allen Weiss, Data Structures and Algorithm
1994, Benjamin/Cummings, pp. 267-270. The MyPartition subroutine seems to follow Weiss's section 7.7.
FH

9 iun 98 Further refinements are to check to be sure that the pivot value is the larger one if there 2 of the 3 values in
method are equal, and to reject the method in favor of the original one in PivotValueOld if all 3 values are e
7-Feb-2004
Changed NORMALRANDOM to force use of FMRG and allow SD=0
You must provide mean and SD. SD=0 can be used.

19-Oct-2004 Give Endpoints These are Mean, Var, & SD:


Added function to draw from a uniform with given mean and SD. 1 Mean 5,5
10 Var 6,75
Added function for uniform between a and b SD 2,598076211
Give Mean and SDThese are Endpoints
This is the UniformBetween(a,b) function 0 -1,73205081
#VALUE! -1 1,732050808

This is the Uniform(Mean, SD) function


#VALUE!

Another example of Uniform


#VALUE!
25 oct 04 Note we need to add a lower bound on the vector to some of these RNG routines!
Added Tdist function and TRNG vector
Tdraw(df) #VALUE!
TRNG(Trand() as Double, DF as Integer)
Added UniformRNG routine
Sub UniformRNG(UniformRand() As Double, MEAN As Double, SD As Double)

28 oct 04
Added (quasi) Exponential functions.
Function Expo(Mean As Double, SD As Double) As Double
Sub ExponentialRNG(ExponentialRand() As Double, Mean As Double, SD As Double)
Generates a vector of quasi-exponential RVs with desired mean and double
These are just rescaling and shifts of the Exponential(lambda=1) random variable.
17 febr 05
Fixed problem with NORMALRANDOM--it was accepting negative SDs.
Same problem with Expo
Same problem with NORMALRANDOM
NORMALRANDOM #VALUE! #VALUE!
Expo #VALUE! #VALUE!
Uniform #VALUE! #VALUE!
28 mar 05
Added Histogram Module to Random.xls.
The code contains a fix for the problem when Width is zero. This occurs when the variable is constant.
The problem is fixed by making the Width= 1. That width can be changed in the two histogram case.
FH
17 iun 05
Added
Function BiVarNormal(mean1 As Double, SD1 As Double, mean2 As Double, SD2 As Double, rho As Double) As Variant
Function MultivarNormal(nvars As Integer, corrRange As Range, meansRange As Range, SDsrange As Range) As Variant
in Functions module.
These functions enable draws from bi- and multivariate normal distributions.
See the sheet CorrelatedRVs for more.
7 iul 05
Added more explanation to correlated RVs sheet.
Added MultiVarNormalTester macro.
Confirmed that MutliVarNormal worked with n=256.

5 mar 06
Added the array function LINESTA: usage is just like LINEST except it runs regression using only Y > 0 values (as in, for example, a censore

15 mar 06
Added the array functions RandomSample(PopRange, n, WithoutReplacement? Optional, Default is True) and RandomSampleNV (the non-
Hit F9 to recalculate and see the function in action. Click on one of the cells to see the function arguments.
Draw from Draw from
2nd column 2nd and 3rd
w/o columns w/o
Population replacement replacement
1 10 100 #VALUE! #VALUE! #VALUE!
2 20 200 #VALUE! #VALUE! #VALUE!
3 30 300 #VALUE! #VALUE! #VALUE!
4 40 400 #VALUE!

Draw from
2nd column
w/o
replacement
NV version
#VALUE! Hitting F9 does not change this function
#VALUE! To force a recalculation, hit CTRL-ALT-F9
#VALUE! Use MCSimNV with this version of the function
#VALUE!

To use these functions, you must have this workbook open and use the formula "=RANDOM.XLS!RandomSample(cellrangeofpopulation,sam
The RANDOM.XLS part of the formula tells Excel where to find the function (i.e., in this open workbook).
For permament access to the function in another workbook, execute Alt-F11 and drag the Functions module from this workbook to your work

18 apr 06
Added the array functions Function MultivarXs(nvars, nobs, corrRange, meansRange , SDsrange) and MultivarXsV (the volatile version of th

nvars is the number of variables


nobs is the number of observations
corrRange gives the correlation matrix
meansRange gives the means
SDRange gives the SDs
Example with 10 observations and 3 variables.
corrRange =MultivarXs(3, 10, A127:C129, A131:A133, B131:B133)
1 #VALUE! #VALUE! #VALUE!
0,3 1 #VALUE! #VALUE! #VALUE!
0,5 0,6 1 #VALUE! #VALUE! #VALUE!
meansRange Sdsrange #VALUE! #VALUE! #VALUE!
10 10 #VALUE! #VALUE! #VALUE!
20 40 #VALUE! #VALUE! #VALUE!
300 10 #VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
Average #VALUE! #VALUE! #VALUE! Average
SD pop #VALUE! #VALUE! #VALUE! SD pop

Correlation Matrix
#VALUE!
#VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!

These functions are limited by the limits of LINEST. That means that one cannot produce more than 16 variables.
8 iun 06
Added logit and probit functions
x y logit probit
-1 1 #VALUE! #VALUE! #VALUE! #VALUE!
-0,9 1 #VALUE! #VALUE! #VALUE! #VALUE!
-0,8 1 #VALUE! #VALUE! #VALUE! #VALUE!
-0,7 1
-0,6 1 Hit F9 repeatedly, with perfect classification, probit gives #VALUE, but logit does not.
-0,5 1 'The functions are
-0,4 1 ' =logit(xRange, yRange, Optional 0/1 for Intercept with 1 as default)
-0,3 0 ' =probit(xRange, yRange, Optional 0/1 for Intercept with 1 as default)
-0,2 1 'Example
-0,1 0 ' =logit(A2:C101,D2:D101) is the same as =logit(A2:C101,D2:D101,1)

24 aug 06
Modified LINESTA function to handle missing values (either blank cells or with periods, ".")
Example: =LINESTA(YRange, XRange, 0/1 for constant, 0/1 for stats, Optional 1, 1 is default) to run regression on Y>0 values
Example: =LINESTA(YRange, XRange, 1 for constant, 1 for stats, 2) to run regression with on data with missing values (either blank cells or
x y when Y or X is missing, LINEST fails LINESTA with YType parameter set equal to
1 1 Err:502 Err:502 #VALUE! #VALUE!
2 Err:502 Err:502 #VALUE! #VALUE!
3 . Err:502 Err:502 #VALUE! #VALUE!
4 4 Err:502 Err:502 #VALUE! #VALUE!
5 5 Err:502 Err:502 #VALUE! #VALUE!

2 mar 07
Corrected error inVecMatVecMult routine
For i = 1 To n
xtemp(i, 1) = X(i) This said X(1) instead of X(i)
Next i
ng module. The old version is
d my revision and it seems to sort successfully.
rsion (finding the median of three, described below)

sed to divide the list in two


caused problems for lists that have already been sorted.

), x (right), and x(middle)


the last and middle is in the middle.

based on the median of

artition of the original set.

n't do what follows]

o put to the left everything

Data Structures and Algorithm Analysis in C++,


to follow Weiss's section 7.7.2 Partitioning Strategy.

one if there 2 of the 3 values in the median of three


otValueOld if all 3 values are equal.

Used Quadratic Formula


Endpoints Check
1
10
Using RAND to be in the interval
0,793884157

of these RNG routines!

s Double) As Variant
e As Range) As Variant

(as in, for example, a censored Y model)

RandomSampleNV (the non-volatile version of the function)


Draw from all
3 columns
WITH
replacement
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!

ple(cellrangeofpopulation,samplesize)" in another workbook.

m this workbook to your workbook.

rXsV (the volatile version of this function)

=MultivarXsNV(3, 10, A127:C129, A131:A133, B131:B133)


#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!

Correlation Matrix
#VALUE!
#VALUE! #VALUE!
#VALUE! #VALUE! #VALUE!
UE, but logit does not.

n on Y>0 values
ng values (either blank cells or periods)
YType parameter set equal to 2, ignores the missing data in the blank (or with periods) Y or X cells
click on a cell to the left to see the LINESTA formula

You might also like