User Tools

Site Tools


anova_note

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
anova_note [2025/09/18 20:10] – [with more than 3 levels] hkimscilanova_note [2025/09/18 21:05] (current) – [with more than 3 levels] hkimscil
Line 9: Line 9:
 } }
  
-n.o <- 200 +n.o <- 30 
-n.p <- 200 +n.p <- 30 
-o <- rnorm(n.o, 108, 10) +o <- rnorm(n.o, 100, 10) 
-p <- rnorm(n.p, 110, 10)+p <- rnorm(n.p, 105, 10)
 t.test(o,p, var.equal=T) t.test(o,p, var.equal=T)
 comb <- list(o = o, p = p) comb <- list(o = o, p = p)
Line 36: Line 36:
 m.p <- mean(p) m.p <- mean(p)
  
-hist(o, breaks=20+min.x <- min(op$values) 
 +max.x <- max(op$values) 
 +br <- seq(floor(min.x), ceiling(max.x), by = 1)  
 + 
 +hist(o, breaks=br
      col=rgb(1,1,1,.5))      col=rgb(1,1,1,.5))
-abline(v=m.o, col="green", lwd=3) +abline(v=m.o, col="red", lwd=3) 
-hist(p, add=T, breaks=20,+hist(p, add=T, breaks=br,
      col=rgb(.5,1,1,.5))      col=rgb(.5,1,1,.5))
-abline(v=m.p, col="red", lwd=3) +abline(v=m.p, col="blue", lwd=3) 
-abline(v=m.tot, col='blue', lwd=3)+abline(v=m.tot, col='black', lwd=3)
  
 ss.tot <- ss(op$values) ss.tot <- ss(op$values)
Line 82: Line 86:
 f.cal <- ms.bet / ms.wit f.cal <- ms.bet / ms.wit
 f.cal f.cal
-p.f.cal <- pf(f.cal, df1=df.bet, df2=df.wit, lower.tail = F) +p.val <- pf(f.cal, df1=df.bet, df2=df.wit, lower.tail = F) 
-p.f.cal+p.val
 summary(aov(op$values~op$group)) summary(aov(op$values~op$group))
 t.test(o,p, var.equal = T) t.test(o,p, var.equal = T)
Line 96: Line 100:
 t.cal^2 t.cal^2
 f.cal f.cal
 +
 +df.bet
 +df.wit
 +f.cal
 +
  
 </code> </code>
 ====== with more than 3 levels ====== ====== with more than 3 levels ======
- 
 <code> <code>
  
Line 105: Line 113:
 # #
 rm(list=ls()) rm(list=ls())
-# set.seed(101) 
 rnorm2 <- function(n,mean,sd){ mean+sd*scale(rnorm(n)) } rnorm2 <- function(n,mean,sd){ mean+sd*scale(rnorm(n)) }
 ss <- function(x) { ss <- function(x) {
Line 111: Line 118:
 } }
  
-n <- 21+set.seed(11) 
 +n <- 31
 na <- nb <- nc <- nd <- n na <- nb <- nc <- nd <- n
 mean.a <- 98 mean.a <- 98
-mean.b <- 100 +mean.b <- 99 
-mean.c <- 101 +mean.c <- 102 
-mean.d <- 105+mean.d <- 103
  
 A <- rnorm2(na, mean.a, sqrt(900/(na-1))) A <- rnorm2(na, mean.a, sqrt(900/(na-1)))
Line 148: Line 156:
 br <- seq(floor(min.x), ceiling(max.x), by = 1)  br <- seq(floor(min.x), ceiling(max.x), by = 1) 
 # Example bin width of 1 # Example bin width of 1
 +
  
 hist(A, breaks=br, hist(A, breaks=br,
Line 254: Line 263:
  
 # graph 로 이해  # graph 로 이해 
-x <- rf(500000, df1 = df.bet, df2 = df.wit) +x <- rf(50000, df1 = df.bet, df2 = df.wit) 
-y.max <- max(df(x,df1=df.bet, df2=df.wit))+y.max <- max(df(x, df1=df.bet, df2=df.wit))
  
 hist(x, hist(x,
Line 330: Line 339:
 summary(lm.res) summary(lm.res)
 summary(a.res) summary(a.res)
- 
  
 </code> </code>
 +
 +{{:pasted:20250918-210412.png}}
 +{{:pasted:20250918-210425.png}}
 +{{:pasted:20250918-210512.png}}
anova_note.1758193853.txt.gz · Last modified: 2025/09/18 20:10 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki