group_partial_r2: Partial R2 of groups of covariates in a linear regression...

Description Usage Arguments Value Examples

View source: R/sensitivity_stats.R

Description

This function computes the partial R2 of a group of covariates in a linear regression model.

Usage

1
2
3
4
5
6
7
group_partial_r2(...)

## S3 method for class 'lm'
group_partial_r2(model, covariates, ...)

## S3 method for class 'numeric'
group_partial_r2(F.stats, p, dof, ...)

Arguments

...

arguments passed to other methods. First argument should either be an lm object with the regression model or a numeric vector with the F-statistics for the group of covariates.

model

an lm object with the regression model

covariates

model covariates for which their grouped partial R2 will be computed.

F.stats

F-statistics for the group of covariates.

p

number of parameters in the model.

dof

residual degrees of freedom of the model.

Value

A numeric vector with the computed partial R2.

Examples

1
2
3
4
5
6
data("darfur")

model <- lm(peacefactor ~ directlyharmed + age + farmer_dar + herder_dar +
             pastvoted + hhsize_darfur + female + village, data = darfur)

group_partial_r2(model, covariates = c("female", "pastvoted"))

sensemakr documentation built on Oct. 8, 2021, 9:10 a.m.