dsldLinear: dsldLinear

View source: R/dsldLinear.R

dsldLinearR Documentation

dsldLinear

Description

Comparison of sensitive groups via linear models, with or without interactions with the sensitive variable.

Usage

dsldLinear(data, yName, sName, interactions = FALSE, sComparisonPts = NULL, 
    useSandwich = FALSE)
## S3 method for class 'dsldLM'
summary(object,...)
## S3 method for class 'dsldLM'
predict(object,xNew,...)
## S3 method for class 'dsldLM'
coef(object,...)
## S3 method for class 'dsldLM'
vcov(object,...)

Arguments

data

Data frame.

yName

Name of the response variable Y column.

sName

Name of the sensitive attribute S column.

interactions

Logical value indicating whether or not to model interactions with the sensitive variable S.

sComparisonPts

If interactions is TRUE, a data frame of new cases for which mean Y | X will be compared across each pair of S levels. Must be in the same format as original data.

useSandwich

If TRUE, use the "sandwich" variance estimator.

object

An object returned by the dsldLinear function.

xNew

New data to be predicted. Must be in the same format as original data.

...

Further arguments.

Details

The dsldLinear function fits a linear model to the response variable Y using all other variables in data. The user may select for interactions with the sensitive variable S.

The function produces an instance of the 'dsldLM' class (an S3 object). Instances of the generic functions summary and coef are provided.

If interactions is TRUE, the function will fit m separate models, where m is the number of levels of S. Then summary will contain m+1 data frames; the first m of which will be the outputs from the individual models.

The m+1st data frame will compare the differences in conditional mean Y|X for each pair of S levels, and for each value of X in sComparisonPts. The intention is to allow users to see the comparisons of conditions for sensitive groups via linear models, with interactions with S.

The dsldDiffS function allows users to compare mean Y at that X between each pair of S level for additional new unseen data levels using the model fitted from dsldLinear.

Value

The dsldLinear function returns an S3 object of class 'dsldLM', with one component for each level of S. Each component includes information about the fitted model.

Author(s)

N. Matloff, A. Mittal, A. Ashok

Examples

  
data(svcensus) 

newData <- svcensus[c(1, 18), -c(4,6)] 
lin1 <- dsldLinear(svcensus, 'wageinc', 'gender', interactions = TRUE,
    newData)
coef(lin1)
vcov(lin1) 
summary(lin1)
predict(lin1, newData)

lin2 <- dsldLinear(svcensus, 'wageinc', 'gender', interactions = FALSE)
summary(lin2)

dsld documentation built on Sept. 14, 2024, 1:08 a.m.