Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RBC202003_Day2_Period7

sakaue
March 20, 2020

 RBC202003_Day2_Period7

sakaue

March 20, 2020
Tweet

More Decks by sakaue

Other Decks in Education

Transcript

  1. Agenda 1. ͳͥՄࢹԽ͕ඞཁ͔ (5) 2. ώετάϥϜΛඳ͘ (20) 3. ശͻ͛ਤΛඳ͘ (20)

    4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘(15) 5. ԋशʹ͙࣍ԋश (30)
  2. Agenda 1. ͳͥՄࢹԽ͕ඞཁ͔ (5) 2. ώετάϥϜΛඳ͘ (20) 3. ശͻ͛ਤΛඳ͘ (20)

    4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘(15) 5. ԋशʹ͙࣍ԋश (30)
  3. Agenda 1. ͳͥՄࢹԽ͕ඞཁ͔ (5) 2. ώετάϥϜΛඳ͘ (20) 3. ശͻ͛ਤΛඳ͘ (20)

    4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘(15) 5. ԋशʹ͙࣍ԋश (30)
  4. Agenda 1. ͳͥՄࢹԽ͕ඞཁ͔ (5) 2. ώετάϥϜΛඳ͘ (20) 3. ശͻ͛ਤΛඳ͘ (20)

    4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘(15) 5. ԋशʹ͙࣍ԋश (30)
  5. • σʔλΛಡΈࠐΈɼ֬ೝ͠ͳ͕ΒɼώετάϥϜΛඳ͘ 1. > install.packages("corpora") #ࠓճͷRStudio Server Ͱ͸ෆཁ 2. >

    library(corpora) #RStudio Ͱ͸νΣοΫΛೖΕΔͷΈ 3. > data(BNCbiber) #σʔληοτ४උ 4. > head(BNCbiber, 5) #σʔληοτͷ࠷ॳ5ߦΛදࣔ 5. > hist(BNCbiber[, 2]) #ώετάϥϜͷඳը 6. > class(BNCbiber) #σʔλͷΫϥεʢmatrixʣΛ֬ೝ 7. > BNCbiber2 <- as.data.frame(BNCbiber) #data.frame ѻ͍ʹ 8. > hist(BNCbiber2$f01_past_tense) #σʔλ໊$ྻϥϕϧ໊Ͱࢦఆ ͠ඳը 2. ώετάϥϜΛඳ͘
  6. ໊લ ݂ӷܕ ਎௕ ମॏ ࡔຊ B 175 65 ߴڮ B

    177 70 Ѩ෦ B 174 75 ௕໺ A 179 70 দຊ O 170 60 2. ώετάϥϜΛඳ͘ σʔλϑϨʔϜͱ͸
  7. • Excel ͷ WS ͱ΄΅ಉ͡Πϝʔδ • طଘσʔλͷಡࠐʼࣗྗͰ࡞Δ • data.frame() ؔ਺͕࢖͑Δ

    • ϕΫτϧΛ࿈݁ͯ͠࡞Δ • ߦྻΛσʔλϑϨʔϜʹม׵ 2. ώετάϥϜΛඳ͘ σʔλϑϨʔϜͱ͸
  8. • ώετάϥϜͷௐ੔Λ͢Δ • # ώετάϥϜͷλΠτϧͱ࣠ϥϕϧΛมߋ • > hist(BNCbiber[, 2], main

    = "past tense", xlab = "frequency", ylab = "number of texts") • # ώετάϥϜͷ৭Λมߋ • > hist(BNCbiber[, 2], main = "past tense", xlab = "frequency", ylab = "number of texts", col = "grey") • > colors()ɹ#࢖͑Δ৭ͷ֬ೝ 2. ώετάϥϜΛඳ͘
  9. Agenda 1. ͳͥՄࢹԽ͕ඞཁ͔ (5) 2. ώετάϥϜΛඳ͘ (20) 3. ശͻ͛ਤΛඳ͘ (20)

    4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘(15) 5. ԋशʹ͙࣍ԋश (30)
  10. Agenda 1. ͳͥՄࢹԽ͕ඞཁ͔ (5) 2. ώετάϥϜΛඳ͘ (20) 3. ശͻ͛ਤΛඳ͘ (20)

    4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘(15) 5. ԋशʹ͙࣍ԋश (30)
  11. • ਖ਼໊ࣜɿbox-and-whisker plot [Tukey, 1977] • ෳ਺ͷඪຊΛൺֱ͢Δͷʹར༻ • ശͷ௕͔͞Βσʔλͷʮ෯ʯΛൺֱ •

    3ͭҎ্ͷඪຊͰ΋ൺֱ͠΍͍͢ • ͳ͔ͥ͋·Γݟ͔͚ͳ͍... ؾͷ͍ͤʁ 3. ശͻ͛ਤΛඳ͘
  12. • boxplot() ؔ਺Ͱ͋ͬ͞Γ࡞ਤ • usage: boxplot(x, horizontal=TRUE) • horizontal ͸ɼശΛԣʹ͢ΔΦϓγϣϯ

    • boxplot.stats() ؔ਺΋͍ͭͰʹ • ཁ໿౷ܭྔΛग़ͯ͘͠ΕΔ 3. ശͻ͛ਤΛඳ͘
  13. • > boxplot(BNCbiber[, 2], range = 0) # ശͻ͛ਤͷඳը •

    > boxplot.stats(BNCbiber[, 2]) # ཁ໿౷ܭྔͷ֬ೝ • > boxplot(BNCbiber[, 2], range = 0, main = "past tense", col = "grey") # ശͻ͛ਤͷλΠτϧͱ৭Λมߋ • boxplot(BNCbiber[, 2], main = "past tense", col = "grey") # ശͻ͛ਤͷ֎Ε஋Λදࣔ 3. ശͻ͛ਤΛඳ͘
  14. • σʔλΛಡΈࠐΈɼ֬ೝ͠ͳ͕Βɼ2ͭͷശͻ͛ਤΛඳ͘ 1. > pym <- read.csv(file.choose(), header = TRUE,

    row.names = 1) 2. > head(pym, 5) 3. > boxplot(pym[, 2] ~ pym[, 6], names = c("high", "low"), col = "grey")ɹ#άϧʔϓผͷശͻ͛ਤͷඳը 4. > boxplot(pym[, 2] ~ pym[, 6], names = c("high", "low"), col = "grey", notch = TRUE) #ϊονͷ͋Δശͻ͛ਤͷඳը 3. ശͻ͛ਤΛඳ͘
  15. Agenda 1. ͳͥՄࢹԽ͕ඞཁ͔ (5) 2. ώετάϥϜΛඳ͘ (20) 3. ശͻ͛ਤΛඳ͘ (20)

    4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘(15) 5. ԋशʹ͙࣍ԋश (30)
  16. Agenda 1. ͳͥՄࢹԽ͕ඞཁ͔ (5) 2. ώετάϥϜΛඳ͘ (20) 3. ശͻ͛ਤΛඳ͘ (20)

    4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘(15) 5. ԋशʹ͙࣍ԋश (30)
  17. • ശͻ͛ਤͱ๘܈ਤͷॏͶඳ͖ 1. install.packages("beeswarm", dependencies = TRUE) 2. library(beeswarm) 3.

    boxplot(pym[, 2] ~ pym[, 6], names = c("high", "low"), col = "grey") 4. beeswarm(pym[, 2] ~ pym[, 6], col = "black", pch = 16, add = TRUE)ɹ# ശͻ͛ਤͷ্ʹݸʑͷσʔλͷ෼෍Λ ॏͶͯඳը 4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘
  18. • ϰΝΠΦϦϯϓϩοτΛඳ͘ 1. install.packages("vioplot", dependencies = TRUE) 2. library(vioplot) 3.

    vioplot(pym[1 : 50, 2], pym[51 : 101, 2], names = c("high", "low"), col = "grey") #ϰΝΠΦϦϯϓ ϩοτͷඳը 4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘
  19. Agenda 1. ͳͥՄࢹԽ͕ඞཁ͔ (5) 2. ώετάϥϜΛඳ͘ (20) 3. ശͻ͛ਤΛඳ͘ (20)

    4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘(15) 5. ԋशʹ͙࣍ԋश (30)
  20. Agenda 1. ͳͥՄࢹԽ͕ඞཁ͔ (5) 2. ώετάϥϜΛඳ͘ (20) 3. ശͻ͛ਤΛඳ͘ (20)

    4. ๘܈ਤͱϰΝΠΦϦϯϓϩοτΛඳ͘(15) 5. ԋशʹ͙࣍ԋश (30)
  21. 5. ԋशʹ͙࣍ԋश 1. http://sakaue.info ͷ RBC ಛઃαΠτ͔Βຊԋश ༻σʔλΛऔͬͯ͘Δ 2. μ΢ϯϩʔυͨ͠σʔλΛ

    RStudio Server ʹҠಈ 3. ϑΝΠϧͷத਎Λ֬ೝ͠ɼ֤ྻͷฏۉ஋ΛٻΊΔ 4. Pre test ͱ Post testͷώετάϥϜΛඳ͘ 5. Pre test ͱ Post testͷശͻ͛ਤΛඳ͘ 1. X࣠ʹ͸ɼPRE, POST ͱϥϕϧΛ෇͚Δ 2. ശΛԣʹ͢Δ 3. ശΛ৭Λ෇͚Δ 4. y࣠ͷൣғΛ 0͔Β100·ͰʹࢦఆʢάάΔ!ʣ
  22. 5. ԋशʹ͙࣍ԋशʢώϯτʣ 1. http://sakaue.info ͷ RBC ಛઃαΠτ͔Βຊԋश༻ σʔλΛऔͬͯ͘Δ 2. Studio

    Server ͷ Upload ϘλϯΛԡ͠·͠ΐ͏ 3. apply() ؔ਺ͱ mean() ؔ਺Λ߹Θͤͯ࢖͍·͠ΐ͏ 4. ͦΕͧΕͷྻͷσʔλΛผͷม਺ʹೖΕ͔ͯΒɼώ ετάϥϜΛඳؔ͘਺Λ࢖͍·͠ΐ͏ 5. 4Ͱ࢖ͬͨม਺Λ࢖ͬͯശͻ͛ਤΛඳ͖·͠ΐ͏ 1. Ҿ਺ʹ͸ names Λ༻͍·͢ 2. Ҿ਺ʹ͸ horizontal Λ༻͍·͢ 3. Ҿ਺ʹ͸ col Λ༻͍·͢ 4. Ҿ਺ʹ͸ ylim Λ༻͍·͢