User Tools

Site Tools


neuroimagen:altdti

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
neuroimagen:altdti [2019/03/18 10:08]
osotolongo [Variables de MB]
neuroimagen:altdti [2020/08/04 10:58] (current)
Line 1188: Line 1188:
 </code> </code>
  
 +**Hasta ahora:** En los sujetos con el alelo $\epsilon$-4 presente, la variable //funcioExecutiva_velocprocess_IM// tiene una ligera asociacion con la fraccion de anisotropia en la Default Mode Network y el SUVR de FBB. Esta asociación desaparece cuando no esta presente dicho alelo, siendo la escolaridad del sujeto la variable mas prominente en el caso de los sujetos con el alelo $\epsilon$-2.
 ==== Variables de MB ==== ==== Variables de MB ====
 +Hay un interes especial en las variables de los tesst "Piramides y Palmeras" y "Kissing and Dancing". Voy a extraer los valores,
 <code bash> <code bash>
 > awk -F";" '{print $2,$8,$9,$11,$286,$287,$288,$289,$412}' faceHBI_matriuREF_14-1-19-1.csv | sed 's/ /;/g; s/edat/Edad/; s/subject/Subject/; s/Anyos_Escolaridad_FAC/Escolaridad/; s/Sex_1H_0M/female/; s/Global_v1/SUVR/; s/Piramides_Y_Palmeras_Palab_FAC/PPp/; s/Piramides_Y_Plameras_Imag_FAC/PPi/; s/Kissing_Dancing_Imagenes_FAC/KDi/; s/Kissing_Dancing_Palabras_FAC/KDp/' > facehbi_data_mb.csv > awk -F";" '{print $2,$8,$9,$11,$286,$287,$288,$289,$412}' faceHBI_matriuREF_14-1-19-1.csv | sed 's/ /;/g; s/edat/Edad/; s/subject/Subject/; s/Anyos_Escolaridad_FAC/Escolaridad/; s/Sex_1H_0M/female/; s/Global_v1/SUVR/; s/Piramides_Y_Palmeras_Palab_FAC/PPp/; s/Piramides_Y_Plameras_Imag_FAC/PPi/; s/Kissing_Dancing_Imagenes_FAC/KDi/; s/Kissing_Dancing_Palabras_FAC/KDp/' > facehbi_data_mb.csv
Line 1194: Line 1196:
 facehbi_data_mb.csv                                                                 100% 5476   801.5KB/  00:00   facehbi_data_mb.csv                                                                 100% 5476   801.5KB/  00:00  
 </code> </code>
 +Los cargo, hago un composite con estas variables y miro los modelos.
 <code> <code>
 > fdata <-read.csv("facehbi_data_mb.csv", sep = ";", header=TRUE) > fdata <-read.csv("facehbi_data_mb.csv", sep = ";", header=TRUE)
