Title
Functions for Monte Carlo integration with stratified antithetic sampling with rpnfcn()
Syntax
Command name Argument
&MCatnode() &ab
&MCatwt() &ab
&tlMCatnode() &a
&tlMCatwt() NULL
&intres() NULL
Description
These functions are to be used with rpnfcn(). The functions &MCatnode(), &MCatwt(), &tlMCatnode(), and &tlMCatwt() compute nodes and weights for numerical integration based on Monte Carlo with stratified antithetic sampling. The function &intres() computes the result by summing the evaluated nodes multiplied with the weights.
Remarks
&MCatnode() and &tlMCatnode() use the argument vector ab and a, respectively, to set up the nodes based on the matrix of uniformly distributed random variables presumed to be in the current top element of the stack in rpnfcn(). The number of columns of the matrix of uniformly distributed random variables equals the number of strata used in the integration, thus precision is improved when the number of columns is increased. ab must be a matrix with two columns specifying the lower and upper boundary of the integration interval, respectively, while a must be a column vector specifying the lower boundary for the indefinite integral.
Source code
rpnint.mata
Author
Henrik Støvring, Research Unit of General Practice, University of Southern Denmark. Please email hstovring@health.sdu.dk if you have comments, questions or observe any problems.
Also see
Manual: [M] Mata Reference Manual
Online: help for [M-0] mata, Evaluation of algorithm matrix using RPN, RPN stack manipulation functions, RPN binary operators, RPN distribution functions,