Title
Examples
set.seed(26)
mblock <- model_mediator_block2(n = 100, k = 15)
graph <- sample_tidygraph(mblock)
graph
#> # A tbl_graph: 100 nodes and 30212 edges
#> #
#> # An undirected multigraph with 1 component
#> #
#> # Node Data: 100 × 16 (active)
#> name intercept trt C01 C02 C03 C04 C05 C06 C07 C08 C09
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 1 0 0 0 0 0 0 0 0 0 0
#> 2 2 1 0 0 0 0 0 0 0 0 0 0
#> 3 3 1 0 0 0 0 0 0 0 0 0 0
#> 4 4 1 0 0 0 0 0 0 0 0 0 0
#> 5 5 1 0 0 0 0 0 0 0 0 0 0
#> 6 6 1 0 0 0 0 0 0 0 0 0 0
#> 7 7 1 0 0 0 0 0 0 0 0 0 0
#> 8 8 1 1 0 0 0 0 0 0 0 0 0
#> 9 9 1 1 0 0 0 0 0 0 0 0 0
#> 10 10 1 1 0 0 0 0 0 0 0 0 0
#> # ℹ 90 more rows
#> # ℹ 4 more variables: C10 <dbl>, C11 <dbl>, C12 <dbl>, C13 <dbl>
#> #
#> # Edge Data: 30,212 × 2
#> from to
#> <int> <int>
#> 1 1 3
#> 2 1 3
#> 3 1 7
#> # ℹ 30,209 more rows
fit <- nodelm(US(A, 5) ~ . - name - 1, graph = graph)
fit
#>
#> Call:
#> stats::lm(formula = formula, data = data)
#>
#> Coefficients:
#> 1 2 3 4 5
#> intercept 0.88191 -1.09034 -0.14746 1.06560 -0.38799
#> trt -0.29636 0.32635 0.12622 -0.43850 0.24574
#> C01 0.37203 -0.86122 0.24443 2.97344 -4.87058
#> C02 6.67505 3.60286 0.19891 -1.64619 0.50415
#> C03 -0.09179 -0.08589 0.30554 0.01138 -0.06579
#> C04 1.17503 -4.93926 6.82207 -4.16883 0.87727
#> C05 -0.29808 0.46053 0.15176 -0.63255 0.31646
#> C06 0.11155 -0.24993 0.11604 0.55818 0.07505
#> C07 -0.23683 0.30210 0.14719 -0.44632 0.33518
#> C08 -0.57152 0.75777 0.10824 -0.80318 0.41562
#> C09 0.16382 -0.51220 0.13522 0.79199 -0.13907
#> C10 0.74689 -3.43246 -5.29718 -3.68149 0.36912
#> C11 0.52058 -1.33066 -0.34457 4.37258 7.13188
#> C12 -0.44757 0.66139 0.11117 -0.69813 0.33769
#> C13 -0.08687 0.09283 0.17312 -0.19566 0.23852
#>