Commits

Casey Dunn  committed 7e1943d

minor cleanup

  • Participants
  • Parent commits 611f8d3

Comments (0)

Files changed (1)

File regularization.r

 
 set.seed(123456)
 
-
-# Set up plotting parameters
-mycols <- rainbow(100)
-mycols <- heat.colors(100)
-mycols <- tim.colors(100)
-mybreaks <- seq(-1, 1, length.out=101)
-
-
 # Build the true matrix
 trueCovariance = test_cov_matrix()
 
 W <- Z[,,1]	# Grab one simulation
 contrasts <- apply( W, 2, function(a) pic(a, phy) )
 
-p <- ncol( contrasts )
-n <- nrow( contrasts )
 
 # The covariance matrix estimated directly from the contrasts
 
 # Bickel, P. J. & Levina, E. Covariance regularization by thresholding. 
 # Ann. Statist. 36, 2577–2604 (2008). http://dx.doi.org/10.1214/08-AOS600
 
+p <- ncol( contrasts )
+n <- nrow( contrasts )
 
-bickel <- contrastcor*(abs(contrastcor)>sqrt(log(p)/n))
+bickel <- contrastcor * ( abs(contrastcor) > sqrt(log(p)/n) )
 
 # Regularization by convex Minimization
 # Luo, X. High Dimensional Low Rank and Sparse Covariance Matrix Estimation via 
 luo <- relist.l[[1]]
 
 
+# Set up plotting parameters
+mycols <- rainbow(100)
+mycols <- heat.colors(100)
+mycols <- tim.colors(100)
+mybreaks <- seq(-1, 1, length.out=101)
+
+
 # Plot the results
 
 pdf(file="regularization.pdf", width=7, height=3.5)