moulton_factor: Moulton factor for correction of intraclass correlation in...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/moulton_factor.R

Description

The moulton factor corrects for intraclass correlation in linear regression in order not to underestimate the standard deviations of the estimators

Usage

1
moulton_factor(outcome,group,estimator=NULL,...)

Arguments

outcome

The outcome variable (numerical vector)

group

The grouping variable, typically a factor indicating to which group the outcomes belong

estimator

Optionally, an estimator (predictive variable in the linear regression) can also be provided along with the outcome and group to get a more realistic picture of the Moulton factor

...

Additional parameters to be passed to ICC, called internally. Typically, this is a method argument as documented for the intraclass correlation coefficient ICC, possible values are at present method="unbiased" or equivalently method="Fisher", as well as method="unbiased_unequal_cluster_size" and "ANOVA". It is also possible to provide method="Angrist_mixed". In this case, the approach suggested in "Mostly harmless econometrics: An Empiricist's Companion", Angrist J.D., Pischke, J.S., 2008 is, where for the intraclass correlation of the observed values (i.e. outcome), the ANOVA approach is used, whereas for the regressors (i.e. estimators), Fisher's approach is used.

Details

The package uses ICC internally. Of note, balancing designs regarding regression variables are important, and if efforts were made to obtain balanced designs, the regressor values should be supplied as estimator arguments. If no estimator argument is supplied, the worst-case scenario is assumed where regressors are entirely specific to the clusters.

Also, Mouton factors can be used to correct linear statistics such as t-statistics, or squared statistics, such as chisquared values. The value provided here is for correction of the linear statistics; if application to Chisquare variables is desired, the square needs to be taken.

Value

A number equal to or larger than 1, indicating the correction factor for the standard deviations of the estimated slopes arising from the grouping structure. Values smaller than 1 (arising from negative intraclass correlation estimates) are set equal to 1 with the aim to maintain test statistics neutral or conservative in all cases. The intraclass correlation coefficient of the outcome variable under the cluster structure given by group is returned as attribute "ICC" to the primary return value, while the intraclass correlation coefficient for the estimator variable, also under the grouping structure given by group is returned as attribute "px".

Author(s)

Thomas and Marina Braschler

References

"Mostly harmless econometrics: An Empiricist's Companion", Angrist J.D., Pischke, J.S., 2008

See Also

The Moulton function draws on the functionality of intraclass-correlation, see ICC.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Worst case scenario with a priori unknown or badly balanced regressors
outcome=c(-1,-1.5,-2,-1.5,2,2.5,3,2.5)
group=c(1,1,1,1,2,2,2,2)
moulton_factor(outcome,group)
# If a balanced design is applied for a regression (or, with only two levels, equivalently a t-test), there is no clustering issue and a Moulton factor close to 1 should result:
outcome=c(-1,-1.5,-2,-1.5,2,2.5,3,2.5)
group=c(1,1,1,1,2,2,2,2)
estimator=c(0,0,1,1,0,0,1,1)
moulton_factor(outcome,group,estimator=estimator)
# Supply a method argument to use a specific method for intraclass correlation estimation
outcome=c(-1,-1.5,-2,-1.5,2,2.5,3,2.5,1.5)
group=c(1,1,1,1,2,2,2,2,2)
estimator=c(0,0,1,1,0,0,1,1,1)
moulton_factor(outcome,group,estimator=estimator,method="ANOVA")
# Specifically for ANOVA, it can be useful if the estimator (aka, regressors in this case) are factors. As in:
outcome=c(-1,-1.5,-2,-1.5,2,2.5,3,2.5,1.5)
group=c(1,1,1,1,2,2,2,2,2)
estimator=as.factor(c("A","A","B","B","C","C","A","A","A"))
moulton_factor(outcome,group,estimator=estimator)

tbgitoo/moultonTools documentation built on Nov. 8, 2021, 6:15 p.m.