Skip to content

Instantly share code, notes, and snippets.

Vovk-Sellke MPR (Maximum p-Ratio)

This document describes the implementation of the Vovk-Sellke MPR into each statistical procedure in JASP. Follow the steps to complete a procedure. The necessary global functions are in the file commonMPR.R in the existing JASP-Engine/JASP/R directory. At the bottom of this document is a to-do list for where this still needs to be implemented.

Outline
  1. In analysis R file
  2. In JSON file
  3. In AnalysisForms file
  4. In Markdown help file (if help file exists)
# Generates a test dataset in the directory below:
setwd("~/2-Werk/JASP/code/EJ-dataset")
rm(list = ls())
library(MASS)
# Different items are necessary to test JASP procedures
# Continuous Variables ----------------------------------------------------
@vankesteren
vankesteren / debugdata.md
Last active October 10, 2016 09:49
Readme for debug dataset in JASP

Debug Dataset

Description

The test data file for JASP. debug.csv contains 100 observations on many variables to test functions in JASP.

Columns

  • 9 continuous variables
    • Normal: Normally distributed data
    • Gamma: Gamma distributed data (only positive!)
    • Binomial: random 0/1 data
listDependencies <- function(pkgs){
# Recursively looks through package dependencies (depends & imports) of a list of packages
# Argument: a character vector of package names
pack <- available.packages()
pnames <- pack[,1]
depmat <- matrix(ncol=3)
while (TRUE){
imports <- tools::package_dependencies(pack[pkgs[pkgs %in% pnames],], which = "Imports")
@vankesteren
vankesteren / valisim.r
Created September 21, 2016 12:38
Simulation for Valeria ANOVA
#Vali-simulation
rm(list = ls())
library(car)
# 2x2 simulation with 1 group all == 0
# n per group
n <- 15
meanWTct <- 1
varWTct <- 0 # the all - equal group
@vankesteren
vankesteren / saveImage.md
Last active March 8, 2017 13:45
Explanation and checklist for implementing image saving in JASP

Saving Images from JASP

Erik-Jan van Kesteren, 08/02/2017

Introduction

A frequently requested feature in JASP is to export the plots to a vector file format, such as eps or svg. This would allow the plots to be incorporated in publications more easily, as publishers commonly require vector-based graphics. Currently, the plots are rendered in png only, for display in the output pane¹ of the application. With the change proposed here, we will modernise the R image output functions in order to:

  1. allow for vector graphics in eps format to be output and saved by the user.
  2. create modularity in the program such that other file formats we might want to export to in the future will be easy to implement.
  3. maintain full backwards compatibility with existing JASP files and code.
@vankesteren
vankesteren / proposal_split.md
Created June 20, 2017 08:38
Proposal for the split functionality

Split functionality in Descriptives

Introduction

Goal

We want to allow users to view descriptives split by a certain factor, such as gender, experimental condition, or age group. This will aid general data exploration and analysis.

Thoughts

A start has already been made with the boxplots. The split by functionality of this part should be moved to the main variables widget and it should act on all the descriptives of a certain analysis.

@vankesteren
vankesteren / todo_analysis_bridge.md
Created January 17, 2018 15:51
To do list and small note on the utility functions that make up the bridge from R to js/cpp in JASP

New analysis bridge update

From discussions we had a few theoretical ideas:

  • There should be a clear distinction between format and content: output/results formatting should in principle be done in the JSON, and the content should come from R. Ideally, in R you would not need to think about formatting of the output anymore. See point 6 of the to do list below.
  • There should be a clear definition of static and dynamic: There are a few levels of how dynamic a results object is;
    • Static - the results object does not change its column names, attributes, formatting, etc. This can be formatted fully in the JSON.
    • Dynamic 1 - the results object has titles or column names or other formatting that changes based on the options entered in the UI. For the most part, this is still fully formattable in the JSON (extra columns can be entered but not returned by R, for example)
  • Dynamic 2 - the formatting and size of the table might depend on the data or levels of a factor. This cannot be done with
@vankesteren
vankesteren / mrc.R
Created February 21, 2018 21:19
multiple regression through coordinate descent
mrc <- function(X, y, max.iter = 1000, tol = .Machine$double.eps) {
# Multiple regression using coordinate descent
# Input: X matrix, y vector
# Output: estimated beta vector
# init ----
bhat <- numeric(ncol(X))
convergence <- FALSE
i <- 0L
@vankesteren
vankesteren / installR.md
Last active July 26, 2018 07:13
A tutorial for UU employees to install `R` and `RStudio` locally.

Setting up R and RStudio on your work laptop

R and Rstudio may be slow. This is because our laptops install to the network by default. When you intend to work with these programs regularly, you will be unhappy with that situation.

Here's a step-by step tutorial to installing R the right way. Administrator rights required.

  1. Try to uninstall R and RStudio. This may be impossible, but try anyway.
  2. Download R. When the .exe is downloaded, right-click it and "run as administrator". Make sure it installs on your C:\ drive.
  3. Download RStudio. Again, right-click and "run as administrator" to install it on your C:\ drive.
  4. Go to the installed rstudio.exe (for example by pressing the windows key and typing rstudio). Right-click it > properties > compatibility > check "Run this program as an administrator" > apply. This is required to install packages on the C:\ drive.