Skip to contents

These functions perform calculations on edge matrices containing pairwise information.

Usage

path_weights(edgew, path,  symmetric = TRUE,edge.index=edge_index(edgew),...)
path_cis(edgew, path,edge.index=edge_index(edgew),ci.pos=FALSE)
edge2dist(edgew, edge.index=edge_index(edgew))
dist2edge(d)
edge_index(x, order="default")

Arguments

edgew

A Matrix (or vector) whose ith row (or element) has weights for pair indexed by pair in row i of edge.index. For edge2dist, edgew should be a vector.

path

Vector of indices into rows of edgew.

symmetric

If TRUE edge weights are interpreted as symmetric.

edge.index

A 2-column matrix with each row giving indices for corresponding weight in edgew.

ci.pos

If TRUE, all CIs are mu(max) - mu(min), otherwise mu(right) - mu(left).

d

A dist or matrx of distances.

order

If "low.order.first" or "scagnostics", lists lowest index pairs first, otherwise lists pairs starting with 1, then 2 etc.

x

An edgew matrix or vector, or a positive integer.

...

Ignored

Details

path_weights - Returns matrix of path weights so that the ith row of result contains weights for indices path[i], path[i+1]

path_cis - Returns matrix of path confidence intervals so that the ith row of result contains intervals for mean-path[i] - mean-path[i+1]

edge2dist - Returns a dist, containing elements of edgew.

dist2edge - Returns a vector of edge weights.

edge_index -A generic function. Returns a 2-column matrix with one row for each edge. Each row contains an index pair i,j. If order is "low.order.first" or "scagnostics", lists lowest index pairs first - this is the default ordering for class scagdf, otherwise lists pairs starting with 1, then 2 etc

nnodes - Here edgew contains edge weights for a complete graph; returns the number of nodes in this complete graph.

References

see overview

Author

C.B. Hurley and R.W. Oldford

Examples

require(PairViz)

s <- matrix(1:40,nrow=10,ncol=4)

edge2dist(s[,1])
#>    1  2  3  4
#> 2  1         
#> 3  2  5      
#> 4  3  6  8   
#> 5  4  7  9 10

path_weights(s,1:4)
#>      [,1] [,2] [,3] [,4]
#> [1,]    1   11   21   31
#> [2,]    5   15   25   35
#> [3,]    8   18   28   38
path_weights(s,eseq(5))
#>       [,1] [,2] [,3] [,4]
#>  [1,]    1   11   21   31
#>  [2,]    5   15   25   35
#>  [3,]    2   12   22   32
#>  [4,]    3   13   23   33
#>  [5,]    6   16   26   36
#>  [6,]    7   17   27   37
#>  [7,]    9   19   29   39
#>  [8,]    8   18   28   38
#>  [9,]   10   20   30   40
#> [10,]    4   14   24   34

fm1 <- aov(breaks ~ wool + tension, data = warpbreaks)
tuk <- TukeyHSD(fm1, "tension")[[1]]

# Here the first argument (weight matrix) can have number of columns

path_weights(tuk,c(1:3,1))  
#>           diff       lwr        upr       p adj
#> M-L -10.000000 -19.35342 -0.6465793 0.033626219
#> H-M  -4.722222 -14.07564  4.6311985 0.447421021
#> H-L -14.722222 -24.07564 -5.3688015 0.001121788



# Here the first argument (weight matrix) should have an odd number of columns-
# the first is the mean difference, other column pairs are endpoints of CIs


path_cis(tuk[,-4],c(1:3,1))
#>           diff        lwr        upr
#> M-L -10.000000 -19.353421 -0.6465793
#> H-M  -4.722222 -14.075643  4.6311985
#> L-H  14.722222   5.368801 24.0756429