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")
#> est se R 2.5% 97.5%
#> NARTIC 0.4312 0.0692 5000 0.2861 0.5550
#> PCTGRT 0.3430 0.0725 5000 0.1865 0.4738
#> PCTSUPP 0.2385 0.0710 5000 0.0941 0.3685
Bias Corrected Confidence Intervals
summary(out, type = "bc")
#> est se R 2.5% 97.5%
#> NARTIC 0.4312 0.0692 5000 0.3034 0.5699
#> PCTGRT 0.3430 0.0725 5000 0.2039 0.4911
#> PCTSUPP 0.2385 0.0710 5000 0.1061 0.3836
Bias Corrected and Accelerated Confidence Intervals
summary(out, type = "bca")
#> est se R 2.5% 97.5%
#> NARTIC 0.4312 0.0692 5000 0.3107 0.5808
#> PCTGRT 0.3430 0.0725 5000 0.2139 0.5060
#> PCTSUPP 0.2385 0.0710 5000 0.1027 0.3772
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.0047869661 -0.0003067722 -0.0006021082
#> PCTGRT -0.0003067722 0.0052578821 -0.0007387335
#> PCTSUPP -0.0006021082 -0.0007387335 0.0050392930
confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> NARTIC 0.28612910 0.5550361
#> PCTGRT 0.18647043 0.4738107
#> PCTSUPP 0.09410132 0.3685063
Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> NARTIC 0.3034241 0.5699215
#> PCTGRT 0.2038687 0.4910689
#> PCTSUPP 0.1061061 0.3835750
Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> NARTIC 0.3106683 0.5807758
#> PCTGRT 0.2139125 0.5060262
#> PCTSUPP 0.1026950 0.3771865