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.0973 5000 0.2792 0.6601
#> PCTGRT 0.3757 0.1089 5000 0.1622 0.5854
#> PCTSUPP 0.2254 0.1133 5000 0.0448 0.4783
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.0973 5000 0.2687 0.6507
#> PCTGRT 0.3757 0.1089 5000 0.1585 0.5837
#> PCTSUPP 0.2254 0.1133 5000 0.0414 0.4727
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.0973 5000 0.2688 0.6510
#> PCTGRT 0.3757 0.1089 5000 0.1661 0.5880
#> PCTSUPP 0.2254 0.1133 5000 0.0281 0.4514
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.009465711 0.0018674118 0.0019841429
#> PCTGRT 0.001867412 0.0118622056 0.0009165508
#> PCTSUPP 0.001984143 0.0009165508 0.0128338441
confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC 0.2792081 0.6601242
#> PCTGRT 0.1622499 0.5853661
#> PCTSUPP 0.0448052 0.4782520
Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC 0.26870088 0.6507069
#> PCTGRT 0.15850458 0.5836865
#> PCTSUPP 0.04142793 0.4727499
Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC 0.26883300 0.6509851
#> PCTGRT 0.16606639 0.5879783
#> PCTSUPP 0.02813381 0.4513551