Prima di analizzare i modelli statistici basati sui metaboliti, facciamo alcune osser-vazioni sulle prestazioni del PSA nel dataset in esame.
Si era osservato in Figura 3.2 che i valori del PSA per tutti i pazienti erano su-periori a 4; tale valore corrisponde al cut-off attualmente adottato nella diagnosi del carcinoma alla prostata. Da questa osservazione possiamo affermare che, nel caso in esame, il test del PSA ha specificitá uguale a zero: nessun paziente viene predetto come "sano". Inoltre la curva ROC derivante da tale biomarcatore, sempre nel dataset in esame, ha un indice AU C = 0.523 (valore prossimo al classificatore casuale).
Procediamo ora alla descrizione dei modelli costruiti basandoci sui risultati delle analisi univariata e multivariata.
I risultati delle analisi univariate hanno identificato tutte, indipendentemente dalla trasformazione applicata, le seguenti variabili significative:
• ID36_417_1257,
• ID220_441_1036
• ID211_485_1041
• ID249_329_770.
Si é pertanto deciso di costruire un modello composto dalla variabile Etá (che come osservato in Figura 3.1 risulta abbastanza differente tra i due gruppi) e dai meta-boliti sopra elencati, senza ricorrere alle trasformazioni di Classe II (auto scaling e level scaling) testate nel paragrafo3.4.
Al modello logistico costruito su tali variabili é stata applicata la cross validation imponendo un numero di sottoinsiemi k = 10.
La valutazione del modello cosí ottenuto é stata effettuata tramite la costruzione della curva ROC e in particolare attraverso la valutazione dell’indice AUC (Figura 3.23). Il cut-off ottimale é stato quindi calcolato a partire da tale curva con i criteri Youden e della minima distanza dal punto con specificitá e sensibilitá unitarie.
Le prestazioni del modello sono sinteticamente riportate di seguito:
AUC = 0.612 Youden = 0.221 min-distance = 0.571
Figura 3.23: Curva ROC per il modello derivante dalle analisi univariata.
La procedura precedentemente descritta é stata ripetuta anche per i modelli che seguono. In particolare, si sono effettuati alcuni tentativi per identificare delle varianti di tale modello che portassero a un miglioramento delle prestazioni; il piú promettente é risultato essere quello definito dalle seguenti variabili:
• ID36_417_1257,
• ID220_441_1036,
• ID211_485_1041,
• Etá.
In Figura3.24é riportata la curva ROC ottenuta, mentre le prestazioni del modello sono:
AUC = 0.645 Youden = 0.303 min-distance = 0.513 .
Figura 3.24: Curva ROC per il modello modificato derivante dalle analisi univariata.
Per tale modello, scelto il cut-off definito dall’indice Youden, riportiamo la matrice di confusione in Figura 3.25.
Da tale tabella ricaviamo la specificitá e la sensibilitá:
specificitá = 0.793 sensibilitá = 0.510 .
valore vero
valore predetto
PCa BPH
25 24
PCa
11 42
BPH
Figura 3.25: Matrice di confusione per il modello modificato derivante dalle analisi univariata.
Lo stesso modello, privato della variabile "Etá" dá invece i seguenti risultati:
AUC = 0.610 Youden = 0.254 min-distance = 0.528 .
La curva ROC corrispondente é rappresentata in Figura 3.26.
Confrontando tali indici, con quelli del modello precedente, si constata una netta inferioritá di quest’ultimo modello; l’etá risulta dunque una variabile importante ai fini della predizione.
Infine, é stato costruito un modello sulla base dei risultati dell’analisi multivariata (paragrafo3.5) considerando le seguenti variabili:
• ID36_417_1257,
• Etá,
• ID249_329_770,
• ID220_441_1036,
• ID167_314_1220.
Figura 3.26: Curva ROC per il modello modificato in cui é stata rimossa dal set di predittori anche etá.
In Figura 3.27 viene mostrata la curva ROC associata a tale modello. I valori dei principali indicatori sono:
AUC = 0.637 Youden = 0.246 min-distance = 0.547 .
Mentre la sensibilitá e la specificitá (utilizzando il cut-off associato all’indice Youden):
specificitá = 0.490 sensibilitá = 0.755
In accordo con quanto indicato da Xia [3], le prestazione dei modelli analizzati, sep-pur migliori del PSA, ricadendo negli intervalli AU C = 0.6 − 0.7 risultano ancora limitate.
L’analisi dei modelli ha permesso di rafforzare quanto giá inizialmente evidenziato dalle analisi univariata e multivariata; in particolare nelle analisi univariata non
Figura 3.27: Curva ROC per il modello derivante dalle analisi multivariata.
comparivano metaboliti significativi correggendo per test multipli, mentre nell’ana-lisi multivariata il valore minimo della devianza al variare del parametro di penalitá era identificato dal modello con nessun predittore.
Ricordiamo che i vari modelli e gli indicatori ad essi associati sono stati definiti tramite la cross validation per evitare il fenomeno di overfitting; un diverso parti-zionamento (casuale) dei campioni in fase di cross validation puó quindi portare a risultati leggermente differenti.
Conclusioni
Il recente sviluppo della metabolomica é stato favorito alla nascita di tecniche stru-mentali, quali la risonanza magnetica nucleare e la spettrometria di massa, in grado di misurare, attraverso un unico esperimento, migliaia di metaboliti contempora-neamente (approccio omico).
La disponibilitá di questa vasta mole di informazioni ha permesso di migliorare il processo di identificazioni dei reali fattori associabili ai diversi stati fisiologici.
La necessitá di elaborazione di questa grande varietá di dati ha richiesto e favorito lo sviluppo di numerosi metodi statistici specifici.
Si é osservarvato in letteratura una proliferazione di studi e ricerche che descrivono l’applicazione di tali metodi statistici ai piú svariati campi della biomedicina per l’identificazione di nuovi biomarcatori non invasivi.
A differenza della genomica, la metabolomica presenta una difficoltá maggiore le-gata all’elevata variabilitá dei metaboliti stessi (essi sono infatti il risultato dell’in-terazione dell’espressione genica con l’ambiente in cui viviamo).
Il caso analizzato nella presente trattazione riguarda uno dei tumori piú diffusi, quello prostatico. Ad oggi, l’antigene prostatico specifico (PSA) é il biomarcatore piú utilizzato per la diagnosi di tumore alla prostata. Tuttavia, a causa delle elevate percentuali di falsi positivi e falsi negativi, non risulta essere un buon indicatore diagnostico. Il set di dati usato per le analisi é stato fornito dal laboratorio di Far-macogenomica dei Tumori, Fondazione Edo e Elvo Tempia di Biella e consisteva in 102 campioni per i quali sono stati misurati, mediante la spettrometria di massa accoppiata con la cromatografia liquida, le concentrazioni di 254 metaboliti. Di questi 102 pazienti, 53 risultavano affetti da iperplasia prostatica benigna (BPH) mentre i restanti hanno contratto il carcinoma della prostata (PCa).
L’obiettivo dello studio condotto é stato di identificare nuovi possibili biomarca-tori tra i metaboliti misurabili nel sangue. Si é costruito un modello logistico, selezionando le variabili sulla base dei risultati di analisi univariate e multivariate.
Diversi metodi di normalizzazione e trasformazione sono stati applicati per ridurre le variabilitá non biologiche del dataset. I modelli analizzati hanno permesso di
individuare alcuni metaboliti "promettenti" e di costruire un classificatore la cui capacitá di predizione appare superiore al PSA. Tuttavia i risultati ottenuti sono ancora troppo limitati per poter includere questi metaboliti come nuovi biomarca-tori diagnostici del tumore alla prostata.
Una continua ricerca per migliorare le analisi strumentali associata ad una maggior conoscenza dei fenomeni biologici in esame ed alla possibilitá di raccolta di dati relativi a una popolazione piú estesa potranno facilitare in futuro l’identificazione di piú efficaci biomarcatori.
Codice R utilizzato
1. "Analisi preliminare del dataset ":
# L e g g o dataset , t r a s f o r m o in NA i v a l o r i 0, a p p l i c o log1 0 d a t a s e t =r e a d.t a b l e(" H i g h F r e q _ R e p r e s e n t e d _ mod . txt ",...
... sep = " \ t ", dec =" . ", h e a d e r = T ) r o w n a m e s( d a t a s e t )= d a t a s e t $ N a m e d a t a s e t $ N a m e = N U L L
m e t a b o l i t i = d a t a s e t [ ,1:2 5 4] m e t a b o l i t i [ m e t a b o l i t i ==0]= NA d a t a s e t [ ,1:2 5 4]= m e t a b o l i t i sum(is.na( m e t a b o l i t i ))
m e t a b o l i t i =log 1 0( m e t a b o l i t i )
# Box - p l o t PSA
png (" b o x P l o t P S A . png ")
b o x p l o t( as .n u m e r i c( as . c h a r a c t e r ( d a t a s e t $ PSA ) ) ~ . . . ... as . c h a r a c t e r ( d a t a s e t $ T y p e ) , y l a b =" PSA ")
t e x t( y =f i v e n u m( d a t a s e t $ PSA [w h i c h( d a t a s e t $ T y p e ==" BPH ")]) ,...
... l a b e l s =f i v e n u m( d a t a s e t $ PSA [w h i c h( d a t a s e t $ T y p e ==" BPH ")]) ,...
... x =1.4 5, cex = 0.8)
t e x t( y =f i v e n u m( d a t a s e t $ PSA [w h i c h( d a t a s e t $ T y p e ==" PCa ")]) ,...
...l a b e l s =f i v e n u m( d a t a s e t $ PSA [w h i c h( d a t a s e t $ T y p e ==" PCa ")]) ,...
... x =2.4 5, cex = 0.8) dev.off()
# D e n s i t y p l o t PSA
d a t a s e t O r d = d a t a s e t [o r d e r(r o w n a m e s( d a t a s e t )) ,]
png (" d e n s i t y p s a . png ")
p l o t(d e n s i t y( as .n u m e r i c( as . c h a r a c t e r ( d a t a s e t O r d [1:5 3," PSA "] ) ) ) , . . . ... m a i n =" ", lty =1)
l i n e s(d e n s i t y( as .n u m e r i c( as . c h a r a c t e r ( d a t a s e t O r d [5 4:1 0 2," PSA "] ) ) ) , . . . ... lty =2)
l e g e n d(" t o p l e f t ", l e g e n d=c(" BPH ", " PCa ") , lty =c(1,2) , cex =0.8) dev.off()
# Box - p l o t Eta
png (" b o x P l o t E t a . png ")
b o x p l o t( d a t a s e t $ Age ~ d a t a s e t $ T y p e )
t e x t( y =f i v e n u m( d a t a s e t $ Age [w h i c h( d a t a s e t $ T y p e ==" BPH ")]) ,...
...l a b e l s =f i v e n u m( d a t a s e t $ Age [w h i c h( d a t a s e t $ T y p e ==" BPH ")]) ,...
... x =1.4 5, cex = 0.8)
t e x t( y =f i v e n u m( d a t a s e t $ Age [w h i c h( d a t a s e t $ T y p e ==" PCa ")]) ,...
... l a b e l s =f i v e n u m( d a t a s e t $ Age [w h i c h( d a t a s e t $ T y p e ==" PCa ")]) ,...
... x =2.4 5, cex = 0.8) dev.off()
# V a l u t a z i o n e v a l o r i m a n c a n t i : s h a d o w m a t r i x
m e t a b o l i t i O r d i n a t i p e r N A = m e t a b o l i t i [o r d e r( -a p p l y( FUN = sum, . . . ... X = is.na( m e t a b o l i t i ) , M A R G I N = 1)) ,o r d e r( -a p p l y( FUN = sum, . . . ... X = is.na( m e t a b o l i t i ) , M A R G I N = 2))]
i n s t a l l.p a c k a g e s(" VIM ") l i b r a r y( VIM )
png (" s h a d o w m a t r i x . png ")
m a t r i x p l o t ( m e t a b o l i t i O r d i n a t i p e r N A [1:4 0,1:3 0] , i n t e r a c t i v e = F , . . . ... x l a b = " m e t a b o l i t i ", y l a b = " s a m p l e s ")
dev.off()
# E l i m i n o m e t a b o l i t a 1 7 6 p o i c h e ha
# una p e r c e n t u a l e di v a l o r i m a n c a n t i >8 0% m e t a b o l i t i = m e t a b o l i t i [ , -1 7 6]
d a t a s e t = d a t a s e t [ , -1 7 6]
m a n c a n t i =is.na( m e t a b o l i t i )
# I m p u t o con m e d i e x PCA
m e d i e =a p p l y( X = m e t a b o l i t i , M A R G I N = 2,mean,na.rm= T ) for( j in 1:n c o l( m e t a b o l i t i )){
m e t a b o l i t i [is.na( m e t a b o l i t i [ , j ]) , j ]= m e d i e [ j ] }
d a t a s e t [ ,1:2 5 3]= m e t a b o l i t i [ ,1:2 5 3]
# Per v a l u t a r e se sia n e c e s s a r i o
# n o r m a l i z z a r e i d a t i :
# box - p l o t c a m p i o n i , e s e m p i di c o n c e n t r a z i o n i , PCA
# Box - p l o t c a m p i o n i
png (" b o x p l o t c a m p i o n i . png ")
b o x p l o t(t( m e t a b o l i t i ) , x l a b =" c a m p i o n i ") a b l i n e( v =5 2)
dev.off()
# P l o t d e l l e c o n c e n t r a z i o n i di a l c u n i m e t a b o l i t i png (" c o n c e n t r a z i o n e1 1. png ")
p l o t( m e t a b o l i t i [ ,1 1] , x l a b =" c a m p i o n i ", y l a b =" log - c o n c e n t r a z i o n e ",...
... pch =i f e l s e( d a t a s e t $ T y p e ==" PCa ",2 0,1)) a b l i n e( v =5 2)
l e g e n d(" t o p l e f t ", l e g e n d=c(" BPH ", " PCa ") , pch =c(1,2 0) , cex =0.8)
dev.off()
png (" c o n c e n t r a z i o n e1 2. png ")
p l o t( m e t a b o l i t i [ ,1 2] , x l a b =" c a m p i o n i ", y l a b =" log - c o n c e n t r a z i o n e ",...
... pch =i f e l s e( d a t a s e t $ T y p e ==" PCa ",2 0,1)) a b l i n e( v =5 2)
l e g e n d(" t o p r i g h t ", l e g e n d=c(" BPH ", " PCa ") , pch =c(1,2 0) , cex =0.8)
dev.off()
png (" c o n c e n t r a z i o n e2 1. png ")
p l o t( m e t a b o l i t i [ ,2 1] , x l a b =" c a m p i o n i ", y l a b =" log - c o n c e n t r a z i o n e ",...
... pch =i f e l s e( d a t a s e t $ T y p e ==" PCa ",2 0,1)) a b l i n e( v =5 2)
l e g e n d(" b o t t o m r i g h t ", l e g e n d=c(" BPH ", " PCa ") , pch =c(1,2 0) , cex =0.8)
dev.off()
png (" c o n c e n t r a z i o n e2 5. png ")
p l o t( m e t a b o l i t i [ ,2 5] , x l a b =" c a m p i o n i ", y l a b =" log - c o n c e n t r a z i o n e ",...
... pch =i f e l s e( d a t a s e t $ T y p e ==" PCa ",2 0,1)) a b l i n e( v =5 2)
l e g e n d(" b o t t o m r i g h t ", l e g e n d=c(" BPH ", " PCa ") , pch =c(1,2 0) , cex =0.8)
dev.off()
png (" c o n c e n t r a z i o n e1 2 5. png ")
p l o t( m e t a b o l i t i [ ,1 2 5] , x l a b =" c a m p i o n i ", y l a b =" log - c o n c e n t r a z i o n e ",...
... pch =i f e l s e( d a t a s e t $ T y p e ==" PCa ",2 0,1)) a b l i n e( v =5 2)
l e g e n d(" b o t t o m r i g h t ", l e g e n d=c(" BPH ", " PCa ") , pch =c(1,2 0) , cex =0.8)
dev.off()
png (" c o n c e n t r a z i o n e1 8 5. png ")
p l o t( m e t a b o l i t i [ ,1 8 4] , x l a b =" c a m p i o n i ", y l a b =" log - c o n c e n t r a z i o n e ",...
... pch =i f e l s e( d a t a s e t $ T y p e ==" PCa ",2 0,1)) a b l i n e( v =5 2)
l e g e n d(" t o p r i g h t ", l e g e n d=c(" BPH ", " PCa ") , pch =c(1,2 0) , cex =0.8)
dev.off()
# PCA
pca < - p r c o m p ( m e t a b o l i t i , c e n t e r = TRUE,
s c a l e. = T R U E)
png (" P C A i m p M e d i e T y p e . png ")
p l o t( pca $ x [ ,1:2] , pch =i f e l s e( d a t a s e t $ T y p e ==" PCa ",2 0,1)) l e g e n d(" t o p r i g h t ", l e g e n d=c(" BPH ", " PCa ") ,
pch =c(1,2 0) , cex =0.8) dev.off()
png (" P C A i m p M e d i e P o s . png ")
p l o t( pca $ x [ ,1:2] , pch =c(rep(0,5 2) ,rep(2,5 0)))
l e g e n d(" b o t t o m r i g h t ", l e g e n d=c(" c a m p i o n i ␣1-5 2",...
... " c a m p i o n i ␣5 3-1 0 2") , pch =c(0,2) , cex =0.8) dev.off()
s a v e( m e t a b o l i t i , m a n c a n t i , dataset ,f i l e" F i n e A n a l i s i P r e l i m i n a r e . Rda ") 2. "Pre-elaborazione del dataset":
l o a d(" F i n e A n a l i s i P r e l i m i n a r e . Rda ")
# N o r m a l i z z a z i o n e s c a l e
s o u r c e(" h t t p s :// b i o c o n d u c t o r . org / b i o c L i t e . R ") b i o c L i t e (" l i m m a ")
l i b r a r y( l i m m a )
m e t a b o l i t i = as . d a t a . f r a m e (t( n o r m a l i z e B e t w e e n A r r a y s (t( m e t a b o l i t i ) ,...
... m e t h o d = " s c a l e " ) )) pca < - p r c o m p ( m e t a b o l i t i , c e n t e r = TRUE,
s c a l e. = T R U E)
j p e g (" P C A i m p M e d i e N o r m . jpg ")
p l o t( pca $ x [ ,1:2] ,col=c(rep(" red ",5 2) ,rep(" b l u e ",5 0))) dev.off()
j p e g (" b o x p l o t c a m p i o n i N o r m . jpg ") b o x p l o t(t( m e t a b o l i t i ))
a b l i n e( v =5 2,col=" red ") dev.off()
j p e g (" c o n c e n t r a z i o n e1 1N o r m . jpg ")
p l o t( m e t a b o l i t i [ ,1 1] , x l a b =" d i s p o s i z i o n e ␣ c a m p i o n i ",...
... y l a b =" log - c o n c e n t r a z i o n e ", col=c(rep(" red ",5 2) ,rep(" b l u e ",5 2))) dev.off()
j p e g (" c o n c e n t r a z i o n e1 2N o r m . jpg ")
p l o t( m e t a b o l i t i [ ,1 2] , x l a b =" d i s p o s i z i o n e ␣ c a m p i o n i ",...
... y l a b =" log - c o n c e n t r a z i o n e ", col=c(rep(" red ",5 2) ,rep(" b l u e ",5 2))) dev.off()
j p e g (" c o n c e n t r a z i o n e2 1N o r m . jpg ")
p l o t( m e t a b o l i t i [ ,2 1] , x l a b =" d i s p o s i z i o n e ␣ c a m p i o n i ",...
y l a b =" log - c o n c e n t r a z i o n e ",...
col=c(rep(" red ",5 2) ,rep(" b l u e ",5 2))) dev.off()
j p e g (" c o n c e n t r a z i o n e2 5N o r m . jpg ")
p l o t( m e t a b o l i t i [ ,2 5] , x l a b =" d i s p o s i z i o n e ␣ c a m p i o n i ",...
... y l a b =" log - c o n c e n t r a z i o n e ", col=c(rep(" red ",5 2) ,rep(" b l u e ",5 2))) dev.off()
# La n o r m a l i z z a z i o n e da s o l a non e ’ s u f f i c i e n t e
# R i m o z i o n e dell ’ e f f e t t o b a t c h ( con C o m B a t ) e
# n o r m a l i z z a z i o n e s c a l e
s o u r c e(" h t t p s :// b i o c o n d u c t o r . org / b i o c L i t e . R ") b i o c L i t e (" sva ")
l i b r a r y( sva )
l o a d(" F i n e A n a l i s i P r e l i m i n a r e . Rda ")
m e t a b o l i t i = as . d a t a . f r a m e (t( C o m B a t (t( m e t a b o l i t i ) ,...
... b a t c h =c(rep(" A ",5 2) ,rep(" B ",5 0)) ,par. p r i o r = T )))
m e t a b o l i t i = as . d a t a . f r a m e (t( n o r m a l i z e B e t w e e n A r r a y s (t( m e t a b o l i t i ) ,...
... m e t h o d = " s c a l e " ) ))
# C o n t r o l l o per v e d e r e se C o m B a t f u n z i o n a
pca < - p r c o m p ( m e t a b o l i t i , c e n t e r = TRUE, s c a l e. = T R U E) j p e g (" P C A i m p M e d i e N o r m R e m . jpg ")
p l o t( pca $ x [ ,1:2] ,col=c(rep(" red ",5 2) ,rep(" b l u e ",5 0))) dev.off()
j p e g (" b o x p l o t c a m p i o n i N o r m R e m . jpg ") b o x p l o t(t( m e t a b o l i t i ))
a b l i n e( v =5 2,col=" red ") dev.off()
j p e g (" c o n c e n t r a z i o n e1 1N o r m R e m . jpg ")
p l o t( m e t a b o l i t i [ ,1 1] , x l a b =" d i s p o s i z i o n e ␣ c a m p i o n i ",...
... y l a b =" log - c o n c e n t r a z i o n e ",col=c(rep(" red ",5 2) ,...
...rep(" b l u e ",5 2))) dev.off()
j p e g (" c o n c e n t r a z i o n e1 2N o r m R e m . jpg ")
p l o t( m e t a b o l i t i [ ,1 2] , x l a b =" d i s p o s i z i o n e ␣ c a m p i o n i ",...
... y l a b =" log - c o n c e n t r a z i o n e ", col=c(rep(" red ",5 2) ,...
...rep(" b l u e ",5 2))) dev.off()
j p e g (" c o n c e n t r a z i o n e2 1N o r m R e m . jpg ")
p l o t( m e t a b o l i t i [ ,2 1] , x l a b =" d i s p o s i z i o n e ␣ c a m p i o n i ",...
... y l a b =" log - c o n c e n t r a z i o n e ",...
...col=c(rep(" red ",5 2) ,rep(" b l u e ",5 2))) dev.off()
j p e g (" c o n c e n t r a z i o n e2 5N o r m R e m . jpg ")
p l o t( m e t a b o l i t i [ ,2 5] , x l a b =" d i s p o s i z i o n e ␣ c a m p i o n i ",...
... y l a b =" log - c o n c e n t r a z i o n e ",...
...col=c(rep(" red ",5 2) ,rep(" b l u e ",5 2))) dev.off()
# I m p u t a z i o n e
# S c a r i c o Q R L I C
i m p u t e . Q R I L C = f u n c t i o n( d a t a S e t . mvs , t u n e . s i g m a = 1){
# get the d i m e n s i o n of the d a t a
. . . . n F e a t u r e s = dim( d a t a S e t . mvs )[1]
n S a m p l e s = dim( d a t a S e t . mvs )[2]
# - i n i t i a l i z e the m a t r i x of c o m p l e t e a b u n d a n c e s . . . .
d a t a S e t . i m p u t e d = d a t a S e t . mvs
# - i n i t i a l i z e QR . obj w h i c h c o n t a i n s e s t i m a t e s of the d i s t r i b u t i o n p a r a m e t e r s
# for all s a m p l e s
QR . obj = l i s t()
for ( i in 1: n S a m p l e s ){
c u r r .s a m p l e = d a t a S e t . mvs [ , i ]
# - c a l c u l a t e the p e r c e n t a g e of m i s s i n g v a l u e s . . . .
p N A s = l e n g t h (w h i c h(is.na( c u r r .s a m p l e) ) ) / l e n g t h ( c u r r .s a m p l e)
# - e s t i m a t e the m e a n and s t a n d a r d d e v i a t i o n of the o r i g i n a l
# d i s t r i b u t i o n u s i n g q u a n t i l e r e g r e s s i o n u p p e r.q = 0.9 9
q. n o r m a l = q n o r m(seq(( p N A s +0.0 0 1) ,(u p p e r.q+0.0 0 1) ,...
. . . (u p p e r.q- p N A s )/(u p p e r.q*1 0 0)) , m e a n = 0, sd = 1) q. c u r r .s a m p l e = q u a n t i l e( c u r r .sample,
p r o b s = seq(0.0 0 1,(u p p e r.q+0.0 0 1) ,0.0 1) , na.rm = T )
t e m p . QR = lm(q. c u r r .s a m p l e ~ q. n o r m a l ) QR . obj [[ i ]] = t e m p . QR
m e a n. CDD = t e m p . QR $c o e f f i c i e n t s[1]
sd. CDD = as .n u m e r i c( t e m p . QR $c o e f f i c i e n t s[2])
# g e n e r a t e d a t a f r o m m u l t i v a r i a t e d i s t r i b u t i o n s w i t h MLE p a r a m e t e r s . . . .
d a t a . to . imp = r t m v n o r m ( n = n F e a t u r e s , m e a n = m e a n. CDD ,
s i g m a = sd. CDD * t u n e . sigma ,
u p p e r = q n o r m(( p N A s +0.0 0 1) , m e a n = m e a n. CDD ,
sd = sd. CDD ) ,
a l g o r i t h m =c(" g i b b s "))
c u r r .s a m p l e. i m p u t e d = c u r r .s a m p l e
c u r r .s a m p l e. i m p u t e d [w h i c h(is.na( c u r r .s a m p l e))] = d a t a . to . imp [w h i c h(is.na( c u r r .s a m p l e))]
d a t a S e t . i m p u t e d [ , i ] = c u r r .s a m p l e. i m p u t e d }
r e s u l t s = l i s t( d a t a S e t . imputed , QR . obj ) r e t u r n( r e s u l t s )}
i n s t a l l.p a c k a g e s(" t m v t n o r m ") l i b r a r y( t m v t n o r m )
m e t a b o l i t i [ m a n c a n t i ]= NA sum(is.na( m e t a b o l i t i ))
# I m p u t o gli NA s p a r s i con " Q R I L C "
m e t a b o l i t i = i m p u t e . Q R I L C (t( m e t a b o l i t i ))
m e t a b o l i t i = as . d a t a . f r a m e (t( m e t a b o l i t i [[1] ] ) )
# i m p u t o il c a m p i o n e con piu NA con R a n d o m F o r e s t
# p r i m a gli r e i m p o s t o i v a l o r i m a n c a n t i
r e i m p o s t a N u l l i =w h i c h(r o w n a m e s( m e t a b o l i t i )==" PCa5 0 8") m a n c a n t i [ - r e i m p o s t a N u l l i ,]= F
sum( m a n c a n t i )
m e t a b o l i t i [ m a n c a n t i ]= NA sum(is.na( m e t a b o l i t i ))
# ## i m p u t o con R a n d o m F o r e s t i n s t a l l.p a c k a g e s(" m i s s F o r e s t ") l i b r a r y( m i s s F o r e s t )
m e t a b o l i t i = m i s s F o r e s t ( m e t a b o l i t i )[[1]]
d a t a s e t [ ,1:2 5 3]= m e t a b o l i t i
s a v e( dataset , m e t a b o l i t i ,f i l e = " F i n e P r e e l a b o r a z i o n e . rda ") 3. "Analisi univariata":
# c a r i c o le t r a s f o r m a z i o n i di c l a s s e II s o u r c e(" T r a s f o r m a z i o n i . R ")
l o a d(" F i n e P r e e l a b o r a z i o n e . rda ")
# Uso il p a c c h e t o m u m a i n s t a l l.p a c k a g e s(" m u m a ") l i b r a r y( m u m a )
all.e q u a l(r o w n a m e s( d a t a s e t ) ,r o w n a m e s( m e t a b o l i t i )) C O M B A T =c b i n d( m e t a b o l i t i , m e t a b o l i t i [ ,1])
C O M B A T [ ,1]=i f e l s e( d a t a s e t $ T y p e ==" PCa ",1,2) w r i t e.csv( x = COMBAT ,f i l e = " C O M B A T . csv ")
u n i v a r i a t e (f i l e=" C O M B A T . csv ", n o r m a l i z e = F , m u l t i . t e s t = T , . . . ...p l o t. v o l c a n o = T )
u n i v a r i a t e (f i l e=" C O M B A T . csv ", n o r m a l i z e = F , m u l t i . t e s t = F , . . . ...p l o t. v o l c a n o = T )
# M o d e r a t e t - t e s t ( l i m m a ) per d i v e r s i t i p i di t r a s f o r m a z i o n i
# t r a s f o r m a z i o n e l o g a r i t m i c a l o a d(" F i n e P r e e l a b o r a z i o n e . rda ") l i b r a r y( l i m m a )
d e s i g n . PCa . BPH < - c b i n d( BPH =c(0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0,...
... 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1,...
... 0, 1, 0,1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1,...
... 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1,...
... 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1,...
... 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1) ,
PCa =c(1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1,...
... 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0,...
1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0,...
. . . . 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0,...
... 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1,...
1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0)) fit _ l2 < - l m F i t (t( m e t a b o l i t i ) , d e s i g n . PCa . BPH )
c o n t .m a t r i x < - m a k e C o n t r a s t s ( P C a v s B P H = PCa - BPH , l e v e l s= d e s i g n . PCa . BPH ) fit2_ l2 < - c o n t r a s t s. fit ( fit _ l2, c o n t .m a t r i x)
e f i t _ l2 < - e B a y e s ( fit2_ l2) dim( e f i t _ l2)
r e s u l t s _ l2 < - t o p T a b l e ( e f i t _ l2, n u m b e r =2 5 4, a d j u s t =" BH ")
w r i t e.t a b l e( r e s u l t s _ l2, " PCa _ vs _ BPH _ log2_ c o m b a t _ s c a l e _ L i m m a . txt ",...
... sep =" \ t ", col.n a m e s= T , row.n a m e s= T )
r i a s s u n t o M o d e r a t e =r e a d.t a b l e(" PCa _ vs _ BPH _ log2_ c o m b a t _ s c a l e _ L i m m a . txt ") h e a d ( r i a s s u n t o M o d e r a t e ,4)
# # p a c c h e t t o per m e t t e r e t e s t o nei g r a f i i n s t a l l.p a c k a g e s(" c a l i b r a t e ")
l i b r a r y( c a l i b r a t e )
# V o l c a n o p l o t per p - v a l u e non a g g i u s t a t i j p e g (" c l a s s c o m p p v a l u e . jpg ")
p l o t( x = r i a s s u n t o M o d e r a t e $ logFC , y = -log 1 0( r i a s s u n t o M o d e r a t e $ P . V a l u e )) t e x t x y ( r i a s s u n t o M o d e r a t e $ logFC , -log 1 0( r i a s s u n t o M o d e r a t e $ P . V a l u e ) ,...
...r o w n a m e s( r i a s s u n t o M o d e r a t e )) a b l i n e( h = -log 1 0(0.0 5) ,col=" b l u e ") dev.off()
# V o l c a n o p l o t per p - v a l u e a g g i u s t a t i j p e g (" c l a s s c o m p p v a l u e A d . jpg ")
p l o t( x = r i a s s u n t o M o d e r a t e $ logFC , y = -log 1 0( r i a s s u n t o M o d e r a t e $ adj . P . Val ))
dev.off()
# T r a s f o r m a z i o n e l e v e l s c a l i n g l o a d(" F i n e P r e e l a b o r a z i o n e . rda ")
d e s i g n . PCa . BPH < - c b i n d( BPH =c(0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0,...
... 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1,...
... 0, 1, 0,1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1,...
... 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1,...
... 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1,...
... 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1) ,
PCa =c(1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1,...
... 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0,...
1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0,...
. . . . 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0,...
... 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1,...
1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0)) m e t a b o l i t i = l e v e l s c a l i n g ( m e t a b o l i t i )
fit _ l2 < - l m F i t (t( m e t a b o l i t i ) , d e s i g n . PCa . BPH )
c o n t .m a t r i x < - m a k e C o n t r a s t s ( P C a v s B P H = PCa - BPH , l e v e l s= d e s i g n . PCa . BPH ) fit2_ l2 < - c o n t r a s t s. fit ( fit _ l2, c o n t .m a t r i x)
e f i t _ l2 < - e B a y e s ( fit2_ l2) dim( e f i t _ l2)
r e s u l t s _ l2 < - t o p T a b l e ( e f i t _ l2, n u m b e r =2 5 4, a d j u s t =" BH ")
w r i t e.t a b l e( r e s u l t s _ l2," PCa _ vs _ BPH _ log2_ c o m b a t _ s c a l e _ L i m m a _ l e v e l . txt ",...
... sep =" \ t ", col.n a m e s= T , row.n a m e s= T )
r i a s s u n t o M o d e r a t e =r e a d.t a b l e(" PCa _ vs _ BPH _ log2_ c o m b a t _ s c a l e _ ␣ ...
... ␣ L i m m a _ l e v e l . txt ") h e a d ( r i a s s u n t o M o d e r a t e ,4)
# V o l c a n o p l o t per p - v a l u e non a g g i u s t a t i j p e g (" c l a s s c o m p p v a l u e _ l e v e l . jpg ")
p l o t( x = r i a s s u n t o M o d e r a t e $ logFC , y = -log 1 0( r i a s s u n t o M o d e r a t e $ P . V a l u e )) t e x t x y ( r i a s s u n t o M o d e r a t e $ logFC , -log 1 0( r i a s s u n t o M o d e r a t e $ P . V a l u e ) ,...
...r o w n a m e s( r i a s s u n t o M o d e r a t e )) a b l i n e( h = -log 1 0(0.0 5) ,col=" b l u e ") dev.off()
# V o l c a n o p l o t per p - v a l u e a g g i u s t a t i j p e g (" c l a s s c o m p p v a l u e A d _ l e v e l . jpg ")
p l o t( x = r i a s s u n t o M o d e r a t e $ logFC , y = -log 1 0( r i a s s u n t o M o d e r a t e $ adj . P . Val )) dev.off()
# T r a s f o r m a z i o n e a u t o s c a l i n g l o a d(" F i n e P r e e l a b o r a z i o n e . rda ")
d e s i g n . PCa . BPH < - c b i n d( BPH =c(0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0,...
... 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1,...
... 0, 1, 0,1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1,...
... 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1,...
... 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1,...
... 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1) ,
PCa =c(1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1,...
... 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0,...
1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0,...
. . . . 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0,...
... 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1,...
1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0)) m e t a b o l i t i = a u t o s c a l i n g ( m e t a b o l i t i )
fit _ l2 < - l m F i t (t( m e t a b o l i t i ) , d e s i g n . PCa . BPH )
c o n t .m a t r i x < - m a k e C o n t r a s t s ( P C a v s B P H = PCa - BPH , l e v e l s= d e s i g n . PCa . BPH ) fit2_ l2 < - c o n t r a s t s. fit ( fit _ l2, c o n t .m a t r i x)
e f i t _ l2 < - e B a y e s ( fit2_ l2) dim( e f i t _ l2)
r e s u l t s _ l2 < - t o p T a b l e ( e f i t _ l2, n u m b e r =2 5 4, a d j u s t =" BH ")
w r i t e.t a b l e( r e s u l t s _ l2," PCa _ vs _ BPH _ log2_ c o m b a t _ s c a l e _ L i m m a _ a u t o . txt ",...
... sep =" \ t ", col.n a m e s= T , row.n a m e s= T )
r i a s s u n t o M o d e r a t e =r e a d.t a b l e(" PCa _ vs _ BPH _ log2_ c o m b a t _ s c a l e ␣ ...
... ␣ _ L i m m a _ a u t o . txt ") h e a d ( r i a s s u n t o M o d e r a t e ,4)
# V o l c a n o p l o t per p - v a l u e non a g g i u s t a t i j p e g (" c l a s s c o m p p v a l u e _ a u t o . jpg ")
p l o t( x = r i a s s u n t o M o d e r a t e $ logFC , y = -log 1 0( r i a s s u n t o M o d e r a t e $ P . V a l u e )) t e x t x y ( r i a s s u n t o M o d e r a t e $ logFC , -log 1 0( r i a s s u n t o M o d e r a t e $ P . V a l u e ) ,...
. . . ( r i a s s u n t o M o d e r a t e ))
a b l i n e( h = -log 1 0(0.0 5) ,col=" b l u e ") dev.off()
# V o l c a n o p l o t per p - v a l u e a g g i u s t a t i j p e g (" c l a s s c o m p p v a l u e A d _ a u t o . jpg ")
p l o t( x = r i a s s u n t o M o d e r a t e $ logFC , y = -log 1 0( r i a s s u n t o M o d e r a t e $ adj . P . Val )) dev.off()
4. "Analisi multivariata":
l o a d(" F i n e P r e e l a b o r a z i o n e . rda ")
# R e g r e s s i o n e l o g i s t i c a p e n a l i z z a t a i n s t a l l.p a c k a g e s(" g l m n e t ")
l i b r a r y( g l m n e t )
all.e q u a l(r o w n a m e s( m e t a b o l i t i ) ,r o w n a m e s( d a t a s e t ))
fit . l a s s o = g l m n e t ( x = as .m a t r i x(c b i n d( m e t a b o l i t i , d a t a s e t $ Age , . . . d a t a s e t $ PSA )) , y = d a t a s e t $ Type ,f a m i l y = " b i n o m i a l ")
p l o t( fit . lasso , x v a r =" l a m b d a ")
# c r o s s v a l i d a t i o n con 1 0 f o l d
cv . l a s s o = cv . g l m n e t ( x = as .m a t r i x(c b i n d( m e t a b o l i t i , d a t a s e t $ Age , . . . d a t a s e t $ PSA )) , y = d a t a s e t $ Type ,f a m i l y = " b i n o m i a l ")
j p e g (" l a s s o N o T r a s f . jpg ") p l o t( cv . l a s s o )
dev.off()
# M e t a b o l i t i a s s o c i a t i al l a m b d a o t t i m a l e s o n o sa =c o e f( fit . lasso , s = cv . l a s s o $ l a m b d a .1 se)
s a @ i
# 5 m e t a b o l i t i che l a s s o " e l i m i n a " per u l t i m i sa =c o e f( fit . lasso , s = 0.0 8 6 7 4 6 2 1 5)
s a @ i
5. "Identificazione del modello e valutazione":
l o a d(" F i n e P r e e l a b o r a z i o n e . rda ") i n s t a l l.p a c k a g e s(" c a r e t ")
l i b r a r y( c a r e t )
i n s t a l l.p a c k a g e s(" p R O C ") l i b r a r y( p R O C )
i n s t a l l.p a c k a g e s(" e1 0 7 1") l i b r a r y( e1 0 7 1)
# F u n z i o n e per d e f i n i r e uno s c o r e per i v a r i c a m p i o n i :
# m o d e l l o l o g i s t i c o piu k - f o l d CV
# I N P U T : v e t t o r e di v a r i a b i l i ( n o m e ) da u t i l i z z a r e
# d a t a s e t
# s u d d i v i s i o n e del c a m p i o n e in k - f o l d
# ( r i s u l t a t o f u n z i o n e c r e a t e F o l d s )
# O U T P U T : d a t a f r a m e ( V1= score , V2= T y p e )
c r e a S c o r e =f u n c t i o n( dataset , v a r i a b i l i , f l d s ){
d a t a s e t $ v a l o r i =i f e l s e( d a t a s e t $ T y p e ==" PCa ",1,0) s c o r e = N U L L
m i n i s e t = d a t a s e t [ ,c( v a r i a b i l i ," v a l o r i ")]
for( j in 1: l e n g t h ( f l d s )){
mod =glm( m i n i s e t $ v a l o r i [ - f l d s [[ j ]]]~. , d a t a = m i n i s e t [ - f l d s [[ j ]] ,] ,...
...f a m i l y=" b i n o m i a l ")
v e t t o r e = as .v e c t o r(c o e f( mod ))[ -1]
t e m p =c b i n d( as .m a t r i x( m i n i s e t [ f l d s [[ j ]] , -n c o l( m i n i s e t )]) %*% ...
... vettore , as . c h a r a c t e r ( d a t a s e t $ T y p e [ f l d s [[ j ] ] ] ) ) s c o r e =r b i n d( score , t e m p ) }
mod =glm( m i n i s e t $ v a l o r i ~. , d a t a = miniset ,f a m i l y=" b i n o m i a l ") p r i n t(s u m m a r y( mod ))
s c o r e = as . d a t a . f r a m e ( s c o r e )
s c o r e [ ,1]= as .n u m e r i c( as . c h a r a c t e r ( s c o r e [ ,1])) r e t u r n( s c o r e )
}
# I N P U T : e l e m e n t o c l a s s e roc ( p R O C )
# r i s u l t a t o f u n z i o n e c r e a S c o r e
# O U T P U T m i g l i o r cut off s e c o n d o Y o u d e n
# t a b e l l a c o n t i n g e n z a a s s o c i a t a f i n d B e s t Y o u d e n =f u n c t i o n( rr , s c o r e ){
max=0
t h r e s h o l d =0
for( c u t o f f in rr $ t h r e s h o l d s [2:1 0 2]){
c o n f u = c o n f u s i o n M a t r i x (i f e l s e( s c o r e $ V1> cutoff ," PCa "," BPH ") ,...
... s c o r e $ V2, p o s i t i v e =" PCa ")
t e m p = c o n f u $ b y C l a s s [1]+ c o n f u $ b y C l a s s [2]
if( temp >max){
f i n a l e = c o n f u max= t e m p
t h r e s h o l d = c u t o f f }
}
n a m e s(max)=" Y o u d e n "
r e t u r n(l i s t( finale , t h r e s h o l d ,max)) }
# ## I N P U T : e l e m e n t o c l a s s e roc ( p R O C )
# r i s u l t a t o f u n z i o n e c r e a S c o r e
# O U T P U T m i g l i o r cut off s e c o n d o v i c i n a n z a a p u n t o (0,1) ,
# t a b e l l a c o n t i n g e n z a a s s o c i a t a
f i n d B e s t N e a r =f u n c t i o n( rr , s c o r e ){
min=1 0
t h r e s h o l d =0
for( c u t o f f in rr $ t h r e s h o l d s [2:1 0 2]){
c o n f u = c o n f u s i o n M a t r i x (i f e l s e( s c o r e $ V1> cutoff ," PCa "," BPH ") ,...
... s c o r e $ V2, p o s i t i v e =" PCa ")
t e m p =s q r t(( c o n f u $ b y C l a s s [1] -1)^2+( c o n f u $ b y C l a s s [2] -1)^2) if( temp <min){
f i n a l e = c o n f u min= t e m p
t h r e s h o l d = c u t o f f }
}
n a m e s(min)=" b e s t N e a r (0,1) "
r e t u r n(l i s t( finale , t h r e s h o l d ,min)) }
set. s e e d (1 5 2)
# M o d e l l o d e f i n i t o da u n i v a r i a t a
f l d s < - c r e a t e F o l d s (seq(1:n r o w( d a t a s e t )) , k = 1 0, l i s t = TRUE, . . .
... r e t u r n T r a i n = F A L S E)
v a r i a b i l i =c(" ID2 4 9_3 2 9_7 7 0"," ID3 6_4 1 7_1 2 5 7", " ID2 1 1_4 8 5_1 0 4 1",...
... " ID2 2 0_4 4 1_1 0 3 6", " Age ")
s c o r e = c r e a S c o r e ( dataset , v a r i a b i l i , f l d s ) rr1= roc ( s c o r e $ V2, s c o r e $ V1)
p l o t. roc ( rr1,p r i n t. auc = TRUE, col = " b l u e ") f i n d B e s t Y o u d e n ( rr1, s c o r e )
f i n d B e s t N e a r ( rr1, s c o r e ) b o x p l o t( s c o r e $ V1~ s c o r e $ V2)
# M o d e l l o d e f i n i t o da u n i v a r i a t a s e n z a ID2 4 9
f l d s < - c r e a t e F o l d s (seq(1:n r o w( d a t a s e t )) , k = 1 0, l i s t = TRUE, . . . ... r e t u r n T r a i n = F A L S E)
v a r i a b i l i =c(" ID3 6_4 1 7_1 2 5 7", " ID2 1 1_4 8 5_1 0 4 1", " ID2 2 0_4 4 1_1 0 3 6", ...
... " Age ")
s c o r e = c r e a S c o r e ( dataset , v a r i a b i l i , f l d s ) rr1= roc ( s c o r e $ V2, s c o r e $ V1)
p l o t. roc ( rr1,p r i n t. auc = TRUE, col = " b l u e ") f i n d B e s t Y o u d e n ( rr1, s c o r e )
f i n d B e s t N e a r ( rr1, s c o r e ) b o x p l o t( s c o r e $ V1~ s c o r e $ V2)
# M o d e l l o d e f i n i t o da u n i v a r i a t a s e n z a ID2 4 9 e Eta ’
f l d s < - c r e a t e F o l d s (seq(1:n r o w( d a t a s e t )) , k = 1 0, l i s t = TRUE, . . . ... r e t u r n T r a i n = F A L S E)
v a r i a b i l i =c(" ID3 6_4 1 7_1 2 5 7", " ID2 1 1_4 8 5_1 0 4 1", " ID2 2 0_4 4 1_1 0 3 6") s c o r e = c r e a S c o r e ( dataset , v a r i a b i l i , f l d s )
rr1= roc ( s c o r e $ V2, s c o r e $ V1)
p l o t. roc ( rr1,p r i n t. auc = TRUE, col = " b l u e ") f i n d B e s t Y o u d e n ( rr1, s c o r e )
f i n d B e s t N e a r ( rr1, s c o r e ) b o x p l o t( s c o r e $ V1~ s c o r e $ V2)
# M o d e l l o d e f i n i t o da m u l t i v a r i a t a
f l d s < - c r e a t e F o l d s (seq(1:n r o w( d a t a s e t )) , k = 1 0, l i s t = TRUE, . . . ... r e t u r n T r a i n = F A L S E)
v a r i a b i l i =c(" ID3 6_4 1 7_1 2 5 7"," ID2 4 9_3 2 9_7 7 0"," ID1 6 7_3 1 4_1 2 2 0",...
..." ID2 2 0_4 4 1_1 0 3 6"," Age ")
s c o r e = c r e a S c o r e ( dataset , v a r i a b i l i , f l d s ) rr1= roc ( s c o r e $ V2, s c o r e $ V1)
p l o t. roc ( rr1,p r i n t. auc = TRUE, col = " b l u e ") f i n d B e s t Y o u d e n ( rr1, s c o r e )
f i n d B e s t N e a r ( rr1, s c o r e ) b o x p l o t( s c o r e $ V1~ s c o r e $ V2)
Infine riportiamo il codice per le trasformazioni di classe II:
c e n t e r i n g =f u n c t i o n( f r a m e ){
m e d i e =a p p l y( X = frame , M A R G I N = 2, FUN = mean,na.rm= T ) r e t u r n(t(t( f r a m e ) - m e d i e ))
}
a u t o s c a l i n g =f u n c t i o n( f r a m e ){
f r a m e = c e n t e r i n g ( f r a m e )
d e v s t a n d =s q r t(a p p l y( X = frame , M A R G I N = 2, FUN = var,na.rm= T )) r e t u r n(t(t( f r a m e )/ d e v s t a n d ))
}
l e v e l s c a l i n g =f u n c t i o n( f r a m e ){
m e d i e =a p p l y( X = frame , M A R G I N = 2, FUN = mean,na.rm= T ) f r a m e = c e n t e r i n g ( f r a m e )
r e t u r n(t(t( f r a m e )/ m e d i e )) }
Bibliografia
[1] Zhou B., Xiao J. F., Tuli L., et al, LC-MS-based metabolomics. Mol. Biosyst., 2012.
[2] Wishart D. S., Jewison T., Guo A. C., HMDB 3.0 The Human Metabolome Database in 2013. Nucleic Acids Res ,2013.
[3] Xia J., Broadhurst D. I., Wilson M., Translational biomarker discovery in clinical metabolomics: an introductory tutorial. Metabolomics, 2013.
[4] Hastie T., Tibshirant R., Friedman J., The Elements of Statistical Learning.
New York: Springer, 2009.
[5] Ross S. M., Probabilitá e statistica per l’ingegneria e le scienze. APOGEO, 2008.
[6] Rogantin M. P. Modelli lineari generali e generalizzati. 2017.
[7] van den Berg R. A., Hoefsloot H. C. J. , Westerhuis J. A., et al, Centering, scaling, and transformations: improving the biological information content of metabolomics data. BMC Genomics, 2006.
[8] Wei R., Wang J., Su M., et al, Missing Value Imputation Approach for Mass Spectrometry-based Metabolomics Data. Scientific Reports, 2018.
[9] Stekhoven D.J., BÃijhlmann P., MissForest - nonparametric missing value imputation for mixed-type data. Bioinformatics, 2012.
[10] Koenker R., Bassett Jr. G., Regression Quantiles. The Econometric Society, 1978.
[11] Johnson W. E., et al, Adjusting batch effects in microarray expression data using empirical Bayes methods. Biostatistics, 2007.