Plot the balance of data in an experimental design

Share:

Description

This function provides easy visualization of the balance of data in a data set given a specified experimental design. This function is useful for identifying missing data and other issues (see examples).

Usage

1
2
3
4
5
6
7
8
ezDesign(
    data
    , x
    , y
    , row = NULL
    , col = NULL
    , cell_border_size = 10
)

Arguments

data

Data frame containing the data to be visualized.

x

Name of the variable to plot on the x-axis.

y

Name of the variable to plot on the y-axis.

row

Name of a variable by which to split the data into facet rows.

col

Name of a variable by which to split the data into facet columns.

cell_border_size

Numeric value specifying the size of the border seperating cells (0 specifies no border)

Details

The function works by counting the number of rows in data in each cell of the design specified by the factorial combination of x, y, row, col variables.

Value

A printable/modifiable ggplot2 object.

Author(s)

Michael A. Lawrence mike.lwrnc@gmail.com
Visit the ez development site at http://github.com/mike-lawrence/ez
for the bug/issue tracker and the link to the mailing list.

See Also

ezPrecis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#Read in the ANT2 data (see ?ANT2).
data(ANT2)
head(ANT2)
ezPrecis(ANT2)

#toss NA trials
ANT2 = ANT2[!is.na(ANT2$rt),]

ezDesign(
    data = ANT2
    , x = trial
    , y = subnum
    , row = block
    , col = group
)
#subnum #7 is missing data from the last half of the experiment

## Not run: 
ezDesign(
    data = ANT2
    , x = flank
    , y = subnum
    , row = cue
)
#again, subnum#7 has half the data as the rest

#now look at error rates, which affect the number of RTs we can use
ezDesign(
    data = ANT2[ANT2$error==0,]
    , x = flank
    , y = subnum
    , row = cue
)
#again, subnum#7 stands out because they have half the data as the rest
#also, subnum#14 has no data in any incongruent cells, suggesting that
##they made all errors in this condition
#finally, subnum#12 has virtually no data, suggesting that they mistakenly
##swapped responses

## End(Not run)