dmt                  package:mnormt                  R Documentation

_M_u_l_t_i_v_a_r_i_a_t_e _t _d_i_s_t_r_i_b_u_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     The probability density function, the distribution function and
     random number generation for the multivariate t  probability
     distribution

_U_s_a_g_e:

     dmt(x, mean = rep(0, d), S, df=Inf, log = FALSE) 
     pmt(x, mean = rep(0, length(x)), S, df=Inf, ...) 
     rmt(n = 1, mean = rep(0, d), S, df=Inf) 
     sadmvt(df, lower, upper, mean, S, maxpts = 2000 * d, abseps = 1e-06, releps = 0) 
     biv.nt.prob(df, lower, upper, mean, S)

_A_r_g_u_m_e_n_t_s:

       x: for 'dmt', this is either a vector of length 'd'  or a matrix
          with 'd' columns, where 'd=ncol(S)', giving the coordinates
          of the point(s) where the density must be evaluated; for
          'pmt', only a vector of length 'd' is allowed, and 'd' cannot
          exceed 20

    mean: a numeric vector representing the location parameter of the
          distribution (equal to the expected value when 'df>1'); it
          must be of length 'd', as defined above

       S: a positive definite matrix representing the  scale matrix of
          the distribution, such that 'S*df/(df-2)' is the
          variance-covariance matrix  when 'df>2';  a vector of length
          1 is also allowed  (in this case, 'd=1' is set)

      df: degrees of freedom; it must be a positive integer for 'pmt',
          'sadmvt' and 'biv.nt.prob',  otherwise a positive number.  If
          'df=Inf' (default value), the corresponding '*mnorm' function
          is called, unless 'd=2'; in this case 'biv.nt.prob' is used,
          If  'biv.nt.prob' is called with 'df=Inf', it returns the
          probability of a rectangle assigned by a bivariate normal
          distribution

     log: a logical value; if 'TRUE',  the logarithm of the density is
          computed 

     ...: parameters passed to 'sadmvt',  among 'maxpts', 'absrel',
          'releps' 

       n: the number of random  numbers to be generated

   lower: a numeric vector of lower integration limits of  the density
          function; must be of maximal length 20;  '+Inf' and '-Inf'
          entries are allowed 

   upper: a numeric vector of upper integration limits  of the density
          function; must be of maximal length 20;  '+Inf' and '-Inf'
          entries are allowed 

  maxpts: the maximum number of function evaluations  (default value:
          '2000*d')

  abseps: absolute error tolerance (default value: '1e-6')

  releps: relative error tolerance (default value: '0')

_D_e_t_a_i_l_s:

     If 'd>2', 'pmt' is computed by a suitable call to  'sadmvt'; if
     'd=2', a call to 'biv.nt.prob' is used; if 'd=1', then 'pt' is
     used. The functions 'sadmvt' and 'biv.nt.prob' are interfaces to 
     Fortran-77  routines by Alan Genz, and available from his web
     page;  they makes uses of some auxiliary  functions whose authors
     are  documented in the Fortran code. The routine 'sadmvt' uses an
     adaptive  integration method. The routine 'biv.nt.prob' is
     specific for the bivariate case; if 'df<1' or 'df=Inf', it
     computes the bivariate  normal distribution function using a
     non-iterative method described in a reference given below.

_V_a_l_u_e:

     'dmt' returns a vector of density values (possibly
     log-transformed); 'pmt' and 'sadmvt' return a single probability
     with  attributes giving details on the achieved accuracy; 'rmt'
     returns a matrix of 'n' rows of random vectors

_N_o_t_e:

     The attributes 'error' and 'status' of the probability returned by
     'pmt' and 'sadmvt' indicate whether the function  had a normal
     termination, achieving the required accuracy. If this is not the
     case, re-run the function with an higher value of 'maxpts'

_A_u_t_h_o_r(_s):

     Fortran code of 'SADMVT' and most auxiliary functions by Alan
     Genz, some additional auxiliary functions by people referred to
     within his  program.  Porting to R and additional R code by
     Adelchi Azzalini

_R_e_f_e_r_e_n_c_e_s:

     Genz, A.:  Fortran code in files 'mvt.f' and 'mvtdstpack.f' 
     available at <URL:
     http://www.math.wsu.edu/math/faculty/genz/software/> 

     Dunnett, C.W. and Sobel, M. (1954). A bivariate generalization of
     Student's _t_-distribution with tables   for certain special
     cases. _Biometrika_ 41, 153-169.

_S_e_e _A_l_s_o:

     'dt', 'dmnorm'

_E_x_a_m_p_l_e_s:

     x <- seq(-2,4,length=21)
     y <- 2*x+10
     z <- x+cos(y) 
     mu <- c(1,12,2)
     Sigma <- matrix(c(1,2,0,2,5,0.5,0,0.5,3), 3, 3)
     df <- 4
     f  <- dmt(cbind(x,y,z), mu, Sigma,df)
     p1 <- pmt(c(2,11,3), mu, Sigma, df)
     p2 <- pmt(c(2,11,3), mu, Sigma, df, maxpts=10000, abseps=1e-8)
     x  <- rmt(10, mu, Sigma, df)
     p  <- sadmvt(df, lower=c(2,11,3), upper=rep(Inf,3), mu, Sigma) # upper tail
     #
     p0 <- pmt(c(2,11), mu[1:2], Sigma[1:2,1:2], df=5)
     p1 <- biv.nt.prob(5, lower=rep(-Inf,2), upper=c(2, 11), mu[1:2], Sigma[1:2,1:2])
     p2 <- sadmvt(5, lower=rep(-Inf,2), upper=c(2, 11), mu[1:2], Sigma[1:2,1:2]) 
     c(p0, p1, p2, p0-p1, p0-p2)

