This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test glmmTMB's MLE implementation of the ordered beta regression model | |
# and compare it to the ordbetareg package, which uses | |
# Bayesian estimation (Stan/brms) | |
library(glmmTMB) | |
library(ordbetareg) | |
library(dplyr) | |
data("pew") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ordinal versus binary outcome power calculation | |
# Robert Kubinec | |
# New York University Abu Dhabi | |
# January 31, 2022 | |
library(dplyr) | |
library(ordinal) | |
library(ggplot2) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Helper function to create arrays | |
#' | |
#' Function takes a data.frame in long mode and converts it to an array. Function can also repeat a | |
#' single matrix to fill out an array. | |
#' | |
#' @param input_matrix Either a data.frame in long mode or a single matrix | |
#' @param arr_dim If \code{input_matrix} is a single matrix, \code{arr_dim} determines the length of the resulting array | |
#' @param row_var Unquoted variable name that identifies the data.frame column corresponding to the rows (1st dimension) of the array (must be unique) | |
#' @param col_var_name Unquoted variable name that identifies the data.frame column corresponding names of the columns (2nd dimension) of the array | |
#' @param col_var_value Unquoted variable name that identifies the data.frame column corresponding to the values that populate the cells of the array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gistr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gistr |