- 博客(10)
- 收藏
- 关注
原创 R1 Lecture 10 Class Notes
R1 Lecture 10 Class NotesBy YU, XiangMay 5 2015假设检验: 均值Student’s t-testOne-sample t-test理论基础1.为了做单样本t检验,需要计算 tt 统计量的值:t=x¯−μ0s/n‾‾√t=\frac{\bar{x}-\mu_0}{s/\sqrt{n}}x¯\bar{x} 是样本均值(sample mean), ss
2015-05-07 21:11:30
642
原创 R1 Lecture 09 Class Notes
R1 Lecture 09 Class Notes 苹果盘子问题解答apple_dish <- function(N){ x <- sample(3,4*N,replace=TRUE) apple <- matrix(x,ncol=4) result <- apply(apple,1,f1) table(result)/N}f1 <- function(x){
2015-04-28 16:15:29
468
原创 R1 Lecture 08 Class Notes
R1 Lecture 08 Class NotesBy YU, XiangApr 21 2015直线 线段 曲线 高级绘图函数 低级绘图函数plot , curve , hist , barplot , pie , boxplotpoints , lines , segments , abline , polygonR内置的概率分布一些概率分布函数名称,前缀 * = d,p,q,r === R
2015-04-22 16:38:47
614
原创 R1 Lecture 07 Class Notes
R1 Lecture 07b Class NotesBy YU,XiangApr 14 2015常用统计图形直方图 条形图折线图 散点图饼图箱线图barplotDescription: Creates a bar plot with vertical or horizontal bars.Usage: barplot(height, ...) ## Default S3 me
2015-04-18 13:45:01
645
原创 R1 Lecture 06 Class Notes
R1 Lecture 06 Class NotesYU,XiangApr 7 2015作业答疑fib2 <- function(N){ f <- c(1,1) i <- 1 while(f[i]+f[i+1]<=N){ f[i+2] <- f[i]+f[i+1] i <- i+1 } f}开方的实现写一个函数 sqrt2 <
2015-04-11 22:13:11
614
原创 【R for fun 系列】汉诺塔
著名的汉诺塔有一个几乎同样著名的基于递归的算法。网上到处都有的各(yī)种(mú)各(yī)样(yàng)的解法是用printf的,非常简(nán)洁(kàn)。作为视觉动物,这几天用R写了一个小程序,能够生成任意多层的汉诺塔可视化解法。下面是一个五层的演示考验你毅力的时刻到了 :-D
2015-04-03 21:09:27
865
1
原创 R1 Lecture 05 Class Notes
R1 Lecture 05 Class Notesby YU,XiangMar 31 2015简单编程前N个数的平方和# 用 for 循环的做法f1 <- function(N){ s <- 0 for(i in 1:N){ s <- s+i^2 } s}# 用 while 循环的做法f2 <- function(N){ s <- 0
2015-03-31 15:49:10
646
原创 R1 Lecture 04 Class Notes
R1_04 编程基础:控制流&函数入门by YU,XiangMar 24 2015控制流(判断和循环)判断 if,else,ifelseif(statement) { do ...}else { do else...}练习1写一个if else语句,功能是: 当y是偶数时,打印出y的一半,当y是奇数时,打印出3y+1y <- 17if(y%%2==0) print(y/2)
2015-03-30 15:40:55
479
原创 R1 Lecture 02 Class Notes
R1 Lecture 2 Class Notesby YU,XiangMar 10, 2015R数据结构向量矩阵数组列表数据框向量向量的生成c(2,4,6,7,8)## [1] 2 4 6 7 812:30## [1] 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30seq(from=3,to=50,by=2)## [1
2015-03-30 12:35:24
527
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人