Skip to contents

A Gibbs sampler for updating the multiplicative effect matrices U and V in the symmetric case. In this case U%*%t(V) is symmetric, so this is parameterized as V=U%*%L where L is the diagonal matrix of eigenvalues of U%*%t(V).

Usage

rUV_sym_fc(E, U, V, s2 = 1, shrink=TRUE, l_var = 1)

Arguments

E

square residual relational matrix

U

current value of U

V

current value of V

s2

dyadic variance

shrink

adaptively shrink the factors with a hierarchical prior

l_var

prior variance of an eigen-weight: 1 for a unit response (the default), the variance of the response for a normal response of free scale

Value

U

a new value of U

V

a new value of V

Author

Cassy Dorff, Shahryar Minhas, Tosin Salau

Examples


U0<-matrix(rnorm(30,2),30,2) ; V0<-U0%*%diag(c(3,-2))
E<- U0%*%t(V0) + matrix(rnorm(30^2),30,30)
rUV_sym_fc(E, U0, V0)
#> $U
#>             [,1]        [,2]
#>  [1,] 0.81755904  0.68646564
#>  [2,] 2.04718090  2.68773688
#>  [3,] 3.79000012  3.60648601
#>  [4,] 1.67842978  1.41722198
#>  [5,] 0.45493540  0.32582796
#>  [6,] 0.18481801  0.04833157
#>  [7,] 1.80498360  1.36426152
#>  [8,] 2.05645482  2.08049024
#>  [9,] 1.22081674  0.97682986
#> [10,] 0.94349925  0.92891729
#> [11,] 0.63999241  0.73515033
#> [12,] 0.53010576  0.36566462
#> [13,] 2.21797733  1.76958998
#> [14,] 0.94937921  0.69183414
#> [15,] 0.01403366 -0.17515966
#> [16,] 3.08595163  2.67617396
#> [17,] 2.06521387  1.91738597
#> [18,] 1.18796699  0.79059217
#> [19,] 3.04355195  3.06214410
#> [20,] 2.65511622  2.65716734
#> [21,] 1.27675524  1.28545253
#> [22,] 3.08720175  2.46846029
#> [23,] 2.25297939  2.56414257
#> [24,] 1.08568059  1.35332394
#> [25,] 1.76782981  1.74287880
#> [26,] 1.97036013  1.82712522
#> [27,] 3.51652639  3.12686567
#> [28,] 2.18561429  2.21736609
#> [29,] 1.89911671  1.46691728
#> [30,] 1.45442980  1.25772296
#> 
#> $V
#>              [,1]        [,2]
#>  [1,]  2.45496905 -1.37265354
#>  [2,]  6.14728171 -5.37438629
#>  [3,] 11.38062514 -7.21151284
#>  [4,]  5.03999459 -2.83387056
#>  [5,]  1.36608156 -0.65152409
#>  [6,]  0.55497213 -0.09664359
#>  [7,]  5.42001083 -2.72797106
#>  [8,]  6.17512946 -4.16013871
#>  [9,]  3.66587263 -1.95326449
#> [10,]  2.83314274 -1.85745874
#> [11,]  1.92177137 -1.47000321
#> [12,]  1.59180335 -0.73118129
#> [13,]  6.66014980 -3.53846397
#> [14,]  2.85079910 -1.38338837
#> [15,]  0.04214032  0.35024845
#> [16,]  9.26650594 -5.35126515
#> [17,]  6.20143118 -3.83399616
#> [18,]  3.56723129 -1.58086446
#> [19,]  9.13918806 -6.12304926
#> [20,]  7.97279192 -5.31325959
#> [21,]  3.83384495 -2.57038496
#> [22,]  9.27025981 -4.93592185
#> [23,]  6.76525412 -5.12724769
#> [24,]  3.26008535 -2.70610032
#> [25,]  5.30844532 -3.48505244
#> [26,]  5.91660405 -3.65351119
#> [27,] 10.55943731 -6.25246622
#> [28,]  6.56296997 -4.43383503
#> [29,]  5.70267404 -2.93324105
#> [30,]  4.36736670 -2.51493705
#>