betaMC: Example Using the PCorMC Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-p-cor-mc.Rmd
example-p-cor-mc.RmdConfidence intervals for squared partial correlation coefficients are
generated using the PCorMC() 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::nas1982Regression
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")Squared Partial Correlation Coefficients
Normal-Theory Approach
mvn <- PCorMC(mvn)Asymptotic distribution-free Approach
adf <- PCorMC(adf)Heteroskedasticity Consistent Approach (HC3)
hc3 <- PCorMC(hc3)Methods
summary
Summary of the results of PCorMC().
summary(mvn)
#> Call:
#> PCorMC(object = mvn)
#>
#> Squared partial correlations
#> type = "mvn"
#> est se R 0.05% 0.5% 2.5% 97.5% 99.5% 99.95%
#> NARTIC 0.4874 0.1053 20000 0.1127 0.1807 0.2430 0.6514 0.7086 0.7763
#> PCTGRT 0.3757 0.1073 20000 0.0500 0.1001 0.1474 0.5618 0.6249 0.7069
#> PCTSUPP 0.2254 0.0993 20000 0.0057 0.0198 0.0468 0.4281 0.5062 0.5782
summary(adf)
#> Call:
#> PCorMC(object = adf)
#>
#> Squared partial correlations
#> type = "adf"
#> est se R 0.05% 0.5% 2.5% 97.5% 99.5% 99.95%
#> NARTIC 0.4874 0.0997 20000 0.0381 0.1502 0.2411 0.6329 0.6893 0.7518
#> PCTGRT 0.3757 0.1004 20000 0.0334 0.0880 0.1460 0.5378 0.5936 0.6666
#> PCTSUPP 0.2254 0.1029 20000 0.0005 0.0094 0.0368 0.4335 0.5047 0.5897
summary(hc3)
#> Call:
#> PCorMC(object = hc3)
#>
#> Squared partial correlations
#> type = "hc3"
#> est se R 0.05% 0.5% 2.5% 97.5% 99.5% 99.95%
#> NARTIC 0.4874 0.1182 20000 0.0110 0.0704 0.1815 0.6488 0.7051 0.7723
#> PCTGRT 0.3757 0.1155 20000 0.0108 0.0514 0.1052 0.5546 0.6194 0.6877
#> PCTSUPP 0.2254 0.1135 20000 0.0001 0.0036 0.0253 0.4562 0.5471 0.6347vcov
Return the sampling covariance matrix.
vcov(mvn)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.0110932147 0.0006673043 0.0004004950
#> PCTGRT 0.0006673043 0.0115040181 0.0001156673
#> PCTSUPP 0.0004004950 0.0001156673 0.0098550210
vcov(adf)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.009937808 0.0024649569 0.0020029526
#> PCTGRT 0.002464957 0.0100806855 0.0007876848
#> PCTSUPP 0.002002953 0.0007876848 0.0105864957
vcov(hc3)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.013979885 0.0036328183 0.0028680953
#> PCTGRT 0.003632818 0.0133445630 0.0009319819
#> PCTSUPP 0.002868095 0.0009319819 0.0128842476confint
Return confidence intervals.
confint(mvn, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC 0.24300742 0.6514329
#> PCTGRT 0.14741339 0.5617781
#> PCTSUPP 0.04678045 0.4280831
confint(adf, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC 0.24105542 0.6329125
#> PCTGRT 0.14596279 0.5377823
#> PCTSUPP 0.03683088 0.4334947
confint(hc3, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC 0.18147876 0.6487877
#> PCTGRT 0.10524038 0.5546481
#> PCTSUPP 0.02534816 0.4561597References
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