# Demo of Classification

R code demo of

1. Linear discriminant analysis (LDA)
3. k-nearest neighbor (KNN)

# Solving Bridge Regression Using Local Quadratic Approximation (LQA)

Bridge regression is a broad class of penalized regression, and can be used in high-dimensional regression problems.

It includes the ridge (q=2) and lasso (q =1) as special cases.

More technical details can be found here. Below R code demonstrates:

1. sovling bridge regression using local quadratic approximation (LQA) and Newton–Raphson algorithm.
2. simulation of tuning parameters using 50/50/200 observations (training/validation/testing).

# The Consistent Estimator of Bernouli Distribution

This is a simple post showing the basic knowledge of statistics, the consistency.

For Bernoulli distribution, $Y \sim B(n,p)$, $\hat{p}=Y/n$ is a consistent estimator of $p$, because:

for any positive number $\epsilon$.

Here is the simulation to show the estimator is consitent.

# Permutation Test for Principal Component Analysis

The procedure of permutation test for PCA is as follows:

For each replicate,

1. Individually permute each column of the data matrix.

2. Conduct the PCA and find the proportion of variance explained by each of the components 1 to s. Store this information.

3. Repeat 1 and 2 R times.

At the end of this we will have a matrix with R rows and s columns that contains the proportion of variance explained by each component for each replicate.

Finally, compare the observed values from the original data to the set of values from the permutations in order to determine the approximate p-value.

The R code:

The result:

$pve Comp.1 Comp.2 Comp.3 Comp.4 Comp.5 Comp.6 Comp.7 Comp.8 0.23129378 0.14864525 0.11552865 0.06741744 0.06274641 0.05858431 0.05033795 0.04484122 Comp.9 Comp.10 0.03873311 0.03431297$pval
[1] 0.000 0.000 0.000 1.000 1.000 0.996 1.000 1.000 1.000 1.000


Demo of SVM

# Linear Regression With Cross Validation

Cross validation for linear model and the bootstrap confidence interval for coefficients

# Estimate Gamma Distribution Parmaters Using MME and MLE

This post shows how to estimate gamma distribution parameters using (a) moment of estimation (MME) and (b) maximum likelihood estimate (MLE).

The probability density function of Gamma distribution is

The MME:

We can calculate the MLE of $\alpha$ using the Newton-Raphson method.

For $k =1,2,…,$

where

Use the MME for the initial value of $\alpha^{(0)}$, and stop the approximation when $\vert \hat{\alpha}^{(k)}-\hat{\alpha}^{(k-1)} \vert < 0.0000001$. The MLE of $\beta$ can be found by $\hat{\beta} = \bar{X} / \hat{\alpha}$.

Below is the R code.

# 2015

Happy new year!

Hopefully, I will write and code more often in 2015.

Stay tuned!

# CFDA Approved BGI’s Next Generation Sequencing Diagnostic Products

http://www.knowgene.com/question/677 BGISEQ-1000基因测序仪基于Complete Genomics平台，配套的试剂盒为胎儿染色体非整倍体（T21、T18、T13）检测试剂盒（联合探针锚定连接测序法）。CG平台的特点是通量高，但周期较长，因此BGISEQ-1000应该主要会应用于全国范围内的样品，集中测序分析；

BGISEQ-100基因测序仪基于Ion Torrent平台，配套的试剂盒为胎儿染色体非整倍体（T21、T18、T13）检测试剂盒（半导体测序法）。Ion Torrent平台的特点是测序周期短，可灵活部署，BGISEQ-100有很大可能会被部署到有一定业务量的大中型医院，就地采样、测序、分析并出具报告.