User Tools

Site Tools


c:ma:2019:schedule

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
Last revisionBoth sides next revision
c:ma:2019:schedule [2019/10/04 09:02] – [Week05 (Oct 2, 4)] hkimscilc:ma:2019:schedule [2019/12/13 13:21] – [Week16 (June 18, 20)] hkimscil
Line 218: Line 218:
 [[:r:probability]] [[:r:probability]]
 [[:r:General Statistics]] [[:r:General Statistics]]
 +
 +==== t.test: mtcars ====
 +<code>
 +> mdata <- split(mtcars$mpg, mtcars$am)
 +> 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)
 +   values ind
 +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   17.3   0
 +11   15.2   0
 +12   10.4   0
 +13   10.4   0
 +14   14.7   0
 +15   21.5   0
 +16   15.5   0
 +17   15.2   0
 +18   13.3   0
 +19   19.2   0
 +20   21.0   1
 +21   21.0   1
 +22   22.8   1
 +23   32.4   1
 +24   30.4   1
 +25   33.9   1
 +26   27.3   1
 +27   26.0   1
 +28   30.4   1
 +29   15.8   1
 +30   19.7   1
 +31   15.0   1
 +32   21.4   1
 +> 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, data=mtcars)
 +
 + 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:
 + -11.280194  -3.209684
 +sample estimates:
 +mean in group 0 mean in group 1 
 +       17.14737        24.39231 
 +
 +> t.test(mpg~am, data=mtcars, var.equal=T)
 +
 + 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:
 + -10.84837  -3.64151
 +sample estimates:
 +mean in group 0 mean in group 1 
 +       17.14737        24.39231 
 +
 +> 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/m12.df
 +> pv
 +[1] 24.02989
 +> pv/m1.n
 +[1] 1.264731
 +> pv/m2.n
 +[1] 1.848453
 +> m.se <- sqrt((pv/m1.n)+(pv/m2.n))
 +> m.se
 +[1] 1.764422
 +> m1.m <- mean(m1)
 +> m2.m <- mean(m2)
 +> m.tvalue <- (m1.m-m2.m)/m.se
 +> m.tvalue
 +[1] -4.106127
 +</code>
 +
 +<code>
 +> t.test(mpg~am, data=mtcars, var.equal=T)
 +
 + 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:
 + -10.84837  -3.64151
 +sample estimates:
 +mean in group 0 mean in group 1 
 +       17.14737        24.39231 
 +
 +</code>
 +==== anova: mtcars ====
 +<code>
 +stats4each = function(x,y) {
 +   meani <- tapply(x,y,mean)
 +   vari <- tapply(x,y,var)
 +   ni <- tapply(x,y,length)
 +   dfi <- tapply(x,y,length)-1
 +   ssi <- tapply(x,y,var)*(tapply(x,y,length)-1)
 +   out <- rbind(meani,vari,ni,dfi,ssi)
 +   
 +   return(out)  
 +}
 +
 +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, x)
 +stats 
 +
 +sswithin <- sum(stats[5,])
 +sstotal <- var(y)*(length(y)-1)
 +ssbetween <- sstotal-sswithin
 +
 +round(sswithin,2)
 +round(ssbetween,2)
 +round(sstotal,2)
 +
 +dfwithin <- sum(stats[4,])
 +dftotal <- length(y)-1
 +
 +dfwithin
 +dfbetween
 +dftotal
 +
 +mswithin <- sswithin / dfwithin
 +msbetween <- ssbetween / dfbetween
 +mstotal <- sstotal / dftotal
 +
 +round(mswithin,2)
 +round(msbetween,2)
 +round(mstotal,2)
 +
 +fval <- round(msbetween/mswithin,2)
 +fval
 +siglevel <- pf(q=fval, df1=dfbetween, df2=dfwithin, lower.tail=FALSE)
 +siglevel
 +
 +mod <- aov(y~x, data=tempd)
 +summary(mod)
 +
 +</code>
 +
 +==== cor ====
 +<code>
 +attach(mtcars)
 +cor(mpg, hp)
 +
 +mycor <- cov(mpg,hp)/(sd(mpg)*sd(hp))
 +mycor
 +
 +sp <- cov(mpg,hp)*(length(mtcars$hp)-1)
 +ssx <- var(mpg)*(length(mtcars$mpg)-1)
 +ssy <- var(hp)*(length(mtcars$hp)-1)
 +
 +mycor2 <- sp/sqrt(ssx*ssy)
 +mycor2
 +
 +mycor2 == mycor
 +mycor == cor(mpg,hp)
 +mycor2 == cor(mpg,hp)
 +
 +</code>
 +
 +
  
 </WRAP> </WRAP>
