Presentation is loading. Please wait.

Presentation is loading. Please wait.

R-lab 2 -Dorji Pelzom.

Similar presentations


Presentation on theme: "R-lab 2 -Dorji Pelzom."— Presentation transcript:

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

3

4

5

6

7

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)

9

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

14

15

16

17

18

19

20

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)

23

24

25

26 Good luck with the lab


Download ppt "R-lab 2 -Dorji Pelzom."

Similar presentations


Ads by Google