Closed geauxdojang closed 6 years ago
It looks like you don't have the MBESS package installed. My guess is that you installed from GitHub and not the CRAN. Sometimes (I don't know why) GitHub installs don't always install the required packages - they way CRAN installs do. I suggest installing from the CRAN via the command below. If that doesn't fix the issue please let me know.
install.packages("apaTables", dependencies = TRUE)
@dstanley4: That helped a bit, not but entirely. See -999
are still there for airplay
variable and beta and beta CIs are messed up as well. Thanks.
library(apaTables)
#> Warning: package 'apaTables' was built under R version 3.5.1
basic.reg <- lm(sales ~ adverts + airplay, data = album)
apa.reg.table(basic.reg, filename = "Table2_APA.doc", table.number = 2)
#> Warning: Unknown or uninitialised column: 'beta'.
#> Warning: Unknown or uninitialised column: 'LLbeta'.
#> Warning: Unknown or uninitialised column: 'ULbeta'.
#>
#>
#> Table 2
#>
#> Regression results using sales as the criterion
#>
#>
#> # A tibble: 6 x 9
#> Predictor b `b_95%_CI` beta `beta_95%_CI` sr2 `sr2_95%_CI` r
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 (Interce~ 41.1~ [22.72, 5~ "" "" "" "" ""
#> 2 adverts 0.09~ [0.07, 0.~ 0.52 [0.44, 0.61] .27 [.55, .69] .58**
#> 3 airplay 3.59~ [3.02, 4.~ 0.52 [0.44, 0.61] .29 [-999.., -9~ .60**
#> 4 "" "" "" "" "" "" "" ""
#> 5 "" "" "" "" "" "" "" ""
#> 6 "" "" "" "" "" "" "" ""
#> # ... with 1 more variable: Fit <chr>
#>
#> Note. A significant b-weight indicates the beta-weight and semi-partial correlation are also significant.
#> b represents unstandardized regression weights. beta indicates the standardized regression weights.
#> sr2 represents the semi-partial correlation squared. r represents the zero-order correlation.
#> Square brackets are used to enclose the lower and upper limits of a confidence interval.
#> * indicates p < .05. ** indicates p < .01.
#>
sessionInfo()
#> R version 3.5.0 (2018-04-23)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 7 x64 (build 7601) Service Pack 1
#>
#> Matrix products: default
#>
#> locale:
#> [1] LC_COLLATE=English_United States.1252
#> [2] LC_CTYPE=English_United States.1252
#> [3] LC_MONETARY=English_United States.1252
#> [4] LC_NUMERIC=C
#> [5] LC_TIME=English_United States.1252
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] bindrcpp_0.2.2 apaTables_2.0.4
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_0.12.18 knitr_1.20 bindr_0.1.1 magrittr_1.5
#> [5] MBESS_4.4.3 tidyselect_0.2.4 lattice_0.20-35 R6_2.2.2
#> [9] rlang_0.2.1 fansi_0.2.3 stringr_1.3.1 dplyr_0.7.6
#> [13] tools_3.5.0 grid_3.5.0 nlme_3.1-137 broom_0.5.0
#> [17] utf8_1.1.4 cli_1.0.0 htmltools_0.3.6 yaml_2.2.0
#> [21] rprojroot_1.3-2 digest_0.6.15 assertthat_0.2.0 tibble_1.4.2
#> [25] crayon_1.3.4 tidyr_0.8.1 purrr_0.2.5 glue_1.3.0
#> [29] evaluate_0.11 rmarkdown_1.10 stringi_1.2.4 compiler_3.5.0
#> [33] pillar_1.3.0 backports_1.1.2 pkgconfig_2.0.1
Created on 2018-08-24 by the reprex package (v0.2.0).
Did you install MBESS? Or did you use the install command with the dependencies equal to TRUE? Can you confirm which approach you used? (Also, install works best if you close R and start it again).
I just installed fresh from the CRAN and couldn't reproduce the problem. See my results below. I might need more info about your OS etc. To help.
Here's my results:
install.packages("apaTables", dependencies = TRUE) trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/apaTables_2.0.4.tgz' Content type 'application/x-gzip' length 938444 bytes (916 KB)
downloaded 916 KB
The downloaded binary packages are in /var/folders/0q/428bg5mn6mv_g80qtjhn5jgm0000gn/T//RtmpKXEuUU/downloaded_packages
library(apaTables) basic.reg <- lm(sales ~ adverts + airplay, data = album) apa.reg.table(basic.reg, filename = "Table2_APA.doc", table.number = 2)
Table 2
Regression results using sales as the criterion
Predictor b b_95%_CI beta beta_95%_CI sr2 sr2_95%_CI r Fit
(Intercept) 41.12** [22.72, 59.53]
adverts 0.09** [0.07, 0.10] 0.52 [0.44, 0.61] .27 [.18, .36] .58**
airplay 3.59** [3.02, 4.15] 0.55 [0.46, 0.63] .29 [.20, .38] .60**
R2 = .629**
95% CI[.55,.69]
Note. A significant b-weight indicates the beta-weight and semi-partial correlation are also significant. b represents unstandardized regression weights. beta indicates the standardized regression weights. sr2 represents the semi-partial correlation squared. r represents the zero-order correlation. Square brackets are used to enclose the lower and upper limits of a confidence interval.
I am on Windows. I tried both install.packages("apaTables", dependencies = TRUE)
and installing them separately. No luck. Thanks.
Ok. I'll try a Windows machine at work on Monday.
OK. Thanks.
We are having a potentially related issue which is also visible in the reprex about which is that all beta values are the same within each table (in @sbohora's example they are all 0.52). MBESS has been separately installed and we've replicated the issue on OSX and Windows 10.
It seems to be breaking in the for-loop at lines 367-368 of apaRegressionsTable.R.
Running the example generates warnings about beta
, LLbeta
and ULbeta
being unknown or not being initialised and then it returns the beta for the first predictor (adverts) for every row.
Ok. I managed to reproduce the problem on a clean / non-development machine. It turns out I didn't update some of the imported packages on my development machine. New installs of apaTables installed the newest version of all imported packages - which apaTables was not compatible with due to non-ideal way I indexed table size. I think I've solved the issue for apa.reg.table. Please use the commands below to install the development latest version to check it out. It would be great if you could confirm this fixes the problem for you. It will be a day or two before I upload the fix to the CRAN. I'd like confirmation it works first -- and time to review the rest of the code for the same issue in other functions.
install.packages("devtools") devtools::install_github("dstanley4/apaTables") library(apaTables)
That seems to be resolved for me, thanks
Yes, I have also confirmed this fix. Thanks @dstanley4
@dstanley4: It resolves the issue for me as well. Thanks.
@dstanley4:
apaTables::apa.reg.table()
does not produce the correct results (insr2_95%_CI
). Is there any issue with the function? Thanks.Created on 2018-08-24 by the reprex package (v0.2.0).