Publications by R on Guangchuang Yu
one-dimensional integrals
The foundamental idea of numerical integration is to estimate the area of the region in the xy-plane bounded by the graph of function f(x). The integral was esimated by divide x to small intervals, then add all the small approximations to give a total approximation. Numerical integration can be done by trapezoidal rule, simpson’s rule and quadr...
3162 sym R (4544 sym/15 pcs) 4 img 6 tbl
Single variable optimization
Optimization means to seek minima or maxima of a funtion within a given defined domain. If a function reach its maxima or minima, the derivative at that point is approaching to 0. If we apply Newton-Raphson method for root finding to f’, we can get the optimizing f. ?View Code RSPLUS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24...
1343 sym R (1210 sym/5 pcs) 2 tbl
Estimate Probability and Quantile
Simple root finding and one dimensional integrals algorithms were implemented in previous posts. These algorithms can be used to estimate the cumulative probabilities and quantiles. Here, take normal distribution as an example. Normal distribution is defined as: #probability density function y.dnorm <- function(x, mean=0, sd=1) exp(-(x-mean)^2/(2...
1602 sym R (540 sym/5 pcs) 1 tbl
The easiest way to get UTR sequence
I just figure out the way to query UTR sequence from ensembl by biomart tool. It is very simple compare with using bioperl to parse gbk file to extract UTR sequence. ?View Code RSPLUS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 require(biomaRt) require(org.Hs.eg.db) ensembl = useMart("ensembl", dataset = "hsapiens_gene_ensembl") eg <- mappedkeys(org....
1103 sym R (431 sym/2 pcs) 1 tbl
Machine Learning Ex2 – Linear Regression
Thanks to this post, I found OpenClassroom. In addition, thanks to Andrew Ng and his lectures, I took my first course in machine learning. These videos are quite easy to follow. Exercise 2 requires implementing gradient descent algorithm to model data with linear regression. ?View Code RSPLUS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ...
1249 sym R (989 sym/2 pcs) 2 img 1 tbl
clusterProfiler in Bioconductor 2.8
In recently years, high-throughput experimental techniques such as microarray and mass spectrometry can identify many lists of genes and gene products. The most widely used strategy for high-throughput data analysis is to identify different gene clusters based on their expression profiles. Another commonly used approach is to annotate these genes...
2180 sym
Machine Learning Ex3 – Multivariate Linear Regression
Part 1. Finding alpha. The first question to resolve in Exercise 3 is to pick a good learning rate alpha. This require making an initial selection, running gradient descent and observing the cost function. I test alpha range from 0.01 to 1. ?View Code RSPLUS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ...
1292 sym R (1494 sym/2 pcs) 2 img 1 tbl
[Project Euler] – Problem 57
It is possible to show that the square root of two can be expressed as an infinite continued fraction. √ 2 = 1 + 1/(2 + 1/(2 + 1/(2 + … ))) = 1.414213… By expanding this for the first four iterations, we get: 1 + 1/2 = 3/2 = 1.5 1 + 1/(2 + 1/2) = 7/5 = 1.4 1 + 1/(2 + 1/(2 + 1/2)) = 17/12 = 1.41666… 1 + 1/(2 + 1/(2 + 1/(2 + 1/2))) = 41/29 ...
1639 sym R (744 sym/3 pcs) 1 tbl
[Project Euler] – Problem 58
Starting with 1 and spiralling anticlockwise in the following way, a square spiral with side length 7 is formed. 37 36 35 34 33 32 31 38 17 16 15 14 13 30 39 18 5 4 3 12 29 40 19 6 1 2 11 28 41 20 7 8 9 10 27 42 21 22 23 24 25 26 43 44 45 46 47 48 49 It is interesting to note that the odd squares lie along the bott...
1727 sym R (354 sym/2 pcs) 2 img 1 tbl
ProjectEuler-Problem 46
It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square. 9 = 7 + 212 15 = 7 + 222 21 = 3 + 232 25 = 7 + 232 27 = 19 + 222 33 = 31 + 212 It turns out that the conjecture was false. What is the smallest odd composite that cannot be written as the sum of a prime and twice a square...
1514 sym R (265 sym/2 pcs) 12 img 1 tbl