draw.latent: Draw latent scale diagram

Description Usage Arguments Details Value Note Author(s) References Examples

Description

Writes a file of commands for the dot program to draw a graph proposed by \insertCiterosenbaum87latdiag and useful for checking for non-intersecting item characteristic curves which are a property of various sorts of latent scale including Guttman, Rasch and the Mokken double monotone scale.

Usage

1
2
3
4
5
6
draw.latent(mat, threshold = 0, which.npos = NULL,
   labels = NULL, reorder = TRUE)
## S3 method for class 'draw.latent'
print(x, rootname = NULL, ...)
## S3 method for class 'draw.latent'
plot(x, rootname = NULL, graphtype = "pdf", ...)

Arguments

mat

A matrix or data.frame of binary item responses

threshold

Patterns are only printed if more frequent than threshold, defaults to 0 meaning all those which actually occur are printed

which.npos

Which values of number of items positive to print, NULL means all and is the default. Duplicates are removed

labels

Labels for subgraphs, NULL means none, a character vector supplies the labels, otherwise labelled as n positive

reorder

logical, put the items in ascending order of prevalence, defaults to TRUE

x

An object of class draw.latent

rootname

Character: the rootname of the file of dot commands

graphtype

Character: one of the graph types supported by dot

...

Other arguments

Details

The draw.latent function produces the dot commands which will draw the graph.

The print method prints some details. If rootname is supplied it will be used as the rootname of the file of dot commands which will have file type .gv. If rootname is NULL (which is the default) just some details about the result are printed.

The plot method actually does the plotting and invisibly returns the result of the system command which executes dot. The output file will be named with the rootname followed by the graph type (after a dot). The routine does not draw the graph itself but leaves that to the dot program from graphviz which you need to install and have on your path.

More extensive documentation is provided in the vignette.

Value

Returns a list containing:

which.npos

which values of items positive were printed. Differs from input parameter if for some there were no valid patterns to print or duplicates have been removed

new.order

order of original items from left to right in displayed diagram. If new.order==TRUE new.order[i] is the index in the original dataset of the ith item in increasing prevalence

code

a character vector of the dot commands

Note

The parameter rootname is now supplied to the plot and print functions and not to draw.latent

Author(s)

Michael Dewey

References

\insertRef

rosenbaum87latdiag

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
set.seed(20150114)
mat <- cbind(
   sample(0:1, 100, prob = c(0.2, 0.8), replace = TRUE),
   sample(0:1, 100, prob = c(0.4, 0.6), replace = TRUE),
   sample(0:1, 100, prob = c(0.5, 0.5), replace = TRUE),
   sample(0:1, 100, prob = c(0.6, 0.4), replace = TRUE),
   sample(0:1, 100, prob = c(0.8, 0.2), replace = TRUE)
)
res <- draw.latent(mat)
#
# now need to plot(res, rootname = "mat", graphtype = "pdf")
#

latdiag documentation built on April 14, 2020, 5:28 p.m.