-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShruti Gupta - Inferential Statistic Part 2 - Week 8.R
57 lines (37 loc) · 1.4 KB
/
Shruti Gupta - Inferential Statistic Part 2 - Week 8.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#Assignment Week: 7
#Date: 23/06/2019
#Author: Shruti Gupta
library('xlsx')
#set working directory
setwd ("C:\\Users\\HP\\Documents\\Courses\\digitalvidya\\datascienceusingr\\class\\week8\\Assignment")
#retrieve the working directory name
getwd()
win_loss<- read.xlsx('Win-Loss.xlsx', as.data.frame=TRUE, header = TRUE, sheetName='Win - Loss')
female_data<- read.xlsx('Female Heights and Weights.xlsx', as.data.frame=TRUE, header = TRUE, sheetName='women')
prices<- read.xlsx('Prices in Rupees.xlsx', as.data.frame=TRUE, header = TRUE, sheetName='Win - Loss')
ks_testing<- read.xlsx('Two Sample KS Test.xlsx', as.data.frame=TRUE, header = TRUE, sheetName='Sheet1')
#q1
library('PASWR')
female_data
#1
SIGN.test(female_data$Height,md=64)
#2
SIGN.test(female_data$Weight,md=135)
#q2
win_loss
SIGN.test(win_loss$Outcome.2,win_loss$Outcome.1)
#q3
prices
wilcox.test(prices$City.A..prices.in.rupees.,prices$City.B..prices.in.rupees.,paired = TRUE)
#q4
ks_testing
ks.test(ks_testing$Sample.1,ks_testing$Sample.2)
#q5
M <- as.table(rbind(c(8000, 800, 7200), c(1600, 120, 1480)))
dimnames(M) <- list(div = c("p1", "p2"),
party = c("Total","Female", "Male"))
(Xsq <- chisq.test(M)) # Prints test summary
Xsq$observed # observed counts (same as M)
Xsq$expected # expected counts under the null
Xsq$residuals # Pearson residuals
Xsq$stdres