Line 1332: Line 1334:
 F-statistic: 1.118 on 5 and 16 DF,  p-value: 0.3898 F-statistic: 1.118 on 5 and 16 DF,  p-value: 0.3898
 </code> </code>
 +Con lo cual me convenzo de que esto no vale para nada.
 +
 +===== Todas las redes =====
 +
 +No creo que funcione pero por completitud debo hacer el mismo procedimiento para todas las redes que hemos medido, esto es: DMN, FPCustom, LN y SN.
 +
 +<code bash>
 +[osotolongo@detritus facehbi]$ awk -F";" '{print $1";"$2}' facehbi_dti_LN.csv > facehbi_fa_LN.csv
 +[osotolongo@detritus facehbi]$ awk -F";" '{print $1";"$2}' facehbi_dti_SN.csv > facehbi_fa_SN.csv
 +[osotolongo@detritus facehbi]$ awk -F";" '{print $1";"$2}' facehbi_dti_DMN.csv > facehbi_fa_DMN.csv
 +[osotolongo@detritus facehbi]$ awk -F";" '{print $1";"$2}' facehbi_dti_FPCustom.csv > facehbi_fa_FPCustom.csv
 +[osotolongo@detritus facehbi]$ join -t";" -j 1 facehbi_fa_DMN.csv facehbi_fa_LN.csv > tmp.csv; join -t";" -j 1 tmp.csv facehbi_fa_SN.csv > tmp2.csv; join -t";" -j 1 tmp2.csv facehbi_fa_FPCustom.csv > facehbi_fa.csv; rm tmp.csv tmp2.csv
 +[osotolongo@detritus facehbi]$ head facehbi_fa.csv 
 +Subject;DMN_FA;LN_FA;SN_FA;FPCustom_FA
 +001;;;;
 +002;;;;
 +003;;;;
 +004;0.295167;0.297783;0.283152;0.257377
 +005;0.335169;0.304239;0.326038;0.309156
 +006;0.306471;0.303277;0.295983;0.285556
 +007;0.335922;0.323048;0.346638;0.303487
 +008;0.293183;0.271857;0.279124;0.266333
 +009;0.343917;0.318176;0.329685;0.319478
 +[osotolongo@detritus facehbi]$ cp facehbi_fa.csv ~/facehbi/dti_model/
 +</code>
 +
 +voy a cambiar el script de R para que me de algo mas de info,
 +
 +<code R>
 +library(QuantPsyc)
 +x<-read.csv("facehbi_dti_np.csv")
 +Color=c("red","blue")
 +scan("npvars.names", what = character())->np
 +scan("nivars.names", what = character())->ni
 +sink(file = "facehbi_dti_np_models.txt", append = TRUE, type = "output", split = FALSE)
 +
 +for(i in 1:length(np)){
 +        for(j in 1:length(ni)){
 +                y.data <- x[c(ni[j], np[i], "female", "Edad", "Escolaridad", "SUVR")]
 +                y.data <- y.data[complete.cases(y.data),]
 +                a <- lm( paste ('y.data$', np[i], ' ~ y.data$', ni[j], ' + y.data$SUVR + y.data$female + y.data$Edad + y.data$Escolaridad'))
 +                writeLines(paste("NP: ", np[i], " NI: ", ni[j]))
 +                writeLines(paste("R2: ", summary(a)$adj.r.squared, " p-value: ", 1-pf(summary(a)$fstatistic[1], summary(a)$fstatistic[2], summary(a)$fstatistic[3])))
 +                writeLines(paste("p-value (", ni[j],"): ", summary(a)$coef[2,4], " p-value (SUVR): ", summary(a)$coef[3,4]))
 +                beta <- lm.beta(a)
 +                for(k in 1:length(beta)){
 +                        writeLines(paste(names(beta[k]), ": ", beta[k]))
 +                }
 +                writeLines(paste("-------"))
 +        }
 +}
 +sink()
 +</code>
 +y a probar con los composites de nuevo,
 +<code bash>
 +[osotolongo@detritus dti_model]$ cat nivars.names 
 +DMN_FA
 +LN_FA
 +SN_FA
 +FPCustom_FA
 +[osotolongo@detritus dti_model]$ cat npvars.names 
 +funcioExecutiva_fluencia
 +funcioExecutiva_velocprocess_IM
 +funcioExecutiva_atencio
 +memoria_fnameProf
 +memoria_fnameNom
 +memoria_wms
 +memoria_rbans
 +gnosia
 +praxia
 +llenguatge_denom_IM
 +</code>
 +Empiezo con el global,
 +<code R>
 +> fdti <- read.csv("facehbi_fa.csv", sep=";", header=TRUE)
 +> fdata <-read.csv("facehbi_data.csv", sep = ";", header=TRUE)
 +> fapoe <-read.csv("facehbi_apoe_strats.csv", sep = ";", header=TRUE)
 +> okdata <- merge(fdata, fapoe, by = "Subject")
 +> okdata <- merge(okdata, fdti, by = "Subject")
 +> write.csv(okdata, file="facehbi_dti_np.csv")
 +> source("get_lms.r")
 +Read 10 items
 +Read 4 items
 +</code>
 +movemos los resultados,
 +<code bash>
 +[osotolongo@detritus dti_model]$ mv facehbi_dti_np_models.txt facehbi_dti_np_models_all.txt
 +</code>
 +y ahora a estratificar,
 +<code R>
 +> okdata0 <- okdata[okdata$APOE == "0",]
 +> write.csv(okdata0, file="facehbi_dti_np.csv")
 +> source("get_lms.r")
 +Read 10 items
 +Read 4 items
 +</code>
 +<code bash>
 +[osotolongo@detritus dti_model]$ mv facehbi_dti_np_models.txt facehbi_dti_np_models_0.txt
 +</code>
 +<code R>
 +> okdata1 <- okdata[okdata$APOE == "1",]
 +> write.csv(okdata1, file="facehbi_dti_np.csv")
 +> source("get_lms.r")
 +Read 10 items
 +Read 4 items
 +</code>
 +<code bash>
 +[osotolongo@detritus dti_model]$ mv facehbi_dti_np_models.txt facehbi_dti_np_models_1.txt
 +</code>
 +<code R>
 +> okdata2 <- okdata[okdata$APOE == "2",]
 +> write.csv(okdata2, file="facehbi_dti_np.csv")
 +> source("get_lms.r")
 +Read 10 items
 +Read 4 items
 +</code>
 +<code bash>
 +[osotolongo@detritus dti_model]$ mv facehbi_dti_np_models.txt facehbi_dti_np_models_2.txt
 +</code>
 +y lo voy a guardar, por si acaso,
 +<code bash>
 +[osotolongo@detritus dti_model]$ tar czvf facehbi_dti_np_models.tgz facehbi_dti_np_models_*
 +facehbi_dti_np_models_0.txt
 +facehbi_dti_np_models_1.txt
 +facehbi_dti_np_models_2.txt
 +facehbi_dti_np_models_all.txt
 +</code>
 +
 +**Nota:** Estos hay que revisarlos despacio pues puede haber alguna asosiacion con el SUVR que hayamos pasado por alto.
 +
 +Ahora el otro composite,
 +<code R>
 +> fdata <-read.csv("facehbi_data_mb.csv", sep = ";", header=TRUE)
 +> okdata <- merge(okdata, fdata, by = "Subject")
 +> okdata$zPPp = (okdata$PPp - mean(okdata$PPp, na.rm = TRUE))/sd(okdata$PPp, na.rm = TRUE)
 +> okdata$zPPi = (okdata$PPi - mean(okdata$PPi, na.rm = TRUE))/sd(okdata$PPi, na.rm = TRUE)
 +> okdata$zKDi = (okdata$KDi - mean(okdata$KDi, na.rm = TRUE))/sd(okdata$KDi, na.rm = TRUE)
 +> okdata$zKDp = (okdata$KDp - mean(okdata$KDp, na.rm = TRUE))/sd(okdata$KDp, na.rm = TRUE)
 +> mb <- data.frame(okdata$zPPp, okdata$zPPi, okdata$zKDp, okdata$zKDi)
 +> okdata$cs <- mbsc$scores
 +</code>
 +<code bash>
 +[osotolongo@detritus dti_model]$ cat npvars.names
 +cs
 +</code>
 +<code R>
 +> write.csv(okdata, file="facehbi_dti_np.csv")
 +> source("get_lms.r")
 +Read 1 item
 +Read 4 items
 +</code>
 +y lo hago estratificado tambien, (moviendo los outputs como antes)
 +<code R>
 +> okdata0 <- okdata[okdata$APOE == "0",]
 +> write.csv(okdata0, file="facehbi_dti_np.csv")
 +> source("get_lms.r")
 +Read 1 item
 +Read 4 items
 +> okdata1 <- okdata[okdata$APOE == "1",]
 +> write.csv(okdata1, file="facehbi_dti_np.csv")
 +> source("get_lms.r")
 +Read 1 item
 +Read 4 items
 +> okdata2 <- okdata[okdata$APOE == "2",]
 +> write.csv(okdata2, file="facehbi_dti_np.csv")
 +> source("get_lms.r")
 +Read 1 item
 +Read 4 items
 +</code>
 +y aqui si no hay nada de nada.
 +Voy a hacerme un script para sacar cuando R2 es mayor que //0.3// por poner un numero,
 +<code perl checkr2.pl>
 +#!/usr/bin/perl
 +
 +use strict;
 +use warnings;
 +use Data::Dump qw(dump);
 +
 +my $ifile = "facehbi_dti_np_models_all.txt";
 +my $thresh = 0.3;
 +my %model;
 +open IDF, "<$ifile" or die "No such file\n";
 +while (<IDF>){
 +        if (/-------/ && $model{"r2"}>0.3) {
 +                print $model{"ni_var"}.",".$model{np_var}."\nr2 = ".$model{"r2"}.", p-value = ".$model{"pvalue"}."\npv_".$model{"ni_var"}." = ".$model{"pv_ni"}.", pv_SUVR = ".$model{pv_suvr}." \n";
 +        };
 +        if (/^NP:.*/) {($model{"np_var"}, $model{"ni_var"}) = /^NP:\s+(\w+)\s+NI:\s+(\w+)\s*$/};
 +        if (/^R2:.*/) {($model{"r2"}, $model{"pvalue"}) = /^R2:\s+(\S+)\s+p-value:\s+(\S+)/};
 +        if (/^p-value.*/) {($model{"pv_ni"}, $model{"pv_suvr"}) = /p-value.*:\s+(\S+)\s+p-value.*:\s+(\S+)/}
 +}
 +close IDF;
 +</code>
 +
 +Para todos,
 +
 +<code>
 +[osotolongo@detritus dti_model]$ ./checkr2.pl 
 +Analizing facehbi_dti_np_models_all.txt ...
 +
 +DMN_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.302226155665606, p-value = 1.59872115546023e-14
 +pv_DMN_FA = 0.883576950793585, pv_SUVR = 0.24424229051191 
 +
 +LN_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.302579788141454, p-value = 1.53210777398272e-14
 +pv_LN_FA = 0.731754149108559, pv_SUVR = 0.239811378742586 
 +
 +SN_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.302699583800708, p-value = 1.50990331349021e-14
 +pv_SN_FA = 0.698477685239432, pv_SUVR = 0.241344996365449 
 +
 +FPCustom_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.303857285316447, p-value = 1.28785870856518e-14
 +pv_FPCustom_FA = 0.495322950618766, pv_SUVR = 0.229845691710707 
 +</code>
 +
 +//APOE 0//
 +
 +<code>
 +[osotolongo@detritus dti_model]$ ./checkr2.pl 
 +Analizing facehbi_dti_np_models_0.txt ...
 +
 +DMN_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.379552223636583, p-value = 0.0057104958050207
 +pv_DMN_FA = 0.639790744923555, pv_SUVR = 0.0157173219667127 
 +
 +LN_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.373746758451691, p-value = 0.00627788677009611
 +pv_LN_FA = 0.922726301726418, pv_SUVR = 0.0179719566898906 
 +
 +SN_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.373504904382816, p-value = 0.00630256049240607
 +pv_SN_FA = 0.978604565669928, pv_SUVR = 0.0176943724392262 
 +
 +FPCustom_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.376679557258316, p-value = 0.00598535915763587
 +pv_FPCustom_FA = 0.734462972707933, pv_SUVR = 0.0164897973831555 
 +
 +DMN_FA, memoria_wms
 +r2 = 0.384900678414176, p-value = 0.00522814187347165
 +pv_DMN_FA = 0.971755525011924, pv_SUVR = 0.126202366929838 
 +
 +LN_FA, memoria_wms
 +r2 = 0.476189288707085, p-value = 0.000987730906959694
 +pv_LN_FA = 0.0571602758952463, pv_SUVR = 0.0786860000743259 
 +
 +SN_FA, memoria_wms
 +r2 = 0.4105573407532, p-value = 0.00337775223148928
 +pv_SN_FA = 0.327134537994976, pv_SUVR = 0.110122034640346 
 +
 +FPCustom_FA, memoria_wms
 +r2 = 0.38938771125582, p-value = 0.00485148460500173
 +pv_FPCustom_FA = 0.683663237630694, pv_SUVR = 0.141496294121895 
 +</code>
 +
 +//APOE 1// --> **nada**
 +
 +//APOE 2//
 +
 +<code>
 +[osotolongo@detritus dti_model]$ ./checkr2.pl 
 +Analizing facehbi_dti_np_models_2.txt ...
 +
 +DMN_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.485798156550142, p-value = 2.68765592381648e-06
 +pv_DMN_FA = 0.00443564461139048, pv_SUVR = 0.00250803493024018 
 +
 +LN_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.391142446695136, p-value = 7.40330891934038e-05
 +pv_LN_FA = 0.298247246087403, pv_SUVR = 0.00913580342963226 
 +
 +SN_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.473679765360014, p-value = 4.26313995949279e-06
 +pv_SN_FA = 0.0075840881661726, pv_SUVR = 0.00315334075632377 
 +
 +FPCustom_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.420481875101633, p-value = 2.83138960435192e-05
 +pv_FPCustom_FA = 0.0767718841930776, pv_SUVR = 0.00977255081753087 
 +
 +DMN_FA, memoria_fnameProf
 +r2 = 0.327588088792215, p-value = 0.000497956057757376
 +pv_DMN_FA = 0.773974302319369, pv_SUVR = 0.788744944522824 
 +
 +LN_FA, memoria_fnameProf
 +r2 = 0.382914152316493, p-value = 9.60047895888216e-05
 +pv_LN_FA = 0.0561917139565343, pv_SUVR = 0.624162892962772 
 +
 +SN_FA, memoria_fnameProf
 +r2 = 0.327676768593875, p-value = 0.000496710477748463
 +pv_SN_FA = 0.76680425794751, pv_SUVR = 0.789799021308529 
 +
 +FPCustom_FA, memoria_fnameProf
 +r2 = 0.331099185559454, p-value = 0.000450805039077462
 +pv_FPCustom_FA = 0.584035234528739, pv_SUVR = 0.810357038625016 
 +
 +DMN_FA, memoria_fnameNom
 +r2 = 0.328367049483929, p-value = 0.000487113972439834
 +pv_DMN_FA = 0.898296424312723, pv_SUVR = 0.0560073342550184 
 +
 +LN_FA, memoria_fnameNom
 +r2 = 0.330867944990235, p-value = 0.000453777260227328
 +pv_LN_FA = 0.679077371093828, pv_SUVR = 0.0600344325872235 
 +
 +SN_FA, memoria_fnameNom
 +r2 = 0.331778400581458, p-value = 0.000442179712075386
 +pv_SN_FA = 0.633252108652689, pv_SUVR = 0.0601087607629487 
 +
 +FPCustom_FA, memoria_fnameNom
 +r2 = 0.334618953643581, p-value = 0.000407752047013266
 +pv_FPCustom_FA = 0.524784142484717, pv_SUVR = 0.0519653979539324 
 +
 +DMN_FA, memoria_wms
 +r2 = 0.30272247894919, p-value = 0.000989109715828107
 +pv_DMN_FA = 0.228059068988977, pv_SUVR = 0.472409952167858 
 +
 +</code>
 +
 +Voy a mirar un poco,
 +
 +<code R>
 +> m0 <- lm(okdata0$funcioExecutiva_velocprocess_IM ~ okdata0$SUVR + okdata0$Edad)
 +> summary(m0)
 +
 +Call:
 +lm(formula = okdata0$funcioExecutiva_velocprocess_IM ~ okdata0$SUVR + 
 +    okdata0$Edad)
 +
 +Residuals:
 +    Min      1Q  Median      3Q     Max 
 +-1.3337 -0.5111 -0.1135  0.3141  2.5369 
 +
 +Coefficients:
 +             Estimate Std. Error t value Pr(>|t|)   
 +(Intercept)   2.79206    3.21204   0.869  0.39267   
 +okdata0$SUVR -6.70012    2.41598  -2.773  0.01013 * 
 +okdata0$Edad  0.07533    0.02137   3.526  0.00159 **
 +---
 +Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 +
 +Residual standard error: 0.9002 on 26 degrees of freedom
 +Multiple R-squared:  0.4416, Adjusted R-squared:  0.3987 
 +F-statistic: 10.28 on 2 and 26 DF,  p-value: 0.0005129
 +
 +> m1 <- lm(okdata1$funcioExecutiva_velocprocess_IM ~ okdata1$SUVR + okdata1$Edad)
 +> summary(m1)
 +
 +Call:
 +lm(formula = okdata1$funcioExecutiva_velocprocess_IM ~ okdata1$SUVR + 
 +    okdata1$Edad)
 +
 +Residuals:
 +    Min      1Q  Median      3Q     Max 
 +-1.2138 -0.5730 -0.1959  0.2146  4.7844 
 +
 +Coefficients:
 +              Estimate Std. Error t value Pr(>|t|)    
 +(Intercept)  -4.200673   1.052358  -3.992 0.000114 ***
 +okdata1$SUVR  0.002109   0.780712   0.003 0.997849    
 +okdata1$Edad  0.063894   0.011991   5.328 4.82e-07 ***
 +---
 +Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 +
 +Residual standard error: 0.8937 on 118 degrees of freedom
 +  (1 observation deleted due to missingness)
 +Multiple R-squared:  0.2052, Adjusted R-squared:  0.1918 
 +F-statistic: 15.24 on 2 and 118 DF,  p-value: 1.3e-06
 +
 +> m2 <- lm(okdata2$funcioExecutiva_velocprocess_IM ~ okdata2$SUVR + okdata2$Edad)
 +> summary(m2)
 +
 +Call:
 +lm(formula = okdata2$funcioExecutiva_velocprocess_IM ~ okdata2$SUVR + 
 +    okdata2$Edad)
 +
 +Residuals:
 +     Min       1Q   Median       3Q      Max 
 +-1.74708 -0.28264 -0.07348  0.26384  2.76441 
 +
 +Coefficients:
 +             Estimate Std. Error t value Pr(>|t|)    
 +(Intercept)  -4.49416    1.14875  -3.912   0.0003 ***
 +okdata2$SUVR  1.34940    0.54032   2.497   0.0161 *  
 +okdata2$Edad  0.04144    0.01738   2.384   0.0213 *  
 +---
 +Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 +
 +Residual standard error: 0.8034 on 46 degrees of freedom
 +Multiple R-squared:  0.2749, Adjusted R-squared:  0.2434 
 +F-statistic: 8.719 on 2 and 46 DF,  p-value: 0.0006158
 +</code>
 +
 +
 +===== Riesgo - No riesgo =====
 +
 +Vamosaplantear el problema de manera distinta. Supongamos que la contribucion del APOE depende solo de la presencia del alelo $\epsilon$-4 y clasifiquemos los sujetos segun esto, en //con riesgo// o //sin riesgo//.
 +
 +<code R>
 +> okdata$Risk <- ifelse (okdata$APOE==2 , 1, 0)
 +</code>
 +
 +Pero ahora voy a hacer una cosa un poco mas complicada,
 +
 +<code R get_lms2.r>
 +library(QuantPsyc)
 +x<-read.csv("facehbi_dti_np.csv")
 +Color=c("red","blue")
 +scan("npvars.names", what = character())->np
 +scan("nivars.names", what = character())->ni
 +sink(file = "facehbi_dti_np_models.txt", append = TRUE, type = "output", split = FALSE)
 +
 +for(i in 1:length(np)){
 +        for(j in 1:length(ni)){
 +                y.data <- x[c(ni[j], np[i], "female", "Edad", "Escolaridad", "SUVR", "Risk")]
 +                y.data <- y.data[complete.cases(y.data),]
 +                a <- lm( paste ('y.data$', np[i], ' ~ y.data$', ni[j], ' + y.data$SUVR +y.data$Risk + y.data$female + y.data$Edad + y.data$Escolaridad + ', 'y.data$', ni[j], '*y.data$Risk'))
 +                writeLines(paste("NP: ", np[i], " NI: ", ni[j]))
 +                writeLines(paste("R2: ", summary(a)$adj.r.squared, " p-value: ", 1-pf(summary(a)$fstatistic[1], summary(a)$fstatistic[2], summary(a)$fstatistic[3])))
 +                writeLines(paste("p-value (", ni[j],"): ", summary(a)$coef[2,4], " p-value (SUVR): ", summary(a)$coef[3,4]))
 +                beta <- lm.beta(a)
 +                for(k in 1:length(beta)){
 +                        writeLines(paste(names(beta[k]), ": ", beta[k]))
 +                }
 +                writeLines(paste("-------"))
 +        }
 +}
 +sink()
 +</code>
 +
 +Asi que pruebo con el global,
 +
 +<code R>
 +> write.csv(okdata, file="facehbi_dti_np.csv")
 +> source("get_lms2.r")
 +</code>
 +
 +y luego,
 +
 +<code bash>
 +[osotolongo@detritus dti_model]$ ./checkr2.pl 
 +Analizing facehbi_dti_np_models.txt ...
 +
 +DMN_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.312799089824939, p-value = 2.93098878501041e-14
 +pv_DMN_FA = 0.476462254461098, pv_SUVR = 0.179281559330912 
 +
 +SN_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.311504329049638, p-value = 3.47499806707674e-14
 +pv_SN_FA = 0.551975051522526, pv_SUVR = 0.181998130409768 
 +
 +FPCustom_FA, funcioExecutiva_velocprocess_IM
 +r2 = 0.311678871879767, p-value = 3.39728245535298e-14
 +pv_FPCustom_FA = 0.151421806156447, pv_SUVR = 0.201473541858229 
 +</code>
 +
 +puaf, a ver,
 +
 +<code R>
 +> m <- lm(okdata$funcioExecutiva_velocprocess_IM ~ okdata$SUVR + okdata$Edad + okdata$Escolaridad + okdata$female + okdata$DMN_FA*okdata$Risk)
 +> summary(m)
 +
 +Call:
 +lm(formula = okdata$funcioExecutiva_velocprocess_IM ~ okdata$SUVR + 
 +    okdata$Edad + okdata$Escolaridad + okdata$female + okdata$DMN_FA * 
 +    okdata$Risk)
 +
 +Residuals:
 +    Min      1Q  Median      3Q     Max 
 +-1.4094 -0.5672 -0.1264  0.3442  4.3680 
 +
 +Coefficients:
 +                           Estimate Std. Error t value Pr(>|t|)    
 +(Intercept)                -4.12971    1.33068  -3.103  0.00221 ** 
 +okdata$SUVR                 0.58201    0.43176   1.348  0.17928    
 +okdata$Edad                 0.05310    0.00865   6.139 4.82e-09 ***
 +okdata$Escolaridad         -0.04301    0.01362  -3.157  0.00186 ** 
 +okdata$female              -0.38688    0.13066  -2.961  0.00346 ** 
 +okdata$DMN_FA               2.24716    3.14978   0.713  0.47646    
 +okdata$Risk                 5.03080    2.38260   2.111  0.03605 *  
 +okdata$DMN_FA:okdata$Risk -15.70430    7.30118  -2.151  0.03276 *  
 +---
 +Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 +
 +Residual standard error: 0.8286 on 188 degrees of freedom
 +  (4 observations deleted due to missingness)
 +Multiple R-squared:  0.3375, Adjusted R-squared:  0.3128 
 +F-statistic: 13.68 on 7 and 188 DF,  p-value: 2.936e-14
 +</code>
 +
 +No, gracias. :-\
  
neuroimagen/altdti.1552903729.txt.gz · Last modified: 2020/08/04 10:45 (external edit)