Download presentation
Presentation is loading. Please wait.
1
R-lab 2 -Dorji Pelzom
2
Basic Statistical Functions
THE MUST KNOW’s Total sum: sum() Mean: mean() Column means: colMeans() Median: median() Variance: var() Covariance matrix: cov() Correlation between two variables: cor() Standard deviation: sd() Maximum: max() Minimum: min() Range: range() Quantile: quantile() Summary: summary() Always refer to the help files if you are not sure about the function by typing ?function name! For example > ?summary
8
To plot OC curve p<-c(0,..............................,0.3)
OC<-phyper(c(...),m=floor(....*p),n=.....-floor(.....*p), k=....,lower.tail=TRUE) plot(p,OC)
10
Lab 3
11
Q1B P<-c(0,. ,0. 4) OC<-phyper(c(. ),m=floor(. p),n=. -floor(
Q1B P<-c(0, ,0.4) OC<-phyper(c(...),m=floor(....*p),n=.....-floor(.....*p), k=....,lower.tail=TRUE) Plot(P,OC) Q 2 A P<-c(0,………………………………,0.4) Pi<-phyper(c(...),m=floor(....*p),n=.....-floor(.....*p), k=....,lower.tail=TRUE) + 1 -phyper(c(...), m=floor(....*p), n=.....-floor(.....*p), k=....,lower.tail=TRUE) Plot(P, Pi) Q2B ASN <- 20*Pi + 40*(1-Pi) Plot(P, ASN)
12
Lab 4
13
For entering data directly
Dataset <- edit(as.data.frame(NULL)) for mac For windows choose Data -> New data set
21
1 (B) For z-values type qnorm()
22
Q 1© P <- c(0.001, 0.005, 0.007, 0.01, 0.02, 0.03, 0.06, 0.09, 0.12, 0.15, 0.18) Z <- qnorm(p, mean = 0, sd = 1, lower.tail = TRUE) OC <- 1 - pnorm(4.472*(Z+2.93), mean = 0, sd = 1, lower.tail = TRUE) plot(p, OC)
26
Good luck with the lab
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.