Annotation of OpenXM/src/R/r-packages/hgm/man/hgm.Rhgm.Rd, Revision 1.2
1.2 ! takayama 1: % $OpenXM: OpenXM/src/R/r-packages/hgm/man/hgm.Rhgm.Rd,v 1.1 2014/03/25 02:25:26 takayama Exp $
1.1 takayama 2: \name{hgm.Rhgm}
3: \alias{hgm.Rhgm}
4: %- Also NEED an '\alias' for EACH other topic documented here.
5: \title{
6: The function hgm.Rhgm performs the holonomic gradient method (HGM)
7: for a given Pfaffian system and an initial value vector.
8: }
9: \description{
10: The function hgm.Rhgm performs the holonomic gradient method (HGM)
11: for a given Pfaffian system and an initial value vector
12: with the deSolve package in R.
13: }
14: \usage{
15: hgm.Rhgm(th0, G0, th1, dG.fun, times=NULL, fn.params=NULL)
16: }
17: %- maybe also 'usage' for other objects documented here.
18: \arguments{
19: \item{th0}{ A d-dimensional vector which is an initial point of the parameter vector th (theta).}
20: \item{G0}{
21: A r-dimensional vector which is the initial value of the vector G
22: of the normalizing constant and its derivatives.
23: }
24: \item{th1}{
25: A d-dimensional vector which is the target point of th.
26: }
27: \item{dG.fun}{
28: dG.fun is the ``right hand sides'' of the Pfaffian system.
29: It is a d*r-dimensional array.
30: }
31: \item{times}{a vector; times in [0,1] at which explicit estimates for G are desired.
32: If time = NULL, the set {0,1} is used, and only the final value is returned.
33: }
34: \item{fn.params}{
35: fn.params: a list of parameters passed to the function dG.fun.
36: If fn.params = NULL, no parameter is passed to dG.fun.
37: }
38: }
39: \details{
40: The function hgm.Rhgm computes the value of a holonomic function
41: at a given point, using HGM.
42: This is a ``Step 3'' function (see the reference below),
43: which can be used for an arbitrary input, in the HGM framework.
44: Efficient ``Step 3'' functions are given for some distributions
45: in this package.
46:
47: The Pfaffian system assumed is
48: d G_j / d th_i = (dG.fun(th, G))_{i,j}
49:
50: The inputs of hgm.Rhgm are the initial point th0, initial value G0, final point th1,
51: and Pfaffian system dG.fun. The output is the final value G1.
52:
53: If the argument `times' is specified, the function returns a matrix,
54: where the first column denotes time, the following d-vector denotes th,
55: and the remaining r-vector denotes G.
56: % \code{\link[RCurl]{postForm}}.
57: }
58: \value{
59: The output is the value of G at th1. The first element of G is the normalizing
60: constant.
61: }
62: \references{
63: \url{http://www.math.kobe-u.ac.jp/OpenXM/Math/hgm/ref-hgm.html}
64: }
65: \author{
66: Tomonari Sei
67: }
1.2 ! takayama 68: %\note{
! 69: %%% ~~further notes~~
! 70: %}
1.1 takayama 71:
72: %% ~Make other sections like Warning with \section{Warning }{....} ~
73:
1.2 ! takayama 74: %\seealso{
! 75: %%%\code{\link{oxm.matrix_r2tfb}}
! 76: %}
1.1 takayama 77: \examples{
78: # Example 1.
79: # A demo program; von Mises--Fisher on S^{3-1}
80:
81: G.exact = function(th){ # exact value by built-in function
82: c( sinh(th[1])/th[1], cosh(th[1])/th[1] - sinh(th[1])/th[1]^2 )
83: }
84:
85: dG.fun = function(th, G, fn.params=NULL){ # Pfaffian
86: dG = array(0, c(1, 2))
87: sh = G[1] * th[1]
88: ch = G[2] * th[1] + G[1]
89: dG[1,1] = G[2] # Pfaffian eq's
90: dG[1,2] = sh/th[1] - 2*ch/th[1]^2 + 2*sh/th[1]^3
91: dG
92: }
93:
94: th0 = 0.5
95: th1 = 15
96:
97: G0 = G.exact(th0)
98: G0
99:
100: G1 = hgm.Rhgm(th0, G0, th1, dG.fun) # HGM
101: G1
102:
103: G1.exact = G.exact(th1)
104: G1.exact
105:
106: #
107: # Example 2.
108: #
109: hgm.Rhgm.demo1()
110:
111: }
112: % Add one or more standard keywords, see file 'KEYWORDS' in the
113: % R documentation directory.
114: \keyword{ Normalization constant }
115: \keyword{ Holonomic gradient method }
116: \keyword{ HGM }
117:
118:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>