betaNB: Example Using the PCorNB Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-p-cor-nb.Rmd
example-p-cor-nb.Rmd
Confidence intervals for squared partial correlation coefficients are
generated using the PCorNB()
function from the
betaNB
package. In this example, we use the data set and
the model used in betaNB: Example Using
the BetaNB Function.
df <- betaNB::nas1982
Regression
Fit the regression model using the lm()
function.
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = df)
Nonparametric Bootstrap
nb <- NB(object)
Squared Partial Correlation Coefficients
Normal-Theory Approach
out <- PCorNB(nb, alpha = 0.05)
Methods
summary
Summary of the results of PCorNB()
.
Percentile Confidence Intervals
summary(out, type = "pc")
#> est se R 2.5% 97.5%
#> NARTIC 0.4874 0.0991 5000 0.2897 0.6745
#> PCTGRT 0.3757 0.1078 5000 0.1578 0.5829
#> PCTSUPP 0.2254 0.1143 5000 0.0410 0.4729
Bias Corrected Confidence Intervals
summary(out, type = "bc")
#> est se R 2.5% 97.5%
#> NARTIC 0.4874 0.0991 5000 0.2626 0.6580
#> PCTGRT 0.3757 0.1078 5000 0.1518 0.5745
#> PCTSUPP 0.2254 0.1143 5000 0.0384 0.4658
Bias Corrected and Accelerated Confidence Intervals
summary(out, type = "bca")
#> est se R 2.5% 97.5%
#> NARTIC 0.4874 0.0991 5000 0.2635 0.6588
#> PCTGRT 0.3757 0.1078 5000 0.1572 0.5823
#> PCTSUPP 0.2254 0.1143 5000 0.0244 0.4423
coef
Return the vector of estimates.
coef(out)
#> NARTIC PCTGRT PCTSUPP
#> 0.4874382 0.3757383 0.2253739
vcov
Return the sampling covariance matrix.
vcov(out)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.009817767 0.0016884412 0.0018281507
#> PCTGRT 0.001688441 0.0116102145 0.0006887886
#> PCTSUPP 0.001828151 0.0006887886 0.0130584752
confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC 0.28970699 0.6744961
#> PCTGRT 0.15781800 0.5829209
#> PCTSUPP 0.04098596 0.4729408
Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC 0.26259735 0.6579864
#> PCTGRT 0.15184761 0.5745282
#> PCTSUPP 0.03838111 0.4658085
Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC 0.26354796 0.6587774
#> PCTGRT 0.15716823 0.5823217
#> PCTSUPP 0.02444051 0.4423445