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.0982 5000 0.2872 0.6648
#> PCTGRT 0.3757 0.1081 5000 0.1609 0.5829
#> PCTSUPP 0.2254 0.1159 5000 0.0403 0.4849Bias 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.0982 5000 0.2691 0.6525
#> PCTGRT 0.3757 0.1081 5000 0.1528 0.5759
#> PCTSUPP 0.2254 0.1159 5000 0.0346 0.4704Bias 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.0982 5000 0.2697 0.6526
#> PCTGRT 0.3757 0.1081 5000 0.1602 0.5821
#> PCTSUPP 0.2254 0.1159 5000 0.0212 0.4423coef
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.009639565 0.0014808200 0.0021051605
#> PCTGRT 0.001480820 0.0116898519 0.0006933677
#> PCTSUPP 0.002105160 0.0006933677 0.0134260204confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC 0.28720172 0.6647768
#> PCTGRT 0.16091920 0.5829195
#> PCTSUPP 0.04026216 0.4849199Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC 0.26905184 0.6525084
#> PCTGRT 0.15277864 0.5759113
#> PCTSUPP 0.03461796 0.4703940Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC 0.26967574 0.6526185
#> PCTGRT 0.16021333 0.5820753
#> PCTSUPP 0.02116022 0.4422629