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")
#> Call:
#> PCorNB(object = nb, alpha = 0.05)
#>
#> Squared partial correlations
#> type = "pc"
#> est se R 2.5% 97.5%
#> NARTIC 0.4874 0.0975 5000 0.2831 0.6711
#> PCTGRT 0.3757 0.1072 5000 0.1673 0.5832
#> PCTSUPP 0.2254 0.1165 5000 0.0396 0.4868
Bias 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.0975 5000 0.2645 0.6536
#> PCTGRT 0.3757 0.1072 5000 0.1528 0.5739
#> PCTSUPP 0.2254 0.1165 5000 0.0380 0.4833
Bias 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.0975 5000 0.2647 0.6539
#> PCTGRT 0.3757 0.1072 5000 0.1595 0.5761
#> PCTSUPP 0.2254 0.1165 5000 0.0249 0.4566
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.009501545 0.0017829824 0.0019363288
#> PCTGRT 0.001782982 0.0114957825 0.0008931868
#> PCTSUPP 0.001936329 0.0008931868 0.0135608335
confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC 0.28312605 0.6710505
#> PCTGRT 0.16732226 0.5832476
#> PCTSUPP 0.03959784 0.4867931
Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC 0.26449231 0.6536167
#> PCTGRT 0.15276457 0.5738520
#> PCTSUPP 0.03801282 0.4833138
Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC 0.26469919 0.6538725
#> PCTGRT 0.15952219 0.5760846
#> PCTSUPP 0.02485843 0.4565859