Skip to content
/ lmhyp Public
forked from Jaeoc/lmhyp

Informed Hypothesis Testing for Regression

License

Notifications You must be signed in to change notification settings

jomulder/lmhyp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lmhyp

This package provides an easy way to test hypotheses about continous predictors in multiple regression. A hypothesis may for example be that variable1 and variable2 both have a positive correlation with the outcome variable, but that the correlation of variable1 is stronger. This package enables formal testing of such hypotheses and is particularly useful for testing multiple contradicting hypotheses.

Basic example

library(lmhyp)

###Standardize variables and fit a linear model with lm
dt <- as.data.frame(scale(mtcars[, c(1, 3:4, 6)]))
fit <- lm(mpg ~ disp + hp + wt, data = dt)

###Define hypotheses based on theory and test them, separated by ;
hyp <- "wt > disp; wt < disp"
test_hyp(fit, hyp)
#> Hypotheses:
#> 
#>   H1:   "wt>disp"
#>   H2:   "wt<disp"
#> 
#> Posterior probability of each hypothesis (rounded):
#> 
#>   H1:   0.0568
#>   H2:   0.9432

Installation

You can install lmhyp from github with:

# install.packages("devtools")
devtools::install_github("Jaeoc/lmhyp")

About

Informed Hypothesis Testing for Regression

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%