Learn R Programming

Rwinsteps (version 1.0-1.1)

winsteps: Running Winsteps

Description

The winsteps function sends a command file to the program Winsteps and returns the resulting item and person information, optionally saving them as output files. as.winsteps converts its arguments into an object of class “winsteps”.

Usage

winsteps(cmd, cmdfile = "cmdfile", outfile = "outfile",
  ifile = "ifile", pfile = "pfile", newdir = getwd(),
  run = TRUE, windir = "winsteps")

as.winsteps(cmd, ifile, pfile, daterun, comptime)

Arguments

cmd

a command file object, created using wcmd

cmdfile

a path to the command file, when running winsteps, or a list to be converted into a command file object, when running as.winsteps

outfile

a path to which the standard Winsteps output will be written

ifile

a path to the item file, when running winsteps, or a list to be converted into an ifile object, when running as.winsteps

pfile

a path to the person file, when running winsteps, or a list to be converted into a pfile object, when running as.winsteps

newdir

an optional, temporary, directory for reading and writing files, defaulting to the current working directory

run

boolean, with default TRUE, indicating whether or not Winsteps should be run. If FALSE, the Winsteps files cmdfile, ifile, and pfile are read in, assuming they are each specified as strings of length 1.

windir

the directory for the Winsteps program, which is sent to the Windows command prompt. If the directory is already included in the Windows PATH variable, the default "winsteps" will suffice

daterun

date and time the model was run

comptime

time required to run the model

Value

A list object of class “winsteps” containing:

cmd

the command file

ifile

the item file

pfile

the person file

daterun

date and time the model was run

comptime

time required to run the model

Details

Winsteps is commercial software for analyzing item response data, primarily through applications of the Rasch model, a 1 parameter item response theory model. The winsteps function interacts with Winsteps in batch mode and retrieves the two main output files produced by the program, referred to as an ifile, which contains item output, and a pfile, which contains person output.

The only argument required by winsteps is a command file, which can be supplied directly as cmd, a command file object of class “wcmd”, or which can be referenced with the filename cmdfile. If both are included, the object is written to the filename.

cmdfile, outfile, ifile, and pfile are all used to write the corresponding Winsteps files when run = TRUE. Regardless of whether Winsteps is run or not, the cmdfile, ifile, and pfile will be read into R and returned. If the defaults are retained for these arguments the files will be deleted once the function has completed without errors.

Winsteps is called by invoking the operating system using the system command. windir can be used to specify the Winsteps directory folder (e.g., "c:/program files/winsteps"), should the system have a hard time finding it.

References

Winsteps is commercial software, available at www.winsteps.com

See Also

wcmd, ifile, pfile

Examples

Run this code
# NOT RUN {
# Simulate scores for 15 items and 100 people
set.seed(82911)
b <- seq(-3, 3, length = 15)
theta <- rnorm(100, 1)
rmat <- data.frame(ifelse(rirf(b, theta)$p > runif(1500), 1, 0))

# Item and person labels
colnames(rmat) <- paste("i", 1:15, sep = "")
rmat$name <- paste("p", 1:100, sep = "")

# Create a command file object
cmd <- wcmd(title = "R2Winsteps Example", data = "example.dat",
  item1 = 1, ni = 15, name1 = 16, namelen = 5,
  labels = paste("i", 1:15, sep = ""), hlines = "Y")

# The last two steps require access to a local directory and
# are not run

# Write the data to file
# write.wdat(rmat, cmd)

# Run Winsteps, with default filenames, not saving the
# command file or other output to file
# out <- winsteps(cmd)
# }

Run the code above in your browser using DataLab