Estimate Squared Partial Correlation Coefficients and Generate the Corresponding Sampling Distribution Using the Monte Carlo Method
Source:R/betaMC-p-cor-mc.R
PCorMC.RdEstimate Squared Partial Correlation Coefficients and Generate the Corresponding Sampling Distribution Using the Monte Carlo Method
Usage
PCorMC(object, alpha = c(0.05, 0.01, 0.001))Arguments
- object
Object of class
mc, that is, the output of theMC()function.- alpha
Numeric vector. Significance level \(\alpha\).
Value
Returns an object
of class betamc which is a list with the following elements:
- call
Function call.
- args
Function arguments.
- thetahatstar
Sampling distribution of \(r^{2}_{p}\).
- vcov
Sampling variance-covariance matrix of \(r^{2}_{p}\).
- est
Vector of estimated \(r^{2}_{p}\).
- fun
Function used ("PCorMC").
Details
The vector of squared partial correlation coefficients (\(r^{2}_{p}\)) is derived from each randomly generated vector of parameter estimates. Confidence intervals are generated by obtaining percentiles corresponding to \(100(1 - \alpha)\%\) from the generated sampling distribution of \(r^{2}_{p}\), where \(\alpha\) is the significance level.
See also
Other Beta Monte Carlo Functions:
BetaMC(),
DeltaRSqMC(),
DiffBetaMC(),
FSqMC(),
MC(),
MCMI(),
RSqMC(),
SCorMC(),
SCorSqMC()
Examples
# Data ---------------------------------------------------------------------
data("nas1982", package = "betaMC")
# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
data = nas1982
)
# MC -----------------------------------------------------------------------
mc <- MC(
object = object,
R = 100, # use a large value e.g., 20000L for actual research
seed = 0508
)
# PCorMC -------------------------------------------------------------------
out <- PCorMC(object = mc, alpha = 0.05)
## Methods -----------------------------------------------------------------
print(x = out)
#> Call:
#> PCorMC(object = mc, alpha = 0.05)
#>
#> Squared partial correlations
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC 0.4874 0.1238 100 0.1582 0.6341
#> PCTGRT 0.3757 0.1208 100 0.0759 0.5573
#> PCTSUPP 0.2254 0.0985 100 0.0492 0.4117
summary(object = out)
#> Call:
#> PCorMC(object = mc, alpha = 0.05)
#>
#> Squared partial correlations
#> type = "hc3"
#> est se R 2.5% 97.5%
#> NARTIC 0.4874 0.1238 100 0.1582 0.6341
#> PCTGRT 0.3757 0.1208 100 0.0759 0.5573
#> PCTSUPP 0.2254 0.0985 100 0.0492 0.4117
coef(object = out)
#> NARTIC PCTGRT PCTSUPP
#> 0.4874382 0.3757383 0.2253739
vcov(object = out)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.015315618 0.004487319 0.002074682
#> PCTGRT 0.004487319 0.014587720 0.002029406
#> PCTSUPP 0.002074682 0.002029406 0.009711677
confint(object = out, level = 0.95)
#> 2.5 % 97.5 %
#> NARTIC 0.15816211 0.6341049
#> PCTGRT 0.07590871 0.5573378
#> PCTSUPP 0.04922297 0.4117306