b:head_first_statistics:visualization
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| b:head_first_statistics:visualization [2025/09/02 23:38] – [Histogram skewedness] hkimscil | b:head_first_statistics:visualization [2026/09/01 23:14] (current) – [Scatter plot] hkimscil | ||
|---|---|---|---|
| Line 91: | Line 91: | ||
| </ | </ | ||
| {{: | {{: | ||
| + | |||
| + | <tabbox histogram.r> | ||
| + | < | ||
| + | dat.iq <- rnorm(1000, 100, 15) | ||
| + | head(dat.iq) | ||
| + | tail(dat.iq) | ||
| + | head(dat.iq, | ||
| + | tail(dat.iq, | ||
| + | |||
| + | mean(dat.iq) | ||
| + | sd(dat.iq) | ||
| + | |||
| + | hist(dat.iq) | ||
| + | hist(dat.iq, | ||
| + | |||
| + | set.seed(101) | ||
| + | dat.iq <- rnorm(1000, 100, 15) | ||
| + | head(dat.iq) | ||
| + | tail(dat.iq) | ||
| + | head(dat.iq, | ||
| + | tail(dat.iq, | ||
| + | |||
| + | mean(dat.iq) | ||
| + | sd(dat.iq) | ||
| + | |||
| + | hist(dat.iq) | ||
| + | hist(dat.iq, | ||
| + | </ | ||
| + | <tabbox histogram.out> | ||
| + | < | ||
| + | > dat.iq <- rnorm(1000, 100, 15) | ||
| + | > head(dat.iq) | ||
| + | [1] 95.50853 103.02007 | ||
| + | > tail(dat.iq) | ||
| + | [1] 105.04459 123.00613 106.41126 | ||
| + | > head(dat.iq, | ||
| + | | ||
| + | [12] 101.32801 | ||
| + | > tail(dat.iq, | ||
| + | | ||
| + | [12] 111.90697 | ||
| + | > | ||
| + | > mean(dat.iq) | ||
| + | [1] 100.433 | ||
| + | > sd(dat.iq) | ||
| + | [1] 14.82424 | ||
| + | > | ||
| + | > hist(dat.iq) | ||
| + | > hist(dat.iq, | ||
| + | > | ||
| + | > set.seed(101) | ||
| + | > dat.iq <- rnorm(1000, 100, 15) | ||
| + | > head(dat.iq) | ||
| + | [1] 95.10945 108.28693 | ||
| + | > tail(dat.iq) | ||
| + | [1] 103.68009 | ||
| + | > head(dat.iq, | ||
| + | | ||
| + | [12] 88.07733 | ||
| + | > tail(dat.iq, | ||
| + | [1] 100.97563 | ||
| + | [12] 87.48531 | ||
| + | > | ||
| + | > mean(dat.iq) | ||
| + | [1] 99.47707 | ||
| + | > sd(dat.iq) | ||
| + | [1] 14.38667 | ||
| + | > | ||
| + | > hist(dat.iq) | ||
| + | > hist(dat.iq, | ||
| + | </ | ||
| + | {{.: | ||
| + | </ | ||
| + | |||
| ====== Scatter plot ====== | ====== Scatter plot ====== | ||
| < | < | ||
| Line 132: | Line 206: | ||
| - | < | + | < |
| - | attach(mtcars) | + | plot(mtcars$wt, mtcars$mpg, main=" |
| - | plot(wt, mpg, main=" | + | |
| | | ||
| | | ||
| - | + | {{.:pasted:20260901-230946.png?600}} | |
| - | {{: | + | |
| explanatory (설명) variable at x axis | explanatory (설명) variable at x axis | ||
| Line 148: | Line 220: | ||
| < | < | ||
| - | abline(lm(mpg~wt), | + | abline(lm(mtcars$mpg ~ mtcars$wt), col=" |
| </ | </ | ||
| - | {{:b:head_first_statistics:pasted:20240904-083157.png}} | + | {{.:pasted:20260901-231239.png? |
| + | {{{.:pasted:20260901-231245.png}} | ||
| Outlier에 대한 주의 | Outlier에 대한 주의 | ||
| [{{: | [{{: | ||
| Line 249: | Line 321: | ||
| {{: | {{: | ||
| </ | </ | ||
| + | <WRAP clear/> | ||
| + | ====== Histogram Modality====== | ||
| <WRAP column half> | <WRAP column half> | ||
| + | Unimodal | ||
| < | < | ||
| ### unimodal data | ### unimodal data | ||
| Line 267: | Line 342: | ||
| {{: | {{: | ||
| </ | </ | ||
| + | |||
| <WRAP clear/> | <WRAP clear/> | ||
| + | Bimodal distribution | ||
| <WRAP column half> | <WRAP column half> | ||
| < | < | ||
| Line 290: | Line 366: | ||
| </ | </ | ||
| <WRAP clear/> | <WRAP clear/> | ||
| - | |||
| <WRAP column half> | <WRAP column half> | ||
| Line 301: | Line 376: | ||
| # Parameters for the second normal distribution (Mode 2) | # Parameters for the second normal distribution (Mode 2) | ||
| m.2 <- 100 | m.2 <- 100 | ||
| - | sd.2 <- 8 | + | sd.2 <- 15 |
| m.3 <- 160 | m.3 <- 160 | ||
| Line 309: | Line 384: | ||
| prop.1 <- 0.3 | prop.1 <- 0.3 | ||
| # Mixing proportion for Mode 2 | # Mixing proportion for Mode 2 | ||
| - | prop.2 <- 0.4 # This is 1 - prop1 | + | prop.2 <- 0.6 # This is 1 - prop1 |
| # Mixing proportion for Mode 2 | # Mixing proportion for Mode 2 | ||
| - | prop.3 <- 0.3 # This is 1 - prop1 | + | prop.3 <- 1.0 # This is 1 - prop1 |
| # Number of samples to generate | # Number of samples to generate | ||
| Line 345: | Line 419: | ||
| </ | </ | ||
| <WRAP column half> | <WRAP column half> | ||
| - | {{: | + | {{: |
| </ | </ | ||
| <WRAP clear/> | <WRAP clear/> | ||
| Line 351: | Line 425: | ||
| ====== box plot ====== | ====== box plot ====== | ||
| + | <WRAP column half> | ||
| < | < | ||
| # Boxplot of MPG by Car Cylinders | # Boxplot of MPG by Car Cylinders | ||
| Line 359: | Line 433: | ||
| ylab=" | ylab=" | ||
| </ | </ | ||
| - | {{: | + | </ |
| + | <WRAP column half> | ||
| + | {{: | ||
| + | </ | ||
| + | <WRAP clear/> | ||
| + | ====== see also ====== | ||
| + | https:// | ||
b/head_first_statistics/visualization.1756856296.txt.gz · Last modified: by hkimscil
