请选择 进入手机版 | 继续访问电脑版
楼主: Nicolle
5888 45

R in Action, 2nd Edition [推广有奖]

巨擘

0%

还不是VIP/贵宾

-

TA的文库  其他...

Python(Must-Read Books)

SAS Programming

Must-Read Books

威望
16
论坛币
12402323 个
通用积分
1620.7415
学术水平
3305 点
热心指数
3329 点
信用等级
3095 点
经验
477211 点
帖子
23879
精华
91
在线时间
9878 小时
注册时间
2005-4-23
最后登录
2022-3-6

Nicolle 学生认证  发表于 2015-10-16 08:03:23 |显示全部楼层 |坛友微信交流群
提示: 作者被禁止或删除 内容自动屏蔽

本帖被以下文库推荐

hjtoh 发表于 2015-10-16 08:07:55 来自手机 |显示全部楼层 |坛友微信交流群

A scatter plot with best-fit lines

  1. A scatter plot with best-fit lines

  2. attach(mtcars)
  3. plot(wt, mpg,
  4.      main="Basic Scatter plot of MPG vs. Weight",
  5.      xlab="Car Weight (lbs/1000)",
  6.      ylab="Miles Per Gallon ", pch=19)
  7. abline(lm(mpg~wt), col="red", lwd=2, lty=1)
  8. lines(lowess(wt,mpg), col="blue", lwd=2, lty=2)
复制代码
  1. library(car)
  2. scatterplot(mpg ~ wt | cyl, data=mtcars, lwd=2, span=0.75,
  3.             main="Scatter Plot of MPG vs. Weight by # Cylinders",
  4.             xlab="Weight of Car (lbs/1000)",
  5.             ylab="Miles Per Gallon",
  6.             legend.plot=TRUE,
  7.             id.method="identify",
  8.             labels=row.names(mtcars),
  9.             boxplots="xy"
  10. )
复制代码

已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

使用道具

牛尾巴 发表于 2015-10-16 08:55:41 |显示全部楼层 |坛友微信交流群
请查收了。

本帖隐藏的内容

R in Action second edition.rar (8.35 MB) 本附件包括:
  • R in Action second edition.pdf


已有 1 人评分经验 论坛币 学术水平 收起 理由
Nicolle + 100 + 100 + 1 精彩帖子

总评分: 经验 + 100  论坛币 + 100  学术水平 + 1   查看全部评分

使用道具

mike68097 发表于 2015-10-16 11:07:52 |显示全部楼层 |坛友微信交流群

High-density scatter plots

  1. High-density scatter plots

  2. When there’s a significant overlap among data points, scatter plots become less useful for observing relationships. Consider the following contrived example with 10,000 observations falling into two overlapping clusters of data:

  3. set.seed(1234)
  4. n <- 10000
  5. c1 <- matrix(rnorm(n, mean=0, sd=.5), ncol=2)
  6. c2 <- matrix(rnorm(n, mean=3, sd=2), ncol=2)
  7. mydata <- rbind(c1, c2)
  8. mydata <- as.data.frame(mydata)
  9. names(mydata) <- c("x", "y")
  10. If you generate a standard scatter plot between these variables using the following code

  11. with(mydata,
  12.      plot(x, y, pch=19, main="Scatter Plot with 10,000 Observations"))
  13. The smoothScatter() function uses a kernel-density estimate to produce smoothed color density representations of the scatter plot. The following code

  14. with(mydata,
  15.      smoothScatter(x, y, main="Scatter Plot Colored by Smoothed Densities"))
复制代码

已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

使用道具

nieqiang110 学生认证  发表于 2015-10-16 12:10:23 |显示全部楼层 |坛友微信交流群

3D scatter plots

  1. 3D scatter plots

  2. Scatter plots and scatter-plot matrices display bivariate relationships. What if you want to visualize the interaction of three quantitative variables at once? In this case, you can use a 3D scatter plot.

  3. For example, say that you’re interested in the relationship between automobile mileage, weight, and displacement. You can use the scatterplot3d() function in the scatterplot3d package to picture their relationship. The format is

  4. scatterplot3d(x, y, z)
  5. where x is plotted on the horizontal axis, y is plotted on the vertical axis, and z is plotted in perspective. Continuing the example,

  6. library(scatterplot3d)
  7. attach(mtcars)
  8. scatterplot3d(wt, disp, mpg,
  9.     main="Basic 3D Scatter Plot")