Line 227: Line 454:
 <WRAP half column> <WRAP half column>
 ===== ideas and concepts  ===== ===== ideas and concepts  =====
 +[[:correlation]]
 +[[:regression]]
 +[[:multiple regression]]
 +  * [[:r:correlation|correlation in r]]
 +  * [[:r:multiple regression|multiple regression in r]]
 +
 +[[:Partial and semipartial correlation]]
 +[[:using dummy variables]]
 +
 +[[:Statistical Regression Methods]]
 +[[:Sequential Regression]]
 +
 +
 +  
 </WRAP> </WRAP>
 <WRAP half column> <WRAP half column>
 ===== Assignment ===== ===== Assignment =====
 +  - Public opinion in online environments ((refer to {{:public.opinion.theories.introduction.pdf}} ))
 +    * [[:Spiral of Silence]]
 +    * [[:Pluralistic Ignorance]]
 +    * [[:The Third Person Effect]]
 +    * etc. 여론형성과 관련된 사회학적 혹은 사회심리학적 이론을 찾아보고 소개하기, 예로 위의 세가지. 얼마전 사회현상을 어떻게 설명하면 좋을까에 대해서 논의정리하기? 정확한 온라인 환경에서의 여론파악을 위해서 어떤 것이 필요할까?
 +    * 혹은 다른 문제에 대해서 (. . . 조에 따른 . . .)
 +  - Hypotheses
 +    * Multiple regression hypotheses. 
 +    * Google Survey Questions
 + 
 +
 </WRAP> </WRAP>
  
Line 243: 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, mu=100)에서 mu는 무엇을 의미하는가? (o)
 +      * 다음 중 sapply의 아웃풋 모양으로 적당한 것은? 등등 
 +    * [[:The r project for statistical computing]]
 +    * [[:r:Getting started]]
 +    * [[:r:Basics]]
 +    * [[:r:Navigating]]
 +    * [[:r:Input output]]
 +    * [[:r:Data structures]]
 +    * [[:r:Data transformations]]
 +  * Lecture content
 +    * [[:Hypothesis]], 
 +    * [[:Research question]], 
 +    * [[:Research methods lecture note#커뮤니케이션_연구문제_제기와_가설|커뮤니케이션 연구문제 제기와 가설]] 부분만
 +    * [[:Operationalization]],
 +    * [[:Variables]], 
 +    * [[:Types of variables]]
 +    * [[:Hypothesis testing]]
 +    * [[:T-test]]
 +      * 정확한 t test 공식등은 외울 필요가 없습니다. (제공됩니다). 
 +      * 간단한 t test 계산을 요구할 수 있습니다. 
 +      * ANOVA도 마찬가지입니다. 
 +    * [[:ANOVA]]
 +
 </WRAP> </WRAP>
  
Line 248: Line 529:
 <WRAP half column> <WRAP half column>
 ===== ideas and concepts  ===== ===== ideas and concepts  =====
 +[[:correlation]]
 +[[:regression]]
 +[[:multiple regression]]
 +  * [[:r:correlation|correlation in r]]
 +  * [[:r:multiple regression|multiple regression in r]]
 +
 +[[:Partial and semipartial correlation]]
 +[[:using dummy variables]]
 +
 +[[:Statistical Regression Methods]]
 +[[:Sequential Regression]]
 +
 +===== Activity =====
 +[[c/ma/2019/Multiple Regression Exercise]]
 +
 </WRAP> </WRAP>
 <WRAP half column> <WRAP half column>
Line 256: Line 552:
 <WRAP half column> <WRAP half column>
 ===== ideas and concepts  ===== ===== ideas and concepts  =====
 +[[:factor analysis]]
 </WRAP> </WRAP>
 <WRAP half column> <WRAP half column>
Line 275: Line 572:
 <WRAP half column> <WRAP half column>
 ===== Assignment ===== ===== Assignment =====
 +[[factor analysis assignment]]
 +
 </WRAP> </WRAP>
  
Line 280: 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]] 
 +[[:sna_eg_stanford|Stanford University egs.]]
 </WRAP> </WRAP>
 <WRAP half column> <WRAP half column>
 +===== announcement  =====
 +Quiz 2 (on Friday Dec. the 6th) covers:
 +  * [[:correlation]]
 +  * [[:regression]]
 +  * [[: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 =====
 </WRAP> </WRAP>
Line 292: Line 605:
 ====== Week15 (Dec 11, 13) ====== ====== Week15 (Dec 11, 13) ======
 <WRAP half column> <WRAP half column>
-Group Presentation+ 
 +[[./assignment week15]]
 </WRAP> </WRAP>
  
 ====== Week16 (June 18, 20) ====== ====== Week16 (June 18, 20) ======
 <WRAP half column> <WRAP half column>
-__**Final-term**__+__**Final-term**__ covers: 
 +correlation 
 +regression 
 +multiple regression 
 +partial and semipartial correlation 
 +using dummy variables 
 +factor analysis 
 +social network analysis 
 +sna tutorial 
 +[[:r:social network analysis|sna in r]]  
 +[[:sna_eg_stanford:lab06|SNA e.g. lab 06]] 
 + 
 +Some R outputs will be used to ask the related concepts and ideas (the above). 
 </WRAP> </WRAP>
  
c/ma/2019/schedule.txt · Last modified: 2019/12/13 13:23 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki