README.md

dynamr

An R package for the dynamic analysis of panel data, dynamr serves two purposes. First, the pooled_glm_test() function can be used by a researcher to test whether or not the assumption of stable effects holds when estimating a generalized linear model with panel data. Second, the dynamr() function detects where effect changes occur.

The reference for this method is A Permutation-Based Changepoint Technique for Monitoring Effect Sizes, co-authored with James D. Wilson and Skyler Cranmer. The manuscript is currently under review but available upon request.

Installation

To install dynamr use the following command and make sure to have devtools installed.

devtools::install_github("dnkent/dynamr")

Description

This package contains two primary functions which are briefly described below. For any function named function, type ?function in R to get full documentation.

library(ISLR)
library(dynamr)

data("Weekly")

stock_dynam <- dynamr(
    dat = Weekly,
    time_var = "Year",
    formula = Today ~ Lag1 + Lag2,
    window_size = 1,
    family = "gaussian",
    N = 5000
)

stock_dynam
library(ISLR)
library(dynamr)

data("Weekly")

stock_list <- list()

for(i in 1:21){
  time <- 1989 + i
  stock_list[[i]] <- dplyr::filter(Weekly, Year == time)
}

stock.p.value <- pooled_glm_test(
  formula = Today ~ Lag1 + Lag2,
  Panel.data = stock_list,
  N = 300,
  family = "gaussian"
)

stock.p.value$p.value

Questions or Bugs

Please send any comments, bugs, or questions to the developer Daniel Kent at dnkent24@gmail.com.



dnkent/dynamr documentation built on June 29, 2021, 7:22 p.m.