复制代码

已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

使用道具

nieqiang110 学生认证  发表于 2015-10-16 12:12:06 |显示全部楼层 |坛友微信交流群

Sample sizes for detecting significant effects in a one-way ANOVA

  1. Sample sizes for detecting significant effects in a one-way ANOVA

  2. library(pwr)
  3. es <- seq(.1, .5, .01)
  4. nes <- length(es)

  5. samsize <- NULL
  6. for (i in 1:nes){
  7.     result <- pwr.anova.test(k=5, f=es[i], sig.level=.05, power=.9)
  8.     samsize[i] <- ceiling(result$n)
  9. }

  10. plot(samsize,es, type="l", lwd=2, col="red",
  11.      ylab="Effect Size",
  12.      xlab="Sample Size (per cell)",
  13.      main="One Way ANOVA with Power=.90 and Alpha=.05")
  14. Graphs such as these can help you estimate the impact of various conditions on your experimental design. For example, there appears to be little bang for the buck in increasing the sample size above 200 observations per group. We’ll look at another plotting example in the next section.
复制代码

使用道具

acctoftony 发表于 2015-10-16 15:00:58 |显示全部楼层 |坛友微信交流群

Listing 10.2

Listing 10.2. Sample-size curves for detecting correlations of various sizes

已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

使用道具

葫芦爷爷 学生认证  发表于 2015-10-17 14:45:31 |显示全部楼层 |坛友微信交流群

Listing 9.1. One-way ANOVA

Listing 9.1. One-way ANOVA

已有 1 人评分经验 收起 理由
Nicolle + 20 精彩帖子

总评分: 经验 + 20   查看全部评分

使用道具

laoliwan_098 发表于 2015-10-18 00:26:28 |显示全部楼层 |坛友微信交流群
  1. Listing 8.1. Simple linear regression

  2. > fit <- lm(weight ~ height, data=women)
  3. > summary(fit)

  4. Call:
  5. lm(formula=weight ~ height, data=women)

  6. Residuals:
  7.    Min     1Q Median     3Q    Max
  8. -1.733 -1.133 -0.383  0.742  3.117

  9. Coefficients:
  10.             Estimate Std. Error t value Pr(>|t|)
  11. (Intercept) -87.5167     5.9369   -14.7  1.7e-09 ***
  12. height        3.4500     0.0911    37.9  1.1e-14 ***
  13. ---
  14. Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 '' 1

  15. Residual standard error: 1.53 on 13 degrees of freedom
  16. Multiple R-squared: 0.991,      Adjusted R-squared: 0.99
  17. F-statistic: 1.43e+03 on 1 and 13 DF,  p-value: 1.09e-14

  18. > women$weight

  19. [1] 115 117 120 123 126 129 132 135 139 142 146 150 154 159 164

  20. > fitted(fit)

  21.      1      2      3      4      5      6      7      8      9
  22. 112.58 116.03 119.48 122.93 126.38 129.83 133.28 136.73 140.18
  23.     10     11     12     13     14     15
  24. 143.63 147.08 150.53 153.98 157.43 160.88

  25. > residuals(fit)

  26.     1     2     3     4     5     6     7     8     9    10    11
  27. 2.42  0.97  0.52  0.07 -0.38 -0.83 -1.28 -1.73 -1.18 -1.63 -1.08
  28.    12    13    14    15
  29. -0.53  0.02  1.57  3.12

  30. > plot(women$height,women$weight,
  31.        xlab="Height (in inches)",
  32.        ylab="Weight (in pounds)")
  33. > abline(fit)
复制代码

已有 1 人评分经验 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 经验 + 20   查看全部评分

使用道具

Nicolle 学生认证  发表于 2015-10-18 01:20:30 |显示全部楼层 |坛友微信交流群

Spinning 3D scatter plots

提示: 作者被禁止或删除 内容自动屏蔽

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-3-29 09:34