# NOT RUN {
# using an lm object
## loads data
data("darfur")
## fits model
model <- lm(peacefactor ~ directlyharmed + age + farmer_dar + herder_dar +
pastvoted + hhsize_darfur + female + village, data = darfur)
## partial R2 of the treatment (directly harmed) with the outcome (peacefactor)
partial_r2(model, covariates = "directlyharmed")
## partial R2 of female with the outcome
partial_r2(model, covariates = "female")
# you can also provide the statistics directly
partial_r2(t_statistic = 4.18445, dof = 783)
# }
Run the code above in your browser using DataLab