Skip to contents

Overview

The goal of PRIA is to find an ENA model with a reduced set of codes, that is highly correlated to the original model.

Installation

From CRAN

cran status cran downloads

Coming Soon 

Development Version

pipeline status coverage report

install.packages("PRIA", repos = "https://cran.qe-libs.org")

How To

Step 1: Generate a regular ENA Model

The first step is to generate an ENA model, one that may have more codes that is preferred.

data <- read.csv(system.file(package = "PRIA", "extdata/TADMUSCoded_6_28_19.csv"))

### Make the full set.
units <- data[, c("COND", "Scenario", "Speaker_2", "Team")]
conversation <- data[, c("Scenario", "Team")]
code_names <- c("SeekingInformation","DetectIdentify","TrackBehavior","StatusUpdate","AssessmentPrioritization","DefensiveOrders","DeterrentOrders","Recommendation")
codes <- data[, code_names]
metadata <- data[, c("COND", "ATOMTOT_GROUP")]

full.accum <- rENA::ena.accumulate.data(
  units = units,
  conversation = conversation,
  codes = codes,
  metadata = metadata,
  window.size.back = 4
);
full.set <- rENA::ena.make.set(full.accum);

Step 2: Create Reduced Sets

Given a set with some number of codes, we can then use PRIA. There is a simple function, pria() that takes two parameters

  1. the existing ENA model,
  2. the maximum number of codes to remove

The result will be a data.frame containing the results of comparing the models with a reduced set of codes to that of the original ENA model.

reduced_sets <-  pria(full.set, 1);

Step 3: View Results

The data.frame returned contains one row for each model that was generated and compared to the full, base model.

removed gof     gof.lower gof.upper  points      points.lower points.upper  nodes      nodes.lower nodes.upper
1       0.9477  0.9471    0.9484     0.99535385  0.9944       0.9962        0.9927228  0.9495      0.9990
1       0.9459  0.9452    0.9466     0.95434606  0.9450       0.9622        0.9753454  0.8372      0.9965
1       0.9427  0.9419    0.9434     0.98664856  0.9839       0.9890        0.9981376  0.9869      0.9997
1       0.9410  0.9402    0.9417     0.95932074  0.9509       0.9663        0.9805566  0.8697      0.9972
1       0.9403  0.9395    0.9410     0.96818602  0.9616       0.9737        0.9786727  0.8578      0.9970
1       0.9143  0.9132    0.9153     0.85987025  0.8328       0.8829        0.9892118  0.9259      0.9985
1       0.9063  0.9052    0.9075     0.06236196 -0.0333       0.1569       -0.1095204 -0.7969      0.7014
1       0.8889  0.8876    0.8903    -0.28808287 -0.3733      -0.1981       -0.2328226 -0.8388      0.6308

Step 4: Extract Results

Find Results Above Threshold

PRIA implements a special version of the greater than (>) operator, allowing for quick extraction of results that are above a defined threshold.

Note: This comparison checks all three of the lower statistics against the threshold

## When checking the previous table/set of results against 0.9, produces the following subset of the full results

# reduced_sets > 0.9

removed gof     gof.lower gof.upper  points      points.lower points.upper  nodes      nodes.lower nodes.upper
1       0.9477  0.9471    0.9484     0.99535385  0.9944       0.9962        0.9927228  0.9495      0.9990
1       0.9427  0.9419    0.9434     0.98664856  0.9839       0.9890        0.9981376  0.9869      0.9997

Find Top Result

PRIA also implements a version of the max() function which will, using the same criteria described for the greater than operator, return the top result, when ordered by number of removed codes and overall goodness of fit.

# max(reduced_sets)

removed gof     gof.lower gof.upper  points      points.lower points.upper  nodes      nodes.lower nodes.upper
1       0.9477  0.9471    0.9484     0.99535385  0.9944       0.9962        0.9927228  0.9495      0.9990

Step 5: Use the ENA sets

By default, PRIA will maintain the generated ENA sets along with the results. Although not directly present when printing or viewing the results, the sets can be accessed using $ena.set.

For example, to view the codes used to generate the individual results: reduced_sets$ena.set$rotation$codes

Or to use the ENA model from top result: top <- max(reduced_sets)$ena.set[[1]]