Skip to contents

ts_prepdata performs centering and similarity score and set attribute prepared to TRUE ts_centering centers the variables before use. ts_simij calculates the similarity scores before use.

Usage

ts_centering(cov)

ts_prep_dep(cov)

ts_simij(cov, min = NULL, max = NULL)

ts_prepdata(ccovar)

Arguments

cov

numeric, behavioral scores of actors

min

numeric, minimum value of behavioral scores of actors. If NULL the empirically observed minimum is used.

max

numeric, maximum value of behavioral scores of actors. If NULL the empirically observed maximum is used.

ccovar

data frame with named time-constant covariates.

Details

I really need to update the dataprep part, so to have behavioral dependents ccovars and time varying covars.

Examples

ts_centering(cov=df_ccovar1[,"cov1"])
#>  [1] -0.3  0.7 -0.3  0.7 -0.3  0.7 -0.3 -0.3 -0.3 -0.3
#> attr(,"mean")
#> [1] 0.3
ts_simij(cov=df_ccovar1[,"cov2"])
#>  [1]  2  2  3  1  3  0  2  5  2 -4
#> attr(,"simMean")
#> [1] 0.7234568
#> attr(,"range")
#> [1] 9
#> attr(,"range2")
#> numeric(0)
#> attr(,"simij")
#>            [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
#>  [1,]        NA 1.0000000 0.8888889 0.8888889 0.8888889 0.7777778 1.0000000
#>  [2,] 1.0000000        NA 0.8888889 0.8888889 0.8888889 0.7777778 1.0000000
#>  [3,] 0.8888889 0.8888889        NA 0.7777778 1.0000000 0.6666667 0.8888889
#>  [4,] 0.8888889 0.8888889 0.7777778        NA 0.7777778 0.8888889 0.8888889
#>  [5,] 0.8888889 0.8888889 1.0000000 0.7777778        NA 0.6666667 0.8888889
#>  [6,] 0.7777778 0.7777778 0.6666667 0.8888889 0.6666667        NA 0.7777778
#>  [7,] 1.0000000 1.0000000 0.8888889 0.8888889 0.8888889 0.7777778        NA
#>  [8,] 0.6666667 0.6666667 0.7777778 0.5555556 0.7777778 0.4444444 0.6666667
#>  [9,] 1.0000000 1.0000000 0.8888889 0.8888889 0.8888889 0.7777778 1.0000000
#> [10,] 0.3333333 0.3333333 0.2222222 0.4444444 0.2222222 0.5555556 0.3333333
#>            [,8]      [,9]     [,10]
#>  [1,] 0.6666667 1.0000000 0.3333333
#>  [2,] 0.6666667 1.0000000 0.3333333
#>  [3,] 0.7777778 0.8888889 0.2222222
#>  [4,] 0.5555556 0.8888889 0.4444444
#>  [5,] 0.7777778 0.8888889 0.2222222
#>  [6,] 0.4444444 0.7777778 0.5555556
#>  [7,] 0.6666667 1.0000000 0.3333333
#>  [8,]        NA 0.6666667 0.0000000
#>  [9,] 0.6666667        NA 0.3333333
#> [10,] 0.0000000 0.3333333        NA
ts_simij(cov=df_ccovar1[,"cov2"], min=-5, max=5)
#>  [1]  2  2  3  1  3  0  2  5  2 -4
#> attr(,"simMean")
#> [1] 0.7511111
#> attr(,"range")
#> [1] 10
#> attr(,"range2")
#> numeric(0)
#> attr(,"simij")
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
#>  [1,]   NA  1.0  0.9  0.9  0.9  0.8  1.0  0.7  1.0   0.4
#>  [2,]  1.0   NA  0.9  0.9  0.9  0.8  1.0  0.7  1.0   0.4
#>  [3,]  0.9  0.9   NA  0.8  1.0  0.7  0.9  0.8  0.9   0.3
#>  [4,]  0.9  0.9  0.8   NA  0.8  0.9  0.9  0.6  0.9   0.5
#>  [5,]  0.9  0.9  1.0  0.8   NA  0.7  0.9  0.8  0.9   0.3
#>  [6,]  0.8  0.8  0.7  0.9  0.7   NA  0.8  0.5  0.8   0.6
#>  [7,]  1.0  1.0  0.9  0.9  0.9  0.8   NA  0.7  1.0   0.4
#>  [8,]  0.7  0.7  0.8  0.6  0.8  0.5  0.7   NA  0.7   0.1
#>  [9,]  1.0  1.0  0.9  0.9  0.9  0.8  1.0  0.7   NA   0.4
#> [10,]  0.4  0.4  0.3  0.5  0.3  0.6  0.4  0.1  0.4    NA