sampleGlobalErrorVarianceOneIteration: Sample one iteration of the (inverse gamma) global variance...

View source: R/variance.R

sampleGlobalErrorVarianceOneIterationR Documentation

Sample one iteration of the (inverse gamma) global variance model

Description

Sample one iteration of the (inverse gamma) global variance model

Usage

sampleGlobalErrorVarianceOneIteration(residual, dataset, rng, a, b)

Arguments

residual

Outcome class

dataset

ForestDataset class

rng

C++ random number generator

a

Global variance shape parameter

b

Global variance scale parameter

Value

None

Examples

X <- matrix(runif(10*100), ncol = 10)
y <- -5 + 10*(X[,1] > 0.5) + rnorm(100)
y_std <- (y-mean(y))/sd(y)
forest_dataset <- createForestDataset(X)
outcome <- createOutcome(y_std)
rng <- createCppRNG(1234)
a <- 1.0
b <- 1.0
sigma2 <- sampleGlobalErrorVarianceOneIteration(outcome, forest_dataset, rng, a, b)

stochtree documentation built on April 4, 2025, 2:11 a.m.