Skip to contents

Title

Usage

model_perfect(n, k, ...)

Arguments

n

TODO

k

TODO

...

Arguments passed on to model_mediator_perfect

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_perfect(n = 100, k = 5)

graph <- sample_tidygraph(mrdpg)
graph
#> # A tbl_graph: 100 nodes and 7443 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 -3.01 
#>  2 2      2.64     0     0     0     0 -0.276
#>  3 3      2.60     0     0     0     0 -0.552
#>  4 4      2.59     0     0     0     0 -2.93 
#>  5 5      2.47     0     0     0     0 -3.07 
#>  6 6      2.34     0     0     0     0 -2.99 
#>  7 7      2.12     0     0     0     0 -2.37 
#>  8 8      2.10     0     0     0     0 -3.96 
#>  9 9      1.94     0     0     0     0 -3.56 
#> 10 10     1.68     0     0     0     0 -2.79 
#> # ℹ 90 more rows
#> #
#> # Edge Data: 7,443 × 2
#>    from    to
#>   <int> <int>
#> 1     4     7
#> 2     3     7
#> 3     2     8
#> # ℹ 7,440 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.023484  -0.038665   0.057134   0.165749  -1.233339
#> C2   1.244640   0.069919  -0.034811  -0.018931   0.007211
#> C3   0.053376  -0.095856   1.220764  -0.076513   0.036259
#> C4   0.036883  -0.044968   0.079537   1.229718   0.150697
#> C5   0.081706  -1.243231  -0.087577  -0.032209   0.018624
#> 
o_fit
#> 
#> Call:
#> stats::lm(formula = formula, data = data)
#> 
#> Coefficients:
#>        C1         C2         C3         C4         C5  US(A, 5)1  US(A, 5)2  
#>    1.4778     3.7779     5.2382    -1.0125     1.7915    -1.3699     1.5800  
#> US(A, 5)3  US(A, 5)4  US(A, 5)5  
#>   -2.2410     0.8363     2.0560  
#>