Topic: Utilities

Topic Description:

Basic R utilities used in many packages and functions, such as date and string manipulations, statistical distributions, geometry of lines and distances. The R package date is required for the two data functions.



File: utilities/statistics.r

View File Source Download File No help file available

Function: arrangeParam.llike

Function Description: arrangeParam.llike

Used in likelihood function of a Gibbs sampler. Allows any of a set of parameters to be submitted to metrop1step; whichtest is the index of the parameter to test. If NULL, zero, or NA, it simply returns allparam.

Function Arguments:

ArgumentDefault Value
testparam
allparam
whichtest

Function Source:

arrangeParam.llike=function(testparam,allparam,whichtest)
{
param=allparam
if(whichtest>0 & !is.na(whichtest) & !is.null(whichtest)) param[whichtest]=testparam

return(param)
}


#
#
# arrangeParam.Gibbs
#

#

# Used in the loop of a Gibbs sampler, setting parameters not yet tested (j and above) to previous v
        alue (i-1), # and other parameters (
# This has unfortunate need for the entire matrix allparam, when only row i-1 and row i are needed.
         #

#
#
#

#
#
#

#
arrangeParam.Gibbs=function(i,j,allparam)
{
if(is.null(dim(allparam))) return(allparam[i-1])

param=allparam[i-1,]
if(j>1) param[1:(j-1)]=allparam[i,1:(j-1)]

return(param)
}