betaNB: Example Using the SCorSqNB and FSqNB Functions
Ivan Jacob Agaloos Pesigan
Source:vignettes/example-es-nb.Rmd
example-es-nb.RmdConfidence intervals for squared semipartial correlation coefficients
and Cohen’s f-squared are generated using the SCorSqNB()
and FSqNB() functions 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)Squared Semipartial Correlation Coefficients
The semipartial correlation is signed, and its interval may contain
zero. SCorSqNB() returns the image of the signed interval
under squaring. It is not the interval of squared draws.
SCorSqNB(nb, level = 0.95, type = "pc")
#> est lower upper
#> NARTIC 0.1858925 0.079919122 0.3124586
#> PCTGRT 0.1176542 0.036027404 0.2247309
#> PCTSUPP 0.0568722 0.008510303 0.1390376
SCorSqNB(nb, level = 0.95, type = "bca")
#> est lower upper
#> NARTIC 0.1858925 0.095726324 0.3477819
#> PCTGRT 0.1176542 0.047620517 0.2565136
#> PCTSUPP 0.0568722 0.009949351 0.1457498Cohen’s f-Squared
out <- FSqNB(nb, alpha = 0.05)Methods
summary
summary(out, type = "pc")
#> Call:
#> FSqNB(object = nb, alpha = 0.05)
#>
#> Cohen's f-squared (fsq) and local f-squared
#> type = "pc"
#> est se R 2.5% 97.5%
#> fsq 4.1158 1.6626 5000 2.2408 8.6810
#> NARTIC 0.9510 0.4259 5000 0.3928 2.0567
#> PCTGRT 0.6019 0.3128 5000 0.1868 1.3951
#> PCTSUPP 0.2909 0.2300 5000 0.0430 0.9168coef
coef(out)
#> fsq NARTIC PCTGRT PCTSUPP
#> 4.1157764 0.9509843 0.6018924 0.2909455vcov
vcov(out)
#> fsq NARTIC PCTGRT PCTSUPP
#> fsq 2.7643103 0.41122916 0.238364349 0.186533110
#> NARTIC 0.4112292 0.18138466 0.027587957 0.018493839
#> PCTGRT 0.2383643 0.02758796 0.097873970 0.009984946
#> PCTSUPP 0.1865331 0.01849384 0.009984946 0.052901714confint
confint(out, level = 0.95, type = "pc")
#> 2.5 % 97.5 %
#> fsq 2.24080923 8.6810104
#> NARTIC 0.39282353 2.0566974
#> PCTGRT 0.18677794 1.3951305
#> PCTSUPP 0.04304245 0.9168247