Software: IVEware Version 0.3 Documentation

IVEware with R

IVEware with R can be started from the Srcshell run editor or from R. Using the Impute R example, here’s how.

Starting from the Srcshell run editor

  1. Download and install Srclib as described in the IVEware Installation Guide.
  2. In Windows start the Srcshell run editor. In Linux or Mac OS X run emacs with “-l ~/srclib/srcshell.el” as a command-line or icon option.
  3. Open or create and save an XML file (.xml) with the following structure, replacing the R run name and statements and Impute run name and statements with your own.
    <R name="ive_examples">
    
    # iveware examples - R version
    
    # import the input datasets
    
    mydata2 <- read.delim("mydata2.txt")
    save(mydata2, file="mydata2.rda")
    
    # run iveware
    
    # multiple imputation
    
    <impute name="impute">
    title Multiple imputation;
    datain mydata2;
    dataout impute;
    default continuous;
    categorical casecnt gender race3 hyper diab smoke fammi edusubj3 cholesth;
    mixed cafftot alcohol3;
    transfer studyid;
    restrict numcig(smoke=2,3) yrssmoke(smoke=2,3);
    bounds numcig(>0) yrssmoke(>0,<=age-12) fatindex(>0) cafftot(>=0) alcohol3(>=0);
    maxpred redtot(3) wgtkg(2);
    minrsqd .01;
    iterations 5;
    multiples 5;
    seed 2001;
    run;
    </impute>
    
    </R>
    

    If the impute.set file exists, perhaps from a previous run, you can reuse it by replacing <impute name=”impute”>…</impute> with the following.

    <impute name="impute" />
    
  4. In Srcshell, click “run”. In emacs, press F8.Once you’ve created an R setup file, ive_examples.R in the example, you can reuse it by issuing either of the following commands.
    R CMD BATCH ive_examples.R
    

    Or

    Rscript ive_examples.R
    

Starting from R

  1. Download and install Srclib as described in the IVEware Installation Guide.
  2. Change to the working directory you want to use.
  3. In a text editor, create and save an Impute setup file (.set) with the following structure, replacing the Impute statements with your own. The name of the opened or saved file should be the one you use in the global name statement below.
    title Multiple imputation;
    datain mydata2;
    dataout impute;
    default continuous;
    categorical casecnt gender race3 hyper diab smoke fammi edusubj3 cholesth;
    mixed cafftot alcohol3;
    transfer studyid;
    restrict numcig(smoke=2,3) yrssmoke(smoke=2,3);
    bounds numcig(>0) yrssmoke(>0,<=age-12) fatindex(>0) cafftot(>=0) alcohol3(>=0);
    maxpred redtot(3) wgtkg(2);
    minrsqd .01;
    iterations 5;
    multiples 5;
    seed 2001;
    run;
    
  4. Start R. In the R editor, open an R setup with the following structure, replacing the srclib location, the R statements and the Impute run name with your own, and hit return. Or type the R commands directly into the editor.
    # iveware examples - R version
    
    # import the input datasets
    
    mydata2 <- read.delim("mydata2.txt")
    save(mydata2, file="mydata2.rda")
    
    # initialize srclib
    
    srclib <<- "~/srclib/R"
    source(file.path(srclib, "init.R", fsep=.Platform$file.sep))
    
    # run iveware
    
    # multiple imputation
    
    impute(name="impute")
    

Please report problems or send comments via e-mail to IVEware Support: isr-iveware@umich.edu. For more detailed help, please complete and submit this Help Request form.