betaNB: Example Using the RSqNB Function
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-r-sq-nb.Rmd
example-r-sq-nb.Rmd
Confidence intervals for multiple correlation coefficients are
generated using the RSqNB()
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)
Multiple Correlation Coefficients
Normal-Theory Approach
out <- RSqNB(nb, alpha = 0.05)
Methods
summary
Summary of the results of RSqNB()
.
Percentile Confidence Intervals
summary(out, type = "pc")
#> Call:
#> RSqNB(object = nb, alpha = 0.05)
#>
#> R-squared and adjusted R-squared
#> type = "pc"
#> est se R 2.5% 97.5%
#> rsq 0.8045 0.0527 5000 0.6943 0.8981
#> adj 0.7906 0.0565 5000 0.6725 0.8908
Bias Corrected Confidence Intervals
summary(out, type = "bc")
#> Call:
#> RSqNB(object = nb, alpha = 0.05)
#>
#> R-squared and adjusted R-squared
#> type = "bc"
#> est se R 2.5% 97.5%
#> rsq 0.8045 0.0527 5000 0.6527 0.8805
#> adj 0.7906 0.0565 5000 0.6279 0.8719
Bias Corrected and Accelerated Confidence Intervals
summary(out, type = "bca")
#> Call:
#> RSqNB(object = nb, alpha = 0.05)
#>
#> R-squared and adjusted R-squared
#> type = "bca"
#> est se R 2.5% 97.5%
#> rsq 0.8045 0.0527 5000 0.6428 0.8786
#> adj 0.7906 0.0565 5000 0.6172 0.8700
vcov
Return the sampling covariance matrix.
vcov(out)
#> rsq adj
#> rsq 0.002779805 0.002978362
#> adj 0.002978362 0.003191102
confint
Return confidence intervals.
Percentile Confidence Intervals
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> rsq 0.6943138 0.8981104
#> adj 0.6724791 0.8908325
Bias Corrected Confidence Intervals
confint(out, level = 0.95, type = "bc")
#> 2.5 % 97.5 %
#> rsq 0.6527384 0.8804724
#> adj 0.6279340 0.8719347
Bias Corrected and Accelerated Confidence Intervals
confint(out, level = 0.95, type = "bca")
#> 2.5 % 97.5 %
#> rsq 0.6427639 0.8786374
#> adj 0.6172470 0.8699687