logint_test

library(devtools)
Loading required package: usethis
devtools::install_github(
"BelinaJang/logiSense",force = TRUE
)
Using GitHub PAT from the git credential store.
Downloading GitHub repo BelinaJang/logiSense@HEAD

── R CMD build ─────────────────────────────────────────────────────────────────
* checking for file ‘/private/var/folders/0k/j9jd6d9n1nd2k441lt546bm00000gn/T/RtmpZ6D1gQ/remotes471225bd555a/BelinaJang-logiSense-2f5ffd8/DESCRIPTION’ ... OK
* preparing ‘logiSense’:
* checking DESCRIPTION meta-information ... OK
* excluding invalid files
Subdirectory 'R' contains invalid file names:
  ‘function_v1.qmd’ ‘function_v2.qmd’ ‘functiondraft.Rmd’
  ‘interaction.Rmd’ ‘logint_cat.Rmd’ ‘logint_cont.Rmd’
  ‘logint_contbycat.qmd’ ‘logint_test.qmd’ ‘logis_example.qmd’
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘logiSense_0.1.1.tar.gz’
library(logiSense)

load data

data("test_data")

case 1: continuous by continuous interaction

logint1

logint(formula=stroke ~ age*avg_glucose_level, variable1 = "age", 
           variable2 = "avg_glucose_level", variable1_type = "continuous", variable2_type = "continuous", data = test_data)
Both variables are continuous. 
continuous_var1: age, continuous_var2: avg_glucose_level
For an observation with avg_glucose_level=value, the odds ratio of 'stroke' for increasing age by one unit is e^(0.07928 + (-6.128e-05)*(value)).
The 95% CI: e^((0.07928 + (-6.128e-05)*(value)) ± (1.96)*sqrt(0.0001523 + 9.373e-09 + 2*(value)*(-1.092e-06))). 

For an observation with age=value, the odds ratio of 'stroke' for increasing avg_glucose_level by one unit is e^(0.008927 + (-6.128e-05)*(value)).
The 95% CI: e^((0.008927 + (-6.128e-05)*(value)) ± (1.96)*sqrt(4.535e-05 + 9.373e-09 + 2*(value)*(-6.427e-07))). 

logint2

logint2(formula=stroke ~ age*avg_glucose_level, variable1 = "age", 
           variable2 = "avg_glucose_level", variable1_type = "continuous", variable2_type = "continuous", data = test_data)
Both variables are continuous. 
continuous_var1: age, continuous_var2: avg_glucose_level
continuous_var1: age continuous_var2: avg_glucose_level 
For an observation with avg_glucose_level=value, the odds ratio of 'stroke' for increasing age by one unit is e^(0.07928 + (-6.128e-05)*(value)).
The 95% CI: e^((0.07928 + (-6.128e-05)*(value)) ± (1.96)*sqrt(0.0001523 + 9.373e-09 + 2*(value)*(-1.092e-06))). 

For an observation with age=value, the odds ratio of 'stroke' for increasing avg_glucose_level by one unit is e^(0.008927 + (-6.128e-05)*(value)).
The 95% CI: e^((0.008927 + (-6.128e-05)*(value)) ± (1.96)*sqrt(4.535e-05 + 9.373e-09 + 2*(value)*(-6.427e-07))). 

case 2: continuous by categorical interaction

logint

logint(stroke ~ work_type*age, variable1 = "age", variable2 = "work_type", variable1_type = "continuous", variable2_type = "categorical",data=test_data, sigfig=4)
Both variables are of different types. 
Variable 1 is continuous. 
continuous_var: age
Variable 2 is categorical. 
categorical_var: work_type
The odds ratio of 'stroke' for increasing age by one unit in work_type group children = 1.04.
The 95% CI: e^(0.03938 ± (1.96)*(0.02384 + 0.02384 + 0.02384)) = (0.5679, 1.905).

The odds ratio of 'stroke' for increasing age by one unit in work_type group Govt_job = 1.087.
The 95% CI: e^(0.03938 ± (1.96)*(0.02384 + 0.02407 + -0.02384)) = (1.01, 1.072).

The odds ratio of 'stroke' for increasing age by one unit in work_type group Never_worked = 1.
The 95% CI: e^(0.03938 ± (1.96)*(0.02384 + 18380 + -0.02384)) = (4.262e-116, 2.539e+115).

The odds ratio of 'stroke' for increasing age by one unit in work_type group Private = 1.087.
The 95% CI: e^(0.03938 ± (1.96)*(0.02384 + 0.02388 + -0.02384)) = (1.027, 1.054).

The odds ratio of 'stroke' for increasing age by one unit in work_type group Self-employed = 1.063.
The 95% CI: e^(0.03938 ± (1.96)*(0.02384 + 0.02398 + -0.02384)) = (1.017, 1.064).



