Skip to content

Commit 03ac64e

Browse files
committed
update Vignettes
1 parent a775b3c commit 03ac64e

File tree

4 files changed

+22
-25
lines changed

4 files changed

+22
-25
lines changed

R/binary_dummy_data.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
#'
55
#' @docType data
66
#' @name binary_dummy_data
7-
#' @format A data.frame with 107 rows and 2 variables.
7+
#' @format A data.frame with 107 rows and 3 variables.
88
NULL

data/binary_dummy_data.rda

671 Bytes
Binary file not shown.

man/binary_dummy_data.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/introduction-to-konfound.Rmd

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -113,40 +113,37 @@ Where `pkonfound()` can be used with values from already-conducted analyses, `ko
113113
m1 <- lm(mpg ~ wt + hp + qsec, data = mtcars)
114114
m1
115115
116-
konfound(m1, hp)
116+
konfound(model_object = m1,
117+
tested_variable = hp)
117118
```
118119

119120
With `konfound()` you can also request a table with some key output from the correlation-based approach.
120121

121122
```{r}
122-
konfound(m1, wt, to_return = "table")
123+
konfound(model_object = m1, tested_variable = wt, to_return = "table")
123124
```
124125

125-
If the impact threshhold is greater than the impacts of the `Z`s (the other covariates) then an omitted variable would have to have a greater impact than any of the observed covariates to change the inference. Note that in fields in which there is a lot known about covariates given the outcome of interest, then the omitted covariates are likely less important than those that are known and included.
126+
If the impact threshhold is greater than the impacts of the `Z`s (the other covariates) then an omitted variable would have to have a greater impact than any of the observed covariates to change the inference.
126127

127-
**For logistic regression models fit with glm()**
128-
129-
Effects for logistic models are typically interpreted on the basis of average partial (or marginal) effects (calculated using the `margins` package).
128+
**For logistic regression models fit with glm() with a dichotomous predictor of interest**
130129

131-
Due to an issue with the margins and predictions package, these are the raw coefficients, not the average marginal effects; we will address this in future patches.
130+
We first fit a logistic regression model where the predictor of interest (`condition`) is binary/dichotomous.
132131

133-
```{r, message = F}
134-
# if forcats is not installed, this install it first using install.packages("forcats") for this to run
135-
if (requireNamespace("forcats")) {
136-
d <- forcats::gss_cat
137-
138-
d$married <- ifelse(d$marital == "Married", 1, 0)
139-
140-
m2 <- glm(married ~ age, data = d, family = binomial(link = "logit"))
141-
konfound(m2, age)
142-
}
132+
```{r}
133+
# View summary stats for condition variable
134+
table(binary_dummy_data$condition)
135+
# Fit the logistic regression model
136+
m4 <- glm(outcome ~ condition + control,
137+
data = binary_dummy_data, family = binomial)
138+
# View the summary of the model
139+
summary(m4)
143140
```
144141

145-
**For logistic regression models fit with glm() with a dichotomous predictor of interest**
146-
147-
```{r, eval = FALSE}
148-
m4 <- glm(outcome ~ condition, data = binary_dummy_data)
149-
konfound(m4, condition, two_by_two = TRUE)
142+
Now we call konfound as below, where `n_treat` represents number of data points in the treatment condition.
143+
```{r}
144+
konfound(model_object = m4,
145+
tested_variable = condition,
146+
two_by_two = TRUE, n_treat = 55)
150147
```
151148

152149
**Mixed effects (or multi-level) models fit with the lmer() function from the lme4 package**
@@ -165,7 +162,7 @@ if (requireNamespace("lme4")) {
165162

166163
## Use of mkonfound() for meta-analyses that include sensitivity analysis
167164

168-
`mkonfound()` supports sensitivity that can be compared or synthesized across multiple analyses. For example, here, `d` represents output from a number (30 in this case) of past studies, read in a CSV file from a website:
165+
`mkonfound()` supports sensitivity that can be compared or synthesized across multiple analyses. Calculations are based on the RIR framework using correlations to express effects and thresholds in each study. For example, here, `d` represents output from a number (30 in this case) of past studies, read in a CSV file from a website:
169166

170167
```{r, eval = TRUE}
171168
mkonfound_ex

0 commit comments

Comments
 (0)