c:ma:2019:schedule
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
c:ma:2019:schedule [2019/09/27 12:17] – [Week04 (Sep 25, 27)] hkimscil | c:ma:2019:schedule [2019/12/13 13:23] (current) – [Week16 (June 18, 20)] hkimscil | ||
---|---|---|---|
Line 216: | Line 216: | ||
<WRAP half column> | <WRAP half column> | ||
===== ideas and concepts | ===== ideas and concepts | ||
+ | [[: | ||
+ | [[: | ||
+ | |||
+ | ==== t.test: mtcars ==== | ||
+ | < | ||
+ | > mdata <- split(mtcars$mpg, | ||
+ | > mdata | ||
+ | $`0` | ||
+ | [1] 21.4 18.7 18.1 14.3 24.4 22.8 19.2 17.8 16.4 17.3 15.2 10.4 | ||
+ | [13] 10.4 14.7 21.5 15.5 15.2 13.3 19.2 | ||
+ | |||
+ | $`1` | ||
+ | [1] 21.0 21.0 22.8 32.4 30.4 33.9 27.3 26.0 30.4 15.8 19.7 15.0 | ||
+ | [13] 21.4 | ||
+ | |||
+ | > stack(mdata) | ||
+ | | ||
+ | 1 21.4 0 | ||
+ | 2 18.7 0 | ||
+ | 3 18.1 0 | ||
+ | 4 14.3 0 | ||
+ | 5 24.4 0 | ||
+ | 6 22.8 0 | ||
+ | 7 19.2 0 | ||
+ | 8 17.8 0 | ||
+ | 9 16.4 0 | ||
+ | 10 | ||
+ | 11 | ||
+ | 12 | ||
+ | 13 | ||
+ | 14 | ||
+ | 15 | ||
+ | 16 | ||
+ | 17 | ||
+ | 18 | ||
+ | 19 | ||
+ | 20 | ||
+ | 21 | ||
+ | 22 | ||
+ | 23 | ||
+ | 24 | ||
+ | 25 | ||
+ | 26 | ||
+ | 27 | ||
+ | 28 | ||
+ | 29 | ||
+ | 30 | ||
+ | 31 | ||
+ | 32 | ||
+ | > mdata | ||
+ | $`0` | ||
+ | [1] 21.4 18.7 18.1 14.3 24.4 22.8 19.2 17.8 16.4 17.3 15.2 10.4 | ||
+ | [13] 10.4 14.7 21.5 15.5 15.2 13.3 19.2 | ||
+ | |||
+ | $`1` | ||
+ | [1] 21.0 21.0 22.8 32.4 30.4 33.9 27.3 26.0 30.4 15.8 19.7 15.0 | ||
+ | [13] 21.4 | ||
+ | |||
+ | > t.test(mpg~am, | ||
+ | |||
+ | Welch Two Sample t-test | ||
+ | |||
+ | data: mpg by am | ||
+ | t = -3.7671, df = 18.332, p-value = 0.001374 | ||
+ | alternative hypothesis: true difference in means is not equal to 0 | ||
+ | 95 percent confidence interval: | ||
+ | | ||
+ | sample estimates: | ||
+ | mean in group 0 mean in group 1 | ||
+ | | ||
+ | |||
+ | > t.test(mpg~am, | ||
+ | |||
+ | Two Sample t-test | ||
+ | |||
+ | data: mpg by am | ||
+ | t = -4.1061, df = 30, p-value = 0.000285 | ||
+ | alternative hypothesis: true difference in means is not equal to 0 | ||
+ | 95 percent confidence interval: | ||
+ | | ||
+ | sample estimates: | ||
+ | mean in group 0 mean in group 1 | ||
+ | | ||
+ | |||
+ | > m1 <- mdata[[1]] | ||
+ | > m2 <- mdata[[2]] | ||
+ | > m1 | ||
+ | [1] 21.4 18.7 18.1 14.3 24.4 22.8 19.2 17.8 16.4 17.3 15.2 10.4 | ||
+ | [13] 10.4 14.7 21.5 15.5 15.2 13.3 19.2 | ||
+ | > m2 | ||
+ | [1] 21.0 21.0 22.8 32.4 30.4 33.9 27.3 26.0 30.4 15.8 19.7 15.0 | ||
+ | [13] 21.4 | ||
+ | > m1.var <- var(m1) | ||
+ | > m2.var <- var(m2) | ||
+ | > m1.n <- length(m1) | ||
+ | > m2.n <- length(m2) | ||
+ | > m1.df <- length(m1)-1 | ||
+ | > m2.df <- length(m2)-1 | ||
+ | > m1.ss <- m1.var*m1.df | ||
+ | > m2.ss <- m2.var*m2.df | ||
+ | > m1.ss | ||
+ | [1] 264.5874 | ||
+ | > m2.ss | ||
+ | [1] 456.3092 | ||
+ | > m12.ss <- m1.ss+m2.ss | ||
+ | > m12.ss | ||
+ | [1] 720.8966 | ||
+ | > m12.df <- m1.df+m2.df | ||
+ | > pv <- m12.ss/ | ||
+ | > pv | ||
+ | [1] 24.02989 | ||
+ | > pv/m1.n | ||
+ | [1] 1.264731 | ||
+ | > pv/m2.n | ||
+ | [1] 1.848453 | ||
+ | > m.se <- sqrt((pv/ | ||
+ | > m.se | ||
+ | [1] 1.764422 | ||
+ | > m1.m <- mean(m1) | ||
+ | > m2.m <- mean(m2) | ||
+ | > m.tvalue <- (m1.m-m2.m)/ | ||
+ | > m.tvalue | ||
+ | [1] -4.106127 | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | > t.test(mpg~am, | ||
+ | |||
+ | Two Sample t-test | ||
+ | |||
+ | data: mpg by am | ||
+ | t = -4.1061, df = 30, p-value = 0.000285 | ||
+ | alternative hypothesis: true difference in means is not equal to 0 | ||
+ | 95 percent confidence interval: | ||
+ | | ||
+ | sample estimates: | ||
+ | mean in group 0 mean in group 1 | ||
+ | | ||
+ | |||
+ | </ | ||
+ | ==== anova: mtcars ==== | ||
+ | < | ||
+ | stats4each = function(x, | ||
+ | meani <- tapply(x, | ||
+ | vari <- tapply(x, | ||
+ | ni <- tapply(x, | ||
+ | dfi <- tapply(x, | ||
+ | ssi <- tapply(x, | ||
+ | out <- rbind(meani, | ||
+ | |||
+ | | ||
+ | } | ||
+ | |||
+ | library(MASS) | ||
+ | |||
+ | tempd <- iris | ||
+ | x <- tempd$Species | ||
+ | y <- tempd$Sepal.Width | ||
+ | |||
+ | tempd <- mtcars | ||
+ | x <- tempd$gear | ||
+ | y <- tempd$mpg | ||
+ | |||
+ | tempd <- mtcars | ||
+ | x <- tempd$am | ||
+ | y <- tempd$mpg | ||
+ | |||
+ | |||
+ | x <- factor(x) | ||
+ | dfbetween <- nlevels(x)-1 | ||
+ | |||
+ | stats <- stats4each(y, | ||
+ | stats | ||
+ | |||
+ | sswithin <- sum(stats[5, | ||
+ | sstotal <- var(y)*(length(y)-1) | ||
+ | ssbetween <- sstotal-sswithin | ||
+ | |||
+ | round(sswithin, | ||
+ | round(ssbetween, | ||
+ | round(sstotal, | ||
+ | |||
+ | dfwithin <- sum(stats[4, | ||
+ | dftotal <- length(y)-1 | ||
+ | |||
+ | dfwithin | ||
+ | dfbetween | ||
+ | dftotal | ||
+ | |||
+ | mswithin <- sswithin / dfwithin | ||
+ | msbetween <- ssbetween / dfbetween | ||
+ | mstotal <- sstotal / dftotal | ||
+ | |||
+ | round(mswithin, | ||
+ | round(msbetween, | ||
+ | round(mstotal, | ||
+ | |||
+ | fval <- round(msbetween/ | ||
+ | fval | ||
+ | siglevel <- pf(q=fval, df1=dfbetween, | ||
+ | siglevel | ||
+ | |||
+ | mod <- aov(y~x, data=tempd) | ||
+ | summary(mod) | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== cor ==== | ||
+ | < | ||
+ | attach(mtcars) | ||
+ | cor(mpg, hp) | ||
+ | |||
+ | mycor <- cov(mpg, | ||
+ | mycor | ||
+ | |||
+ | sp <- cov(mpg, | ||
+ | ssx <- var(mpg)*(length(mtcars$mpg)-1) | ||
+ | ssy <- var(hp)*(length(mtcars$hp)-1) | ||
+ | |||
+ | mycor2 <- sp/ | ||
+ | mycor2 | ||
+ | |||
+ | mycor2 == mycor | ||
+ | mycor == cor(mpg,hp) | ||
+ | mycor2 == cor(mpg,hp) | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
</ | </ | ||
<WRAP half column> | <WRAP half column> | ||
Line 224: | Line 454: | ||
<WRAP half column> | <WRAP half column> | ||
===== ideas and concepts | ===== ideas and concepts | ||
+ | [[: | ||
+ | [[: | ||
+ | [[:multiple regression]] | ||
+ | * [[: | ||
+ | * [[: | ||
+ | |||
+ | [[:Partial and semipartial correlation]] | ||
+ | [[:using dummy variables]] | ||
+ | |||
+ | [[: | ||
+ | [[: | ||
+ | |||
+ | |||
+ | | ||
</ | </ | ||
<WRAP half column> | <WRAP half column> | ||
===== Assignment ===== | ===== Assignment ===== | ||
+ | - Public opinion in online environments ((refer to {{: | ||
+ | * [[:Spiral of Silence]] | ||
+ | * [[: | ||
+ | * [[:The Third Person Effect]] | ||
+ | * etc. 여론형성과 관련된 사회학적 혹은 사회심리학적 이론을 찾아보고 소개하기, | ||
+ | * 혹은 다른 문제에 대해서 (. . . 조에 따른 . . .) | ||
+ | - Hypotheses | ||
+ | * Multiple regression hypotheses. | ||
+ | * Google Survey Questions | ||
+ | |||
+ | |||
</ | </ | ||
Line 240: | Line 495: | ||
<WRAP half column> | <WRAP half column> | ||
__**Mid-term period**__ | __**Mid-term period**__ | ||
+ | |||
+ | ===== Quiz the first one ===== | ||
+ | * Lecture materials + textbook | ||
+ | * Textbook: r cookbook: textbook과 관련해서는 예상되는 아웃풋, 아웃풋을 얻기위한 명령어, 명령어(function)에 사용되는 옵션이 의미하는 것 등에 대한 사지선다 혹은 단답식 질문이 나옵니다. 펑션의 옵션사용 등과 같은 정확한 것에 대해서는 질문이 나오지 않습니다. | ||
+ | * 예 | ||
+ | * one sample t-test를 하기 위한 명령어를 쓰시오 (x) | ||
+ | * t.test(sample, | ||
+ | * 다음 중 sapply의 아웃풋 모양으로 적당한 것은? 등등 | ||
+ | * [[:The r project for statistical computing]] | ||
+ | * [[: | ||
+ | * [[: | ||
+ | * [[: | ||
+ | * [[:r:Input output]] | ||
+ | * [[:r:Data structures]] | ||
+ | * [[:r:Data transformations]] | ||
+ | * Lecture content | ||
+ | * [[: | ||
+ | * [[:Research question]], | ||
+ | * [[:Research methods lecture note# | ||
+ | * [[: | ||
+ | * [[: | ||
+ | * [[:Types of variables]] | ||
+ | * [[: | ||
+ | * [[:T-test]] | ||
+ | * 정확한 t test 공식등은 외울 필요가 없습니다. (제공됩니다). | ||
+ | * 간단한 t test 계산을 요구할 수 있습니다. | ||
+ | * ANOVA도 마찬가지입니다. | ||
+ | * [[:ANOVA]] | ||
+ | |||
</ | </ | ||
Line 245: | Line 529: | ||
<WRAP half column> | <WRAP half column> | ||
===== ideas and concepts | ===== ideas and concepts | ||
+ | [[: | ||
+ | [[: | ||
+ | [[:multiple regression]] | ||
+ | * [[: | ||
+ | * [[: | ||
+ | |||
+ | [[:Partial and semipartial correlation]] | ||
+ | [[:using dummy variables]] | ||
+ | |||
+ | [[: | ||
+ | [[: | ||
+ | |||
+ | ===== Activity ===== | ||
+ | [[c/ | ||
+ | |||
</ | </ | ||
<WRAP half column> | <WRAP half column> | ||
Line 253: | Line 552: | ||
<WRAP half column> | <WRAP half column> | ||
===== ideas and concepts | ===== ideas and concepts | ||
+ | [[:factor analysis]] | ||
</ | </ | ||
<WRAP half column> | <WRAP half column> | ||
Line 272: | Line 572: | ||
<WRAP half column> | <WRAP half column> | ||
===== Assignment ===== | ===== Assignment ===== | ||
+ | [[factor analysis assignment]] | ||
+ | |||
</ | </ | ||
Line 277: | Line 579: | ||
<WRAP half column> | <WRAP half column> | ||
===== ideas and concepts | ===== ideas and concepts | ||
+ | [[:social network analysis]] | ||
+ | [[:r:social network analysis tutorial]] | ||
+ | [[:r:social network analysis|sna in r]] | ||
+ | [[: | ||
</ | </ | ||
<WRAP half column> | <WRAP half column> | ||
+ | ===== announcement | ||
+ | Quiz 2 (on Friday Dec. the 6th) covers: | ||
+ | * [[: | ||
+ | * [[: | ||
+ | * [[:multiple regression]] | ||
+ | * [[:partial and semipartial correlation]] | ||
+ | * [[:using dummy variables]] | ||
+ | * [[:factor analysis]] | ||
+ | Some R outputs will be used to ask the related concepts and ideas (the above). | ||
+ | |||
===== Assignment ===== | ===== Assignment ===== | ||
</ | </ | ||
Line 289: | Line 605: | ||
====== Week15 (Dec 11, 13) ====== | ====== Week15 (Dec 11, 13) ====== | ||
<WRAP half column> | <WRAP half column> | ||
- | Group Presentation | + | |
+ | [[./ | ||
</ | </ | ||
====== Week16 (June 18, 20) ====== | ====== Week16 (June 18, 20) ====== | ||
<WRAP half column> | <WRAP half column> | ||
- | __**Final-term**__ | + | __**Final-term**__ |
+ | correlation | ||
+ | regression | ||
+ | multiple regression | ||
+ | partial and semipartial correlation | ||
+ | using dummy variables | ||
+ | factor analysis | ||
+ | [[:social network analysis]] | ||
+ | [[:r:social network analysis tutorial|sna tutorial]] | ||
+ | [[:r:social network analysis|sna in r]] | ||
+ | [[: | ||
+ | |||
+ | Some R outputs will be used to ask the related concepts and ideas (the above). | ||
</ | </ | ||
c/ma/2019/schedule.txt · Last modified: 2019/12/13 13:23 by hkimscil