User Tools

Site Tools


b:head_first_statistics:visualization

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
b:head_first_statistics:visualization [2025/09/02 23:43] – [Histogram skewedness] hkimscilb:head_first_statistics:visualization [2026/09/01 23:14] (current) – [Scatter plot] hkimscil
Line 91: Line 91:
 </code> </code>
 {{:b:head_first_statistics:pasted:20240904-082258.png}} {{:b:head_first_statistics:pasted:20240904-082258.png}}
 +
 +<tabbox histogram.r>
 +<code>
 +dat.iq <- rnorm(1000, 100, 15)
 +head(dat.iq)
 +tail(dat.iq)
 +head(dat.iq, n=12)
 +tail(dat.iq, n=12)
 +
 +mean(dat.iq)
 +sd(dat.iq)
 +
 +hist(dat.iq)
 +hist(dat.iq, breaks=30, col='lightblue')
 +
 +set.seed(101)
 +dat.iq <- rnorm(1000, 100, 15)
 +head(dat.iq)
 +tail(dat.iq)
 +head(dat.iq, n=12)
 +tail(dat.iq, n=12)
 +
 +mean(dat.iq)
 +sd(dat.iq)
 +
 +hist(dat.iq)
 +hist(dat.iq, breaks=30, col='lightblue')
 +</code>
 +<tabbox histogram.out>
 +<code>
 +> dat.iq <- rnorm(1000, 100, 15)
 +> head(dat.iq)
 +[1]  95.50853 103.02007  96.27211  93.36366  89.79188  64.85473
 +> tail(dat.iq)
 +[1] 105.04459 123.00613 106.41126  83.46953  90.00495 111.90697
 +> head(dat.iq, n=12)
 + [1]  95.50853 103.02007  96.27211  93.36366  89.79188  64.85473  90.68743 103.88809 100.67983  80.20597  65.00360
 +[12] 101.32801
 +> tail(dat.iq, n=12)
 + [1]  93.27641  81.50208 119.88851  88.58754  74.30448  67.81593 105.04459 123.00613 106.41126  83.46953  90.00495
 +[12] 111.90697
 +
 +> mean(dat.iq)
 +[1] 100.433
 +> sd(dat.iq)
 +[1] 14.82424
 +
 +> hist(dat.iq)
 +> hist(dat.iq, breaks=30, col='lightblue')
 +
 +> set.seed(101)
 +> dat.iq <- rnorm(1000, 100, 15)
 +> head(dat.iq)
 +[1]  95.10945 108.28693  89.87584 103.21539 104.66154 117.60949
 +> tail(dat.iq)
 +[1] 103.68009  96.19170 119.76069  83.43941 100.44177  87.48531
 +> head(dat.iq, n=12)
 + [1]  95.10945 108.28693  89.87584 103.21539 104.66154 117.60949 109.28185  98.30899 113.75542  96.65111 107.89672
 +[12]  88.07733
 +> tail(dat.iq, n=12)
 + [1] 100.97563  88.75387 115.34405 105.59120 111.13368  98.84508 103.68009  96.19170 119.76069  83.43941 100.44177
 +[12]  87.48531
 +
 +> mean(dat.iq)
 +[1] 99.47707
 +> sd(dat.iq)
 +[1] 14.38667
 +
 +> hist(dat.iq)
 +> hist(dat.iq, breaks=30, col='lightblue')
 +</code>
 +{{.:pasted:20260901-230508.png}}
 +</tabbox>
 +
 ====== Scatter plot ====== ====== Scatter plot ======
 <code> <code>
Line 132: Line 206:
  
  
- <code># Simple Scatterplot +<code># Simple Scatterplot 
-attach(mtcars+plot(mtcars$wt, mtcars$mpg, main="Scatterplot Example",
-plot(wt, mpg, main="Scatterplot Example",+
    xlab="Car Weight ", ylab="Miles Per Gallon ",     xlab="Car Weight ", ylab="Miles Per Gallon ", 
    pch=19)</code>    pch=19)</code>
- +{{.:pasted:20260901-230946.png?600}}
-{{:b:head_first_statistics:pasted:20240904-083016.png}}+
  
 explanatory (설명) variable at x axis explanatory (설명) variable at x axis
Line 148: Line 220:
  
 <code># Add fit lines <code># Add fit lines
-abline(lm(mpg~wt), col="red") # regression line (y~x)+abline(lm(mtcars$mpg ~ mtcars$wt), col="red", lwd=2) # regression line (y~x)
 </code> </code>
-{{:b:head_first_statistics:pasted:20240904-083157.png}} +{{.:pasted:20260901-231239.png?600}} 
 +{{{.:pasted:20260901-231245.png}}
 Outlier에 대한 주의 Outlier에 대한 주의
 [{{:pearson-6.png? |}}] [{{:pearson-6.png? |}}]
Line 304: 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 312: Line 384:
 prop.1 <- 0.3 prop.1 <- 0.3
 # Mixing proportion for Mode 2 # Mixing proportion for Mode 2
-prop.2 <- 0.# This is 1 - prop1+prop.2 <- 0.# This is 1 - prop1
 # Mixing proportion for Mode 2 # Mixing proportion for Mode 2
-prop.3 <- 0.# This is 1 - prop1+prop.3 <- 1.# This is 1 - prop1
  
 # Number of samples to generate # Number of samples to generate
Line 347: Line 419:
 </WRAP> </WRAP>
 <WRAP column half> <WRAP column half>
-{{:b:head_first_statistics:pasted:20250903-082247.png}}+{{:b:head_first_statistics:pasted:20250908-082219.png}}
 </WRAP> </WRAP>
 <WRAP clear/> <WRAP clear/>
Line 353: Line 425:
  
 ====== box plot ====== ====== box plot ======
 +<WRAP column half>
 <code> <code>
 # Boxplot of MPG by Car Cylinders # Boxplot of MPG by Car Cylinders
Line 361: Line 433:
     ylab="Miles Per Gallon")     ylab="Miles Per Gallon")
 </code> </code>
-{{:c:ps1-1:2019:pasted:20190909-111438.png}}+</WRAP>
  
 +<WRAP column half>
 +{{:c:ps1-1:2019:pasted:20190909-111438.png}}
 +</WRAP>
 +<WRAP clear/>
 ====== see also ====== ====== see also ======
 https://r-graph-gallery.com/ https://r-graph-gallery.com/
  
b/head_first_statistics/visualization.1756856601.txt.gz · Last modified: by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki