#Generating normal distribution (Pseudo) random number
x<-rnorm(10)
x x2<-rnorm(10,2,1)
x2 set.seed()
#Generating Poisson data rpois(10,1)
rpois(10,2)
rpois(10,20) ppois(2,2) #Cumulative distribution ##P r(x <= 2) 平均發生率為2
ppois(4,2) #Cumulative distribution ##P r(x <= 4) 平均發生率為4 #線性 y = B0+B1X+e
#e~N(0,2^2) 標準差為2正態分布
#assume x~N(0,1^2) B0=o.5 B1=2
set.seed(20)
x <- rnorm(100)
e <- rnorm(100,0,2)
y <- 0.5 + 2 * x + e
summary(y)
plot(x,y) # 若x為binary ex性別
set.seed(20)
x <- rbinom(100,1,0.5) #得到1的機率為0.5
e <- rnorm(100,0,2)
y <- 0.5 + 2 * x + e
summary(y)
plot(x,y) #廣義線性模組可能服從poisson分布 Y~Poisson(m)
#log mu = B0 + B1X #log mu 服從線性
#B0 = 0.5 B1 =0.3 #y服從 平均值為mu 的 PD
set.seed(20)
x <- rnorm(100)
log.mu <- 0.5 + 0.3 * x
y <- rpois(100,exp(log.mu))
summary(y)
plot(x,y) # sample(range vector, numbers)
# sample(range vector) 重新排列
# sample(range vector, replace = T) 重複性抽樣 #Profiler profiling is better than guessing
#Premature optimization is the root of all evil
system.time() #proc_time (class)
#user time: time charged to the CPU(s) for this expression
#elapsed time: "wall clock" time 運行時間
#parallel processing via parallel package ##elapsed time > user time
system.time(readlines("http://www.google.com")) #elapsed time < user time
hilbert <- function(n){
i <- 1:n
1/outer(i -1, i, "+")
}
x <- hilbert(1000)
system.time(svd(x)) # svd 多線程線性代數

最新文章

  1. .NET 的 WebSocket 开发包比较(转)
  2. Windows Azure Service Bus (2) 队列(Queue)入门
  3. AC日记——质因数分解 1.5 43
  4. 网页元素定位神器之Xpath详解
  5. Windows Azure 微软公有云体验(一) 网站、SQL数据库、虚拟机
  6. SVN eclipse插件错误
  7. jquery的uploadify上传jsp+servlet
  8. 以程序的方式操纵NTFS的文件权限(陈皓)
  9. http://riddle.arthurluk.net walkthrough
  10. 《JavaScript高级程序设计》读书笔记 ---创建对象
  11. java原装代码完成pdf在线预览和pdf打印及下载
  12. JAVA入门[9]-mybatis多表关联查询
  13. [Vijos 1143]三取方格数
  14. Spring Cloud 2-Hystrix DashBoard仪表盘(五)
  15. C# - 什么是事件绑定?
  16. [ZOJ 4020] Traffic Light
  17. Python&#160;再谈变量作用域与变量引用
  18. linux4.10.8 内核移植(二)---初步裁剪、分区修改和文件系统
  19. Unity3d 之 理解Gameobject ,gameObject,Transform,transform的区别和关联
  20. MySQL使用root用户授权出现错误ERROR 1045 (28000) at line 2: Access denied for user &#39;root&#39;@&#39;%&#39; (using password: YES)解决办法

热门文章

  1. 磁盘挂载方法 fdisk parted
  2. 一、Redis事务原理分析
  3. wifi编辑 centos
  4. SharePoint Framework 基于团队的开发(二)
  5. java富文本编辑器KindEditor
  6. Oracle学习DayTwo
  7. 斐讯 天天牛绑定教程 邀请码:8vozbf
  8. 运维ps语法---》ps、pstree、top、htop、nice、renice、kill、ulimit、w 和 who 和 whoami、pgrep、fg 和 bg、ipcs
  9. 禁用ViewPager的滑动事件
  10. WEB学习笔记12-高可读性的HTML之如何正确设计表单