# Detritus Wiki

### Site Tools

This is an old revision of the document!

# Using ADNI data for Cusp model fitting

## Simple way

Auditory Verbal Learning Test fitted with Whole gray matter and covariables.

 # Estevez-Gonzalez, A., Kulisevsky, J., Boltes, A., Otermin, P., & Garcia-Sanchez, C. (2003).
# Rey verbal learning test is a useful tool for differential diagnosis in the preclinical phase
# of Alzheimer's disease: comparison with mild cognitive impairment and normal aging.
# International Journal of Geriatric Psychiatry. 18 (11), 1021.
library("ADNIMERGE")
library(cusp)
library(psych) #for composite scores
# Let's get the data
tmp_np <- merge(adas, neurobat, by=c("RID", "VISCODE") )
mt2fa <- merge(tmp_np, adnimerge, by=c("RID", "VISCODE") )
rm(tmp_np)
# Calculate the subject age at every point
mt2fa$vAGE = mt2fa$AGE + mt2fa$Years data <- data.frame(mt2fa$WholeBrain, mt2fa$ICV, mt2fa$vAGE, mt2fa$PTGENDER, mt2fa$PTEDUCAT, mt2fa$AVDEL30MIN, mt2fa$AVDELTOT)
datac <- data[complete.cases(data),]
datac$WB = datac$mt2fa.WholeBrain/datac$mt2fa.ICV fit_avd <- cusp(y ~ mt2fa.AVDEL30MIN, alpha ~ WB +mt2fa.vAGE + mt2fa.PTGENDER +mt2fa.PTEDUCAT, beta ~ WB +mt2fa.vAGE + mt2fa.PTGENDER +mt2fa.PTEDUCAT, datac) summary(fit_avd) Amazing results ## Z-scores Now let's compare the weights of each variable on the model. We need to translate everything to z-scores (or just do another linear transformation that carry every thing to comparable values) datac$zWB = (datac$WB - mean(datac$WB))/sd(datac$WB) datac$zAge = (datac$mt2fa.vAGE - mean(datac$mt2fa.vAGE))/sd(datac$mt2fa.vAGE) datac$zEduc = (datac$mt2fa.PTEDUCAT - mean(datac$mt2fa.PTEDUCAT))/sd(datac$mt2fa.PTEDUCAT) datac$zAVD = (datac$mt2fa.AVDEL30MIN - mean(datac$mt2fa.AVDEL30MIN))/sd(datac$mt2fa.AVDEL30MIN) fit_avd_z <- cusp(y ~ zAVD, alpha ~ zWB + zAge + mt2fa.PTGENDER + zEduc, beta ~ zWB +zAge + mt2fa.PTGENDER + zEduc, datac) summary(fit_avd_z) The results are of course the same but the coefficients must be meaningful now, ## Composite scores First I'm going to try another NP test (Recognition) fit_avr <- cusp(y ~ zAVR, alpha ~ zWB + zAge + mt2fa.PTGENDER + zEduc, beta ~ zWB +zAge + mt2fa.PTGENDER + zEduc, datac) and this is not so good but still an improvement is done Now, let's try a composite score gfam <- data.frame(datac$zAVD, datac$zAVR) famod <- fa(gfam, scores="regression") datac$cs <- famod$scores fit_cs <- cusp(y ~ cs, alpha ~ zWB + zAge + mt2fa.PTGENDER + zEduc, beta ~ zWB +zAge + mt2fa.PTGENDER + zEduc, datac) And we get a very bad fit result That is, the composite score is not related through a cusp model to the independent variable analyzed here ## A try for ADAS-Cog data <- data.frame(mt2fa$WholeBrain, mt2fa$ICV, mt2fa$vAGE, mt2fa$PTGENDER, mt2fa$PTEDUCAT, mt2fa$Q4SCORE, mt2fa$Q8SCORE)
datac <- data[complete.cases(data),]
datac$WB = datac$mt2fa.WholeBrain/datac$mt2fa.ICV datac$zWB = (datac$WB - mean(datac$WB))/sd(datac$WB) datac$zAge = (datac$mt2fa.vAGE - mean(datac$mt2fa.vAGE))/sd(datac$mt2fa.vAGE) datac$zEduc = (datac$mt2fa.PTEDUCAT - mean(datac$mt2fa.PTEDUCAT))/sd(datac$mt2fa.PTEDUCAT) datac$dr = (mean(datac$mt2fa.Q4SCORE) - datac$mt2fa.Q4SCORE)/sd(datac$mt2fa.Q4SCORE) datac$r = (mean(datac$mt2fa.Q8SCORE) - datac$mt2fa.Q8SCORE)/sd(datac\$mt2fa.Q8SCORE)
fit_dr <- cusp(y ~ dr, alpha ~ zWB + zAge + mt2fa.PTGENDER + zEduc, beta ~ zWB +zAge + mt2fa.PTGENDER + zEduc, datac)
fit_r <- cusp(y ~ r, alpha ~ zWB + zAge + mt2fa.PTGENDER + zEduc, beta ~ zWB +zAge + mt2fa.PTGENDER + zEduc, datac)

