betaNB: Example Using the SCorNB Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-s-cor-nb.Rmd
example-s-cor-nb.RmdConfidence 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::nas1982Regression
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.0707 5000 0.2842 0.5629
#> PCTGRT 0.3430 0.0731 5000 0.1838 0.4744
#> PCTSUPP 0.2385 0.0702 5000 0.0958 0.3689Bias 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.0707 5000 0.3024 0.5797
#> PCTGRT 0.3430 0.0731 5000 0.2100 0.4996
#> PCTSUPP 0.2385 0.0702 5000 0.1071 0.3856Bias 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.0707 5000 0.3087 0.5906
#> PCTGRT 0.3430 0.0731 5000 0.2196 0.5138
#> PCTSUPP 0.2385 0.0702 5000 0.1034 0.3822coef
Return the vector of estimates.
coef(out)
#> NARTIC PCTGRT PCTSUPP
#> 0.4311525 0.3430075 0.2384789vcov
Return the sampling covariance matrix.
vcov(out)
#> NARTIC PCTGRT PCTSUPP
#> NARTIC 0.0050029466 -0.0004231678 -0.0007344594
#> PCTGRT -0.0004231678 0.0053503126 -0.0008096115
#> PCTSUPP -0.0007344594 -0.0008096115 0.0049346860confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC 0.28416656 0.5628525
#> PCTGRT 0.18377442 0.4744038
#> PCTSUPP 0.09578834 0.3688574Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC 0.3024316 0.5796886
#> PCTGRT 0.2099740 0.4995694
#> PCTSUPP 0.1071179 0.3855923Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC 0.3087198 0.5906212
#> PCTGRT 0.2196308 0.5138464
#> PCTSUPP 0.1033713 0.3822040