Hi Chris,
I am attempting to compare graph-level variables between two groups across densities, with modularity (from the data table `dt.G.long`) and Lp.norm (from `small.dt`) being my primary variables of interest.
For the analysis, I require the `resid` object. However, I'm encountering difficulties in generating it. I've used the following code, but it results in an error."
myResids <- get.resid(dt.vol = dt.G, covars = covars.dti, by = "Study.ID", exclude.cov='Group')
Error in `[.data.table`(DT.cov, , ycols, with = FALSE) : column(s) not found: Group
Traceback:
5. stop("column(s) not found: ", paste(ansvars[is.na(ansvals)], collapse = ", "))
4. `[.data.table`(DT.cov, , ycols, with = FALSE)
3. DT.cov[, ycols, with = FALSE]
2. as.matrix(DT.cov[, ycols, with = FALSE])
1. get.resid(dt.vol = dt.G, covars = covars.dti, by = "Study.ID", exclude.cov = "Group")
Both data.tables contain the variable Group and the error remains even if I change the ‘Group’ format to factor.
> str(covars.dti)
Classes ‘data.table’ and 'data.frame': 67 obs. of 5 variables:
$ Study.ID : chr "153" "158" "162" "164" ...
$ Group : Factor w/ 2 levels "1preem","2control": 1 1 1 1 1 1 1 1 1 1 ...
$ sp : int 2 2 1 1 1 1 2 1 1 1 ...
$ bw.z.score: num -1.5 -3.2 -0.2 -1.9 -0.8 -4.4 -1.8 -2.6 -0.7 -2.3 ...
$ ga : num 23.9 32.9 24.7 28.3 26.6 ...
- attr(*, ".internal.selfref")=<externalptr>
str(dt.G)
Classes ‘data.table’ and 'data.frame': 670 obs. of 31 variables:
$ threshold : num 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 ...
$ Cp : num 0.558 0.558 0.558 0.558 0.558 ...
$ Lp : num 2.42 2.42 2.42 2.42 2.42 ...
$ E.global : num 0.489 0.489 0.489 0.489 0.489 ...
$ mod : num 0.473 0.473 0.473 0.473 0.473 ...
$ density : num 0.147 0.147 0.147 0.147 0.147 ...
$ max.comp : num 82 82 82 82 82 82 82 82 82 82 ...
$ num.tri : num 966 966 966 966 966 966 966 966 966 966 ...
$ diameter : num 5 5 5 5 5 5 5 5 5 5 ...
$ transitivity : num 0.464 0.464 0.464 0.464 0.464 ...
$ assort : num -0.0548 -0.0548 -0.0548 -0.0548 -0.0548 ...
$ strength : num 1.61 1.77 1.54 1.69 1.73 ...
$ E.local.wt : num 0.137 0.15 0.131 0.144 0.148 ...
$ E.global.wt : num 0.0829 0.0889 0.0822 0.0874 0.0893 ...
$ diameter.wt : num 34.1 31.7 33.9 31 31.2 ...
$ Lp.wt : num 16.4 15.2 16.4 15.2 15 ...
$ num.hubs.wt : num 19 18 18 16 17 17 17 19 18 18 ...
$ mod.wt : num 0.585 0.57 0.579 0.573 0.581 ...
$ assort.lobe : num 0.0698 0.0698 0.0698 0.0698 0.0698 ...
$ assort.lobe.hemi: num 0.145 0.145 0.145 0.145 0.145 ...
$ asymm : num -0.00484 -0.00484 -0.00484 -0.00484 -0.00484 ...
$ spatial.dist : num 60.5 60.5 60.5 60.5 60.5 ...
$ num.hubs : num 16 16 15 15 15 15 16 15 16 17 ...
$ E.local : num 0.77 0.77 0.77 0.77 0.77 ...
$ vulnerability : num 0.0157 0.0157 0.0157 0.0157 0.0157 ...
$ Study.ID : chr "153" "158" "162" "164" ...
$ atlas : chr "dk.scgm" "dk.scgm" "dk.scgm" "dk.scgm" ...
$ modality : chr "dti" "dti" "dti" "dti" ...
$ weighting : chr "sld" "sld" "sld" "sld" ...
$ Group : chr "1preem" "1preem" "1preem" "1preem" ...
$ sub.thresh : num 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
- attr(*, ".internal.selfref")=<externalptr>
>
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] grid parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] doMC_1.3.7 expm_0.999-6 oro.nifti_0.11.0 car_3.0-10 carData_3.0-4 mediation_4.5.0 sandwich_3.0-0 mvtnorm_1.1-1 ade4_1.7-16 Hmisc_4.4-2
[11] Formula_1.2-4 survival_3.2-7 ggrepel_0.9.1 gridExtra_2.3 scales_1.1.1 ggplot2_3.3.3 boot_1.3-28.1 intergraph_2.0-2 MASS_7.3-53 permute_0.9-5
[21] abind_1.4-5 Matrix_1.3-2 lattice_0.20-41 data.table_1.13.6 doParallel_1.0.16 iterators_1.0.13 foreach_1.5.1 brainGraph_3.0.2 igraph_1.2.6
loaded via a namespace (and not attached):
[1] minqa_1.2.4 colorspace_2.0-0 ellipsis_0.3.1 rio_0.5.16 rprojroot_2.0.2 htmlTable_2.1.0 base64enc_0.1-3 fs_1.5.0 rstudioapi_0.13
[10] remotes_2.4.0 codetools_0.2-18 splines_4.0.3 cachem_1.0.5 knitr_1.30 pkgload_1.2.1 nloptr_1.2.2.2 cluster_2.1.0 png_0.1-7
[19] compiler_4.0.3 backports_1.2.1 assertthat_0.2.1 fastmap_1.1.0 cli_2.5.0 htmltools_0.5.1 prettyunits_1.1.1 tools_4.0.3 gtable_0.3.0
[28] glue_1.4.2 dplyr_1.0.3 tinytex_0.29 Rcpp_1.0.6 cellranger_1.1.0 vctrs_0.3.6 nlme_3.1-151 xfun_0.20 stringr_1.4.0
[37] ps_1.5.0 network_1.16.1 openxlsx_4.2.3 testthat_3.0.3 lme4_1.1-26 lpSolve_5.6.15 lifecycle_1.0.0 devtools_2.4.2 statmod_1.4.35
[46] zoo_1.8-8 hms_1.0.0 RColorBrewer_1.1-2 yaml_2.2.1 curl_4.3 memoise_2.0.0 rpart_4.1-15 latticeExtra_0.6-29 stringi_1.5.3
[55] desc_1.3.0 RNifti_1.3.0 checkmate_2.0.0 pkgbuild_1.2.0 zip_2.1.1 bitops_1.0-6 rlang_0.4.10 pkgconfig_2.0.3 evaluate_0.14
[64] purrr_0.3.4 htmlwidgets_1.5.3 processx_3.5.2 tidyselect_1.1.0 magrittr_2.0.1 R6_2.5.0 generics_0.1.0 DBI_1.1.1 pillar_1.4.7
[73] haven_2.3.1 foreign_0.8-81 withr_2.4.2 nnet_7.3-14 tibble_3.0.5 crayon_1.3.4 rmarkdown_2.6 jpeg_0.1-8.1 progress_1.2.2
[82] usethis_2.0.1 readxl_1.3.1 callr_3.7.0 forcats_0.5.1 digest_0.6.27 munsell_0.5.0 sessioninfo_1.1.1
--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/b7effc41-854d-4f65-b7ee-ab82ca81b970n%40googlegroups.com.