For an observation with age=value, the odds ratio of 'stroke' for work_type group Govt_job vs work_type group children (reference level) is e^(-1.73 + (0.04404)*(value)).
The 95% CI: e^((-1.73 + (0.04404)*(value)) ± (1.96)*sqrt(2.93 + 0.02407 + 2*(value)*(-0.1978))). 

For an observation with age=value, the odds ratio of 'stroke' for work_type group Never_worked vs work_type group children (reference level) is e^(-9.444 + (-0.03938)*(value)).
The 95% CI: e^((-9.444 + (-0.03938)*(value)) ± (1.96)*sqrt(4908000 + 18380 + 2*(value)*(-297300))). 

For an observation with age=value, the odds ratio of 'stroke' for work_type group Private vs work_type group children (reference level) is e^(-1.561 + (0.04413)*(value)).
The 95% CI: e^((-1.561 + (0.04413)*(value)) ± (1.96)*sqrt(2.096 + 0.02388 + 2*(value)*(-0.1854))). 

For an observation with age=value, the odds ratio of 'stroke' for work_type group Self-employed vs work_type group children (reference level) is e^(-0.3749 + (0.02177)*(value)).
The 95% CI: e^((-0.3749 + (0.02177)*(value)) ± (1.96)*sqrt(2.606 + 0.02398 + 2*(value)*(-0.1923))). 

logint2

logint2(stroke ~ work_type*age, variable1 = "age", variable2 = "work_type", variable1_type = "continuous", variable2_type = "categorical",data=test_data, sigfig=4)
Both variables are of different types. 
Variable 1 is continuous. 
continuous_var: age
Variable 2 is categorical. 
categorical_var: work_type
The odds ratio of 'stroke' for increasing age by one unit in work_type group children = 1.04.
The 95% CI: e^(0.03938 ± (1.96)*(0.02384 + 0.02384 + 0.02384)) = (0.5679, 1.905).

The odds ratio of 'stroke' for increasing age by one unit in work_type group Govt_job = 1.087.
The 95% CI: e^(0.03938 ± (1.96)*(0.02384 + 0.02407 + -0.02384)) = (1.01, 1.072).

The odds ratio of 'stroke' for increasing age by one unit in work_type group Never_worked = 1.
The 95% CI: e^(0.03938 ± (1.96)*(0.02384 + 18380 + -0.02384)) = (4.262e-116, 2.539e+115).

The odds ratio of 'stroke' for increasing age by one unit in work_type group Private = 1.087.
The 95% CI: e^(0.03938 ± (1.96)*(0.02384 + 0.02388 + -0.02384)) = (1.027, 1.054).

The odds ratio of 'stroke' for increasing age by one unit in work_type group Self-employed = 1.063.
The 95% CI: e^(0.03938 ± (1.96)*(0.02384 + 0.02398 + -0.02384)) = (1.017, 1.064).



For an observation with age=value, the odds ratio of 'stroke' for work_type group Govt_job vs work_type group children (reference level) is e^(-1.73 + (0.04404)*(value)).
The 95% CI: e^((-1.73 + (0.04404)*(value)) ± (1.96)*sqrt(2.93 + 0.02407 + 2*(value)*(-0.1978))). 

For an observation with age=value, the odds ratio of 'stroke' for work_type group Never_worked vs work_type group children (reference level) is e^(-9.444 + (-0.03938)*(value)).
The 95% CI: e^((-9.444 + (-0.03938)*(value)) ± (1.96)*sqrt(4908000 + 18380 + 2*(value)*(-297300))). 

For an observation with age=value, the odds ratio of 'stroke' for work_type group Private vs work_type group children (reference level) is e^(-1.561 + (0.04413)*(value)).
The 95% CI: e^((-1.561 + (0.04413)*(value)) ± (1.96)*sqrt(2.096 + 0.02388 + 2*(value)*(-0.1854))). 

For an observation with age=value, the odds ratio of 'stroke' for work_type group Self-employed vs work_type group children (reference level) is e^(-0.3749 + (0.02177)*(value)).
The 95% CI: e^((-0.3749 + (0.02177)*(value)) ± (1.96)*sqrt(2.606 + 0.02398 + 2*(value)*(-0.1923))). 

case 3: categorical by categorical interaction

logint

logint(stroke ~ work_type*Residence_type, variable1 = "work_type", variable2 = "Residence_type", variable1_type = "categorical", variable2_type = "categorical",data=test_data, sigfig=4)
Both variables are categorical. 
categorical_var1: work_type, categorical_var2: Residence_type
Warning in logint(stroke ~ work_type * Residence_type, variable1 = "work_type", : Both variables are categorical. This is currently under development. Please check back later. 

logint2

logint2(stroke ~ work_type*Residence_type, variable1 = "work_type", variable2 = "Residence_type", variable1_type = "categorical", variable2_type = "categorical",data=test_data, sigfig=4)
Both variables are categorical. 
categorical_var1: work_type, categorical_var2: Residence_type
Warning in logint2(stroke ~ work_type * Residence_type, variable1 = "work_type", : Both variables are categorical. This is currently under development. Please check back later.