betaNB: Example Using the PCorNB Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-p-cor-nb.Rmd
example-p-cor-nb.RmdConfidence 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::nas1982Regression
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")
#> Call:
#> PCorNB(object = nb, alpha = 0.05)
#>
#> Squared partial correlations
#> type = "pc"
#> est se R 2.5% 97.5%
#> NARTIC 0.4874 0.0978 5000 0.2888 0.6674
#> PCTGRT 0.3757 0.1081 5000 0.1575 0.5778
#> PCTSUPP 0.2254 0.1143 5000 0.0428 0.4746Bias Corrected Confidence Intervals
summary(out, type = "bc")
#> Call:
#> PCorNB(object = nb, alpha = 0.05)
#>
#> Squared partial correlations
#> type = "bc"
#> est se R 2.5% 97.5%
#> NARTIC 0.4874 0.0978 5000 0.2724 0.6567
#> PCTGRT 0.3757 0.1081 5000 0.1506 0.5723
#> PCTSUPP 0.2254 0.1143 5000 0.0389 0.4684Bias Corrected and Accelerated Confidence Intervals
summary(out, type = "bca")
#> Call:
#> PCorNB(object = nb, alpha = 0.05)
#>
#> Squared partial correlations
#> type = "bca"
#> est se R 2.5% 97.5%
#> NARTIC 0.4874 0.0978 5000 0.2728 0.6568
#> PCTGRT 0.3757 0.1081 5000 0.1560 0.5769
#> PCTSUPP 0.2254 0.1143 5000 0.0251 0.4490coef
Return the vector of estimates.
coef(out)
#> NARTIC PCTGRT PCTSUPP
#> 0.4874382 0.3757383 0.2253739vcov
Return the sampling covariance matrix.
vcov(out)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.009573631 0.0015996997 0.0020199578
#> PCTGRT 0.001599700 0.0116826431 0.0008650442
#> PCTSUPP 0.002019958 0.0008650442 0.0130667370confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC 0.28877331 0.6674226
#> PCTGRT 0.15747629 0.5777738
#> PCTSUPP 0.04284374 0.4745686Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC 0.27238541 0.6566553
#> PCTGRT 0.15063892 0.5723494
#> PCTSUPP 0.03886623 0.4684394Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC 0.27279021 0.6568406
#> PCTGRT 0.15596426 0.5768562
#> PCTSUPP 0.02509658 0.4489537