c.grmforest: Combine GRM Forests

View source: R/grmforest.R

c.grmforestR Documentation

Combine GRM Forests

Description

Merges two or more grmforest objects grown on the same data and formula into a single forest. This makes it straightforward to grow an ensemble in chunks – across separate sessions, or across nodes of a compute cluster – and assemble the pieces afterwards for a single call to varimp().

Usage

## S3 method for class 'grmforest'
c(...)

Arguments

...

Two or more grmforest objects.

Details

Because out-of-bag membership is stored as row indices into the shared data, merging requires no realignment: the indices from each contributing forest remain valid in the combined object. The forests must have been grown on data frames with the same number of rows and on an identical formula, which is checked.

If you grow chunks separately, give each chunk a different seed, otherwise every chunk will contain the same trees.

Value

A single grmforest object containing all trees.

See Also

grmforest for GRM Forests, varimp calculates the variable importance for GRM Forest

Examples


library(grmtree)
library(hlt)
  data("asti", package = "hlt")
  asti$resp <- data.matrix(asti[, 1:4])

  f1 <- grmforest(resp ~ gender + group, data = asti,
                  control = grmforest.control(n_tree = 5, seed = 1))
  f2 <- grmforest(resp ~ gender + group, data = asti,
                  control = grmforest.control(n_tree = 5, seed = 2))
  big <- c(f1, f2)
  print(big)


grmtree documentation built on Sept. 2, 2026, 1:07 a.m.