not bad at all for Delay Recall

but worst for Recognition

## Notas para Composite Scores

Lo ideal seria hacer script con todos los composites posibles y mirarlo contra los biomarcadores disponibles en adnimerge. Pero cada biomarcador lleva un tipo de procesamiento distinto y cada composite ha de ser definido previamente. Por ejemplo el composite de Delay Recall (drcs) lo construimos a partir de adas.Q4SCORE y neurobat.AVDEL30MIN pero en cada caso hay que definir las variables de partida.

> names(adnimerge)
[1] "ORIGPROT"                 "COLPROT"                  "RID"                      "PTID"
[5] "VISCODE"                  "EXAMDATE"                 "SITE"                     "DX.bl"
[9] "AGE"                      "PTGENDER"                 "PTEDUCAT"                 "PTETHCAT"
[13] "PTRACCAT"                 "PTMARRY"                  "APOE4"                    "FDG"
[25] "RAVLT.forgetting"         "RAVLT.perc.forgetting"    "FAQ"                      "MOCA"
[29] "EcogPtMem"                "EcogPtLang"               "EcogPtVisspat"            "EcogPtPlan"
[33] "EcogPtOrgan"              "EcogPtDivatt"             "EcogPtTotal"              "EcogSPMem"
[37] "EcogSPLang"               "EcogSPVisspat"            "EcogSPPlan"               "EcogSPOrgan"
[41] "EcogSPDivatt"             "EcogSPTotal"              "FLDSTRENG"                "FSVERSION"
[45] "Ventricles"               "Hippocampus"              "WholeBrain"               "Entorhinal"
[49] "Fusiform"                 "MidTemp"                  "ICV"                      "DX"
[57] "MMSE.bl"                  "RAVLT.immediate.bl"       "RAVLT.learning.bl"        "RAVLT.forgetting.bl"
[61] "RAVLT.perc.forgetting.bl" "FAQ.bl"                   "FLDSTRENG.bl"             "FSVERSION.bl"
[65] "Ventricles.bl"            "Hippocampus.bl"           "WholeBrain.bl"            "Entorhinal.bl"
[69] "Fusiform.bl"              "MidTemp.bl"               "ICV.bl"                   "MOCA.bl"
[73] "EcogPtMem.bl"             "EcogPtLang.bl"            "EcogPtVisspat.bl"         "EcogPtPlan.bl"
[77] "EcogPtOrgan.bl"           "EcogPtDivatt.bl"          "EcogPtTotal.bl"           "EcogSPMem.bl"
[81] "EcogSPLang.bl"            "EcogSPVisspat.bl"         "EcogSPPlan.bl"            "EcogSPOrgan.bl"
[85] "EcogSPDivatt.bl"          "EcogSPTotal.bl"           "FDG.bl"                   "PIB.bl"
[89] "AV45.bl"                  "Years.bl"                 "Month.bl"                 "Month"
[93] "M"      

El problema es que cada uno debe ser analizado de manera distinta. Las variables Ventricles, Hippocampus y WholeBrain deben de alguna manera normalizarse por ICV (revisar Entorhinal, Fusiform y MidTemp) mientras que FDG, PIB y AV45 son variables normalizadas.

library("ADNIMERGE")
library(cusp)
library(psych) #for composite scores
# Let's get the data
tmp_np <- merge(adas, neurobat, by=c("RID", "VISCODE") )
m <- merge(tmp_np, adnimerge, by=c("RID", "VISCODE") )
rm(tmp_np)