betaNB: Example Using the SCorNB Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-s-cor-nb.Rmd
example-s-cor-nb.Rmd
Confidence intervals for semipartial correlation coefficients are
generated using the SCorNB()
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)
Semipartial Correlation Coefficients
Normal-Theory Approach
out <- SCorNB(nb, alpha = 0.05)
Methods
summary
Summary of the results of SCorNB()
.
Percentile Confidence Intervals
summary(out, type = "pc")
#> Call:
#> SCorNB(object = nb, alpha = 0.05)
#>
#> Semipartial correlations
#> type = "pc"
#> est se R 2.5% 97.5%
#> NARTIC 0.4312 0.0703 5000 0.2865 0.5620
#> PCTGRT 0.3430 0.0730 5000 0.1841 0.4702
#> PCTSUPP 0.2385 0.0707 5000 0.0937 0.3690
Bias Corrected Confidence Intervals
summary(out, type = "bc")
#> Call:
#> SCorNB(object = nb, alpha = 0.05)
#>
#> Semipartial correlations
#> type = "bc"
#> est se R 2.5% 97.5%
#> NARTIC 0.4312 0.0703 5000 0.3055 0.5800
#> PCTGRT 0.3430 0.0730 5000 0.2080 0.4879
#> PCTSUPP 0.2385 0.0707 5000 0.1055 0.3798
Bias Corrected and Accelerated Confidence Intervals
summary(out, type = "bca")
#> Call:
#> SCorNB(object = nb, alpha = 0.05)
#>
#> Semipartial correlations
#> type = "bca"
#> est se R 2.5% 97.5%
#> NARTIC 0.4312 0.0703 5000 0.3123 0.5911
#> PCTGRT 0.3430 0.0730 5000 0.2162 0.5018
#> PCTSUPP 0.2385 0.0707 5000 0.1019 0.3767
coef
Return the vector of estimates.
coef(out)
#> NARTIC PCTGRT PCTSUPP
#> 0.4311525 0.3430075 0.2384789
vcov
Return the sampling covariance matrix.
vcov(out)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.0049394757 -0.0005124484 -0.0006432867
#> PCTGRT -0.0005124484 0.0053289810 -0.0008739471
#> PCTSUPP -0.0006432867 -0.0008739471 0.0050054828
confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC 0.28647058 0.5619877
#> PCTGRT 0.18408871 0.4701639
#> PCTSUPP 0.09370699 0.3690127
Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC 0.3054979 0.5800339
#> PCTGRT 0.2080062 0.4879046
#> PCTSUPP 0.1054555 0.3797579
Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC 0.3123295 0.5911142
#> PCTGRT 0.2161550 0.5017553
#> PCTSUPP 0.1019403 0.3767076