## Start:  AIC=217.42
## gaba ~ MBP + TdTomato + DAPI1 + DAPI2 + DAPI3 + GluN1 + PSD95 + 
##     synapsin + VGlut1 + GABA + GAD2 + Gephyrin
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##            Df Deviance    AIC
## - DAPI1     1   191.45 215.45
## - DAPI2     1   191.52 215.52
## - MBP       1   193.09 217.09
## - DAPI3     1   193.24 217.24
## <none>          191.42 217.42
## - GluN1     1   194.28 218.28
## - VGlut1    1   195.50 219.50
## - synapsin  1   196.82 220.82
## - GAD2      1   197.46 221.46
## - TdTomato  1   197.79 221.79
## - Gephyrin  1   206.31 230.31
## - GABA      1   208.68 232.68
## - PSD95     1   244.35 268.35
## 
## Step:  AIC=215.45
## gaba ~ MBP + TdTomato + DAPI2 + DAPI3 + GluN1 + PSD95 + synapsin + 
##     VGlut1 + GABA + GAD2 + Gephyrin
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##            Df Deviance    AIC
## - DAPI2     1   191.54 213.54
## - MBP       1   193.21 215.21
## <none>          191.45 215.45
## - DAPI3     1   193.50 215.50
## - GluN1     1   194.29 216.29
## + DAPI1     1   191.42 217.42
## - VGlut1    1   195.52 217.52
## - synapsin  1   196.82 218.82
## - GAD2      1   197.61 219.61
## - TdTomato  1   197.91 219.91
## - Gephyrin  1   206.98 228.98
## - GABA      1   209.12 231.12
## - PSD95     1   244.69 266.69
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## 
## Step:  AIC=213.54
## gaba ~ MBP + TdTomato + DAPI3 + GluN1 + PSD95 + synapsin + VGlut1 + 
##     GABA + GAD2 + Gephyrin
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##            Df Deviance    AIC
## - MBP       1   193.24 213.24
## <none>          191.54 213.54
## - DAPI3     1   193.70 213.70
## - GluN1     1   194.81 214.81
## + DAPI2     1   191.45 215.45
## + DAPI1     1   191.52 215.52
## - VGlut1    1   196.01 216.01
## - synapsin  1   197.10 217.10
## - GAD2      1   197.73 217.73
## - TdTomato  1   202.69 222.69
## - Gephyrin  1   207.10 227.10
## - GABA      1   210.70 230.70
## - PSD95     1   245.77 265.77
## 
## Step:  AIC=213.24
## gaba ~ TdTomato + DAPI3 + GluN1 + PSD95 + synapsin + VGlut1 + 
##     GABA + GAD2 + Gephyrin
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##            Df Deviance    AIC
## - DAPI3     1   193.81 211.81
## <none>          193.24 213.24
## + MBP       1   191.54 213.54
## - GluN1     1   195.84 213.84
## - VGlut1    1   197.03 215.03
## + DAPI1     1   193.11 215.11
## + DAPI2     1   193.21 215.21
## - synapsin  1   199.92 217.92
## - GAD2      1   200.03 218.03
## - TdTomato  1   204.75 222.75
## - Gephyrin  1   209.69 227.69
## - GABA      1   218.72 236.72
## - PSD95     1   246.18 264.18
## 
## Step:  AIC=211.81
## gaba ~ TdTomato + GluN1 + PSD95 + synapsin + VGlut1 + GABA + 
##     GAD2 + Gephyrin
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##            Df Deviance    AIC
## <none>          193.81 211.81
## - GluN1     1   195.92 211.92
## + DAPI3     1   193.24 213.24
## + DAPI1     1   193.50 213.50
## - VGlut1    1   197.59 213.59
## + DAPI2     1   193.62 213.62
## + MBP       1   193.70 213.70
## - GAD2      1   200.19 216.19
## - synapsin  1   200.92 216.92
## - TdTomato  1   206.17 222.17
## - Gephyrin  1   210.19 226.19
## - GABA      1   227.36 243.36
## - PSD95     1   246.20 262.20
## 
## Call:
## glm(formula = gaba ~ TdTomato + GluN1 + PSD95 + synapsin + VGlut1 + 
##     GABA + GAD2 + Gephyrin, family = "binomial", data = sdat)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -4.2827  -0.1847  -0.0263  -0.0020   3.1709  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -6.9390     1.1058  -6.275 3.49e-10 ***
## TdTomato     -0.9247     0.3088  -2.994  0.00275 ** 
## GluN1        -0.4248     0.2990  -1.420  0.15548    
## PSD95        -4.7646     1.1946  -3.988 6.65e-05 ***
## synapsin     -1.2382     0.5178  -2.391  0.01678 *  
## VGlut1       -0.8295     0.4565  -1.817  0.06921 .  
## GABA          1.2649     0.2707   4.672 2.98e-06 ***
## GAD2          0.6805     0.2934   2.320  0.02035 *  
## Gephyrin      0.7470     0.1821   4.103 4.08e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 540.18  on 792  degrees of freedom
## Residual deviance: 193.81  on 784  degrees of freedom
## AIC: 211.81
## 
## Number of Fisher Scoring iterations: 9

1 Results

1.1 1-d Heatmap

1.2 Location meda_plots

1.3 Outliers as given by randomForest

1.4 Correlation Matrix

1.5 Cumulative Variance with Elbows

1.6 Paired Hex-binned plot

1.7 Hierarchical GMM Classifications

1.8 Hierarchical GMM Dendrogram

1.9 Stacked Means

1.10 Cluster Means

2 Restricting hGMM to \(K = 2\)

Here we are restricting hierarchical GMM to only go through on level. We are comparing the cluster results to the gaba labels.

set.seed(3144)
h2 <- hmc(sdat[, -1], maxDepth = 2, ccol = ccol, model = c("VVV"))
h2lab <- viridis(max(h2$dat$labels$col))
h2col <- h2$dat$labels$col

2.1 K = 2 stacked means plot

p1 <- stackM(h2, ccol = ccol, centered = TRUE, depth = 1)
p1

2.2 Pairs plot colored by true gaba classification

cols <- c("black", "magenta")[gabaID$gaba+1]
acols <- alpha(cols, 0.35)
#pairs(h2$dat$data, pch = 19, cex = 0.7, col = acols)
#plot(h2$dat$data, col = acols, pch = c(19,3)[gaba+1], cex = c(0.5,1)[gaba+1])
pairs(sdat[,-1], col = acols, pch = c(19,3)[gaba+1], cex = c(0.5,1)[gaba+1])

2.3 Pairs plot colored by hGMM cluster classification

acols2 <- alpha(h2lab[h2$dat$labels$col], 0.45)
par(bg = "gray45")
#plot(h2$dat$data, pch = c(3,20)[gaba + 1], cex = 1, col = acols2)
pairs(sdat[,-1], pch = 19, cex = 0.7, col = acols2)

dev.off()
## null device 
##           1

3 Permutation test for ARI

p0 <- mclust::adjustedRandIndex(pred, gaba)
perms <- foreach(i = 1:1.5e4, .combine = c) %dopar% {
  set.seed(i*2)
  mclust::adjustedRandIndex(sample(pred), gaba)
}
pv0 <- sum(c(perms,p0) >= p0)/length(perms)
hist(perms, xlim = c(min(perms), p0 + 0.25*p0),
     main = "permutation test of ARI values", probability = TRUE)
#hist(perms, probability = TRUE)
abline(v = p0, col = 'red')

t1
##        truth
## pred    FALSE TRUE
##   FALSE   590    9
##   TRUE    118   76

4 Summary Table

measurment value
Misclassification Rate 0.1601513
Accuracy 0.8398487
Sensitivity 0.8941176
Specificity 0.8333333
Precision 0.3917526
Recall 0.8941176
ARI 0.3584828
\(p\)-value for ARI 0.000067
F1-score 0.5448029
TP 76
FP 118
TN 590
FN 9