betaMC: Example Using the SCorMC Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-s-cor-mc.Rmd
example-s-cor-mc.Rmd
Confidence intervals for semipartial correlation coefficients are
generated using the SCorMC()
function from the
betaMC
package. In this example, we use the data set and
the model used in betaMC: Example Using
the BetaMC Function.
df <- betaMC::nas1982
Regression
Fit the regression model using the lm()
function.
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = df)
Monte Carlo Sampling Distribution of Parameters
Normal-Theory Approach
mvn <- MC(object, type = "mvn")
Asymptotic distribution-free Approach
adf <- MC(object, type = "adf")
Heteroskedasticity Consistent Approach (HC3)
hc3 <- MC(object, type = "hc3")
Semipartial Correlation Coefficients
Normal-Theory Approach
mvn <- SCorMC(mvn)
Asymptotic distribution-free Approach
adf <- SCorMC(adf)
Heteroskedasticity Consistent Approach (HC3)
hc3 <- SCorMC(hc3)
Methods
summary
Summary of the results of SCorMC()
.
summary(mvn)
#> Call:
#> SCorMC(object = mvn)
#>
#> Semipartial correlations
#> type = "mvn"
#> est se R 0.05% 0.5% 2.5% 97.5% 99.5% 99.95%
#> NARTIC 0.4312 0.0773 20000 0.1757 0.2244 0.2699 0.5720 0.6225 0.6797
#> PCTGRT 0.3430 0.0744 20000 0.1116 0.1556 0.1934 0.4858 0.5424 0.6206
#> PCTSUPP 0.2385 0.0692 20000 0.0214 0.0598 0.1008 0.3724 0.4220 0.4871
summary(adf)
#> Call:
#> SCorMC(object = adf)
#>
#> Semipartial correlations
#> type = "adf"
#> est se R 0.05% 0.5% 2.5% 97.5% 99.5% 99.95%
#> NARTIC 0.4312 0.0702 20000 0.1248 0.2175 0.2707 0.5461 0.5897 0.6409
#> PCTGRT 0.3430 0.0704 20000 0.0956 0.1488 0.1918 0.4702 0.5143 0.5699
#> PCTSUPP 0.2385 0.0703 20000 0.0013 0.0512 0.0924 0.3731 0.4212 0.4786
summary(hc3)
#> Call:
#> SCorMC(object = hc3)
#>
#> Semipartial correlations
#> type = "hc3"
#> est se R 0.05% 0.5% 2.5% 97.5% 99.5% 99.95%
#> NARTIC 0.4312 0.0872 20000 0.0433 0.1369 0.2235 0.5688 0.6192 0.6720
#> PCTGRT 0.3430 0.0830 20000 0.0401 0.0986 0.1583 0.4846 0.5388 0.6093
#> PCTSUPP 0.2385 0.0784 20000 -0.0199 0.0338 0.0784 0.3885 0.4440 0.5147
vcov
Return the sampling covariance matrix.
vcov(mvn)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.005968017 -0.0012519414 -0.0009054820
#> PCTGRT -0.001251941 0.0055357707 -0.0007519029
#> PCTSUPP -0.000905482 -0.0007519029 0.0047828636
vcov(adf)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.0049348275 0.0002556930 -0.0003926382
#> PCTGRT 0.0002556930 0.0049604267 -0.0006528814
#> PCTSUPP -0.0003926382 -0.0006528814 0.0049474322
vcov(hc3)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.0076087026 0.0008684133 -0.0001089213
#> PCTGRT 0.0008684133 0.0068924894 -0.0006198172
#> PCTSUPP -0.0001089213 -0.0006198172 0.0061397950
confint
Return confidence intervals.
confint(mvn, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC 0.2699467 0.5720038
#> PCTGRT 0.1933956 0.4858499
#> PCTSUPP 0.1007948 0.3723680
confint(adf, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC 0.27071709 0.5460707
#> PCTGRT 0.19175402 0.4701798
#> PCTSUPP 0.09238786 0.3730507
confint(hc3, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC 0.22347215 0.5687931
#> PCTGRT 0.15826925 0.4846184
#> PCTSUPP 0.07843045 0.3884719
References
Dudgeon, P. (2017). Some improvements in confidence intervals for
standardized regression coefficients. Psychometrika,
82(4), 928–951. https://doi.org/10.1007/s11336-017-9563-z
Pesigan, I. J. A., & Cheung, S. F. (2023). Monte Carlo
confidence intervals for the indirect effect with missing data.
Behavior Research Methods. https://doi.org/10.3758/s13428-023-02114-4