Skip to contents

Prints or plots the correlation matrix for a 3-way interaction

Usage

cor.mat.3way(power.results, row.num = 1, return.plot = FALSE)

Arguments

power.results

Data frame of results from power_interaction_3way_r2().

row.num

Which row to show? Can only be a single number. Default is 1.

return.plot

Return a matrix (FALSE, default), or a plot (TRUE)?

Value

A matrix or a ggplot2 object

Examples

power_analysis = power_interaction_3way_r2(detailed_results = TRUE,N = c(1000),
r.x1.y = .2,r.x2.y = .3,r.x3.y = .1,r.x1x2.y = .01,r.x1x3.y = .05,r.x2x3.y = .1,
b.x1x2x3 = 0.1,r.x1.x2 = .1,r.x1.x3 = .1,r.x2.x3 = .1,
rel.x1 = 1,rel.x2 = 1,rel.x3 = 1,rel.y = 1 )
#> Performing 1 analyses
#> Warning: executing %dopar% sequentially: no parallel backend registered
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
cor.mat.3way(power_analysis)
#>                y        x1        x2        x3      x1x2      x1x3      x2x3
#> y      1.0000000 0.2000000 0.3000000 0.1000000 0.0100000 0.0500000 0.1000000
#> x1     0.2000000 1.0000000 0.1000000 0.1000000 0.0000000 0.0000000 0.0000000
#> x2     0.3000000 0.1000000 1.0000000 0.1000000 0.0000000 0.0000000 0.0000000
#> x3     0.1000000 0.1000000 0.1000000 1.0000000 0.0000000 0.0000000 0.0000000
#> x1x2   0.0100000 0.0000000 0.0000000 0.0000000 1.0000000 0.1089109 0.1089109
#> x1x3   0.0500000 0.0000000 0.0000000 0.0000000 0.1089109 1.0000000 0.1089109
#> x2x3   0.1000000 0.0000000 0.0000000 0.0000000 0.1089109 0.1089109 1.0000000
#> x1x2x3 0.1579191 0.1161169 0.1161169 0.1161169 0.0000000 0.0000000 0.0000000
#>           x1x2x3
#> y      0.1579191
#> x1     0.1161169
#> x2     0.1161169
#> x3     0.1161169
#> x1x2   0.0000000
#> x1x3   0.0000000
#> x2x3   0.0000000
#> x1x2x3 1.0000000