Skip to contents

Title

Usage

model_canonical(n, k, ...)

Arguments

n

TODO

k

TODO

...

Arguments passed on to model_mediator_informative

ztheta_0

TODO

ztheta_t

TODO

ztheta_c

TODO

ztheta_tc

TODO

expected_degree

If specified, the desired expected degree of the graph. Specifying expected_degree simply rescales S to achieve this. Defaults to NULL. Do not specify both expected_degree and expected_density at the same time.

Value

TODO

Examples


set.seed(26)

mrdpg <- model_canonical(n = 100, k = 5)

graph <- sample_tidygraph(mrdpg)
graph
#> # A tbl_graph: 100 nodes and 7635 edges
#> #
#> # An undirected multigraph with 1 component
#> #
#> # Node Data: 100 × 7 (active)
#>    name     C1    C2    C3    C4    C5     y
#>    <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1 1      2.75     0     0     0     0 -4.81
#>  2 2      2.64     0     0     0     0 -4.90
#>  3 3      2.60     0     0     0     0 -6.57
#>  4 4      2.59     0     0     0     0 -3.98
#>  5 5      2.47     0     0     0     0 -4.73
#>  6 6      2.34     0     0     0     0 -2.13
#>  7 7      2.12     0     0     0     0 -3.07
#>  8 8      2.10     0     0     0     0 -4.31
#>  9 9      1.94     0     0     0     0 -4.90
#> 10 10     1.68     0     0     0     0 -4.95
#> # ℹ 90 more rows
#> #
#> # Edge Data: 7,635 × 2
#>    from    to
#>   <int> <int>
#> 1     4    16
#> 2    12    15
#> 3     7    13
#> # ℹ 7,632 more rows

m_fit <- nodelm(US(A, 5) ~ . - name - y - 1, graph = graph)
o_fit <- nodelm(y ~ . - name - 1 + US(A, 5), graph = graph)

m_fit
#> 
#> Call:
#> stats::lm(formula = formula, data = data)
#> 
#> Coefficients:
#>     1         2         3         4         5       
#> C1   0.03059  -0.03385   0.04635   0.11249  -1.24261
#> C2   1.26626   0.08307  -0.04095  -0.01727   0.01139
#> C3   0.06434  -0.09365   1.23454  -0.12532   0.02745
#> C4   0.04564  -0.17560   0.18478   0.98795   0.08751
#> C5   0.09031  -1.15898  -0.08072  -0.02637   0.01566
#> 
o_fit
#> 
#> Call:
#> stats::lm(formula = formula, data = data)
#> 
#> Coefficients:
#>        C1         C2         C3         C4         C5  US(A, 5)1  US(A, 5)2  
#>   -1.5888     1.8275     0.4448     0.9288     1.5257     0.3891     1.1598  
#> US(A, 5)3  US(A, 5)4  US(A, 5)5  
#>    1.2010    -0.7468     0.2084  
#>