Learn R Programming

mmirestriktor

The goal of the Mighty Metrika Interface to Restriktor (‘mmirestriktor’) R package is to provide ‘shiny’ web applications built on top of ‘restriktor’ and to provide tools for building ‘shiny’ applications which use ‘restriktor’.

Installation

You can install the released version of ‘mmirestriktor’ from CRAN:

install.packages("mmirestriktor")

To install the development version of ‘mmirestriktor’ from GitHub, use the devtools package:

# install.packages("devtools")
devtools::install_github("mightymetrika/mmirestriktor")

Analyze Your Data

Use the mmirestriktor() function to launch a ‘shiny’ application which runs informative hypothesis testing via restriktor::iht() and estimation of restricted estimates via restriktor::restriktor().

The application has the following functionalities:

  • Upload a CSV file to be used as the dataset for modeling.
  • View the variables available in the uploaded dataset.
  • Input a formula to define the model to be fit.
  • Choose a model fitting engine from “lm”, “glm”, and “rlm”.
  • Pass extra arguments to the model fitting function.
  • View the terms available for defining constraints after fitting the model.
  • Define constraints for hypothesis testing.
  • Set a significance level (alpha) for hypothesis testing.
  • Choose the type of analysis to perform: Informative Hypothesis Test and/or Restricted Means.
  • View the results and interpretation

This version does not allow you to pass additional arguments to restriktor::iht() or to restriktor::restriktor(). As such, you will need to run the ‘restriktor’ package in R to access additional capabilities.

library(mmirestriktor)

# Launch application
mmirestriktor()

Play FbarCards

FbarCards is a card game that comes with ‘mmirestriktor’. In this game, a grid of cards is displayed and the objective is to reorder the cards in each row such that, when the rows are stacked, the columns of cards are in increasing order from left to right.

To play this game you:

  1. Choose a difficulty level n (from n =3 to n =7)
  2. Click Start Game to deal an n x n grid of cards from a 52 card standard deck
  3. Within each row you can either swap 2 cards or leave the row as is
  4. Click Score Game

To score the game, the final card grid is pivoted to a long form dataframe with the variables Value (the value of each card) and Column (the cards column number on the final grid). Column is treated as a factor variable in a stats::lm() model with the formula:

formula = Value ~ -1 + Column

If, for example, the game was set to n = 4, then the informative hypothesis testing constraint would be:

‘Column1 < Column2 < Column3 < Column4’

You win if the order-constrained hypothesis is supported and you lose if the order-constrained hypothesis is not supported. The iht_interpreter() function is incorporated into the game in order to help interpret the results in terms of the Type B and Type A hypothesis tests.

FbarCards()

References

Vanbrabant, L., & Rosseel, Y. (2020). An Introduction to Restriktor: Evaluating informative hypotheses for linear models. In R. van de Schoot & M. Miocevic (Eds.), Small Sample Size Solutions: A Guide for Applied Researchers and Practitioners (1st ed., pp. 157 -172). Routledge.

Copy Link

Version

Install

install.packages('mmirestriktor')

Monthly Downloads

166

Version

0.3.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Mackson Ncube

Last Published

July 17th, 2024

Functions in mmirestriktor (0.3.1)

replext

Launch Replext Simulation Shiny Application
mmir_model

Fit Restriktor Supported Model
replext_pgsql

Launch Replext Simulation Shiny Application
getUIParams_pgsql

Generate UI Parameters for Selected Simulation Type (PostgreSQL Integration)
nl2br

Convert Newline Characters to HTML Line Breaks
appendInputParams

Append Input Parameters to Simulation Results
iht_interpreter

Interpret Results of Informative Hypothesis Test
rm_interpreter

Interpret Results of Restricted Means Analysis
replext_t2_c1

Generate Replext Tables for Linear Regression Analysis
replext_t1_c1

Replext Function for ANOVA Simulations in Table 1 Cell 1
runSimulation

Execute Simulation Based on User Input
str2list

Convert a Character String to a List
pj_pow

Power Calculation for ANOVA Simulation
text_to_vector

Convert Comma-Separated String to Numeric Vector
mui

Calculate Group Means for One-Way ANOVA
mmirestriktor

Mighty Metrika Interface to Restriktor Shiny App
sim_reg

Regression Data Simulation for Linear Models
runSimulation_pgsql

Execute Simulation Based on User Input (PostgreSQL Integration)
getCellBlocks

Retrieve Cell Blocks for Replext Simulation
format_citation

Format Citation
FbarCards

FbarCards Shiny App
getUIParams

Generate UI Parameters for Selected Simulation Type
generate_datasets

Generate Datasets for ANOVA Simulation
generate_datasets_reg

Generate Multiple Datasets for Regression Simulation
deal_cards_to_grid

Deal Cards to Grid
appendInputParams_pgsql

Append Input Parameters to Simulation Results (PostgreSQL Integration)
d_eq_spaced

Calculate Equally Spaced Differences
lr_pow

Calculate Power for Linear Regression Simulations