R/Thin.R

Defines functions Thin

Documented in Thin

###########################################################################
# Thin                                                                    #
#                                                                         #
# The purpose of the Thin function is to facilitate the thinning of a     #
# matrix of posterior samples.                                            #
###########################################################################

Thin <- function(x, By=1)
     {
     ### Initial Checks
     if(!is.matrix(x)) x <- as.matrix(x)
     rownum <- nrow(x)
     By <- abs(round(By))
     if(By > rownum) stop("By exceeds number of rows in x.")
     ### Thin
     keeprows <- which(rep(1:By, len=rownum) == By)
     z <- x[keeprows,]
     return(z)
     }

#End

Try the LaplacesDemon package in your browser

Any scripts or data that you put into this service are public.

LaplacesDemon documentation built on July 9, 2021, 5:07 p.m.