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.0683 5000 0.2875 0.5599
#> PCTGRT 0.3430 0.0715 5000 0.1888 0.4690
#> PCTSUPP 0.2385 0.0720 5000 0.0930 0.3750
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.0683 5000 0.3025 0.5742
#> PCTGRT 0.3430 0.0715 5000 0.2065 0.4818
#> PCTSUPP 0.2385 0.0720 5000 0.1028 0.3846
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.0683 5000 0.3126 0.5840
#> PCTGRT 0.3430 0.0715 5000 0.2156 0.4945
#> PCTSUPP 0.2385 0.0720 5000 0.0985 0.3817
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.0046676875 -0.0004580444 -0.0005958745
#> PCTGRT -0.0004580444 0.0051159941 -0.0007142684
#> PCTSUPP -0.0005958745 -0.0007142684 0.0051825083
confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC 0.28754273 0.5598947
#> PCTGRT 0.18884765 0.4690436
#> PCTSUPP 0.09302381 0.3750306
Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC 0.3025181 0.5742005
#> PCTGRT 0.2064524 0.4818210
#> PCTSUPP 0.1028025 0.3846028
Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC 0.31255286 0.5840409
#> PCTGRT 0.21557522 0.4945446
#> PCTSUPP 0.09847316 0.3816628