質問編集履歴

1

コードの修正

2020/06/05 05:45

投稿

sary
sary

スコア12

test CHANGED
File without changes
test CHANGED
@@ -14,6 +14,108 @@
14
14
 
15
15
  ```
16
16
 
17
+ > gayreshaped <- read.csv("gayreshaped.csv")
18
+
19
+ > ccap2012 <- read.csv("ccap2012.csv")
20
+
21
+
22
+
23
+ > dim(gayreshaped)
24
+
25
+ [1] 11948 6
26
+
27
+ > summary(gayreshaped)
28
+
29
+ study treatment therm1
30
+
31
+ Min. :1.000 No Contact :6441 Min. : 0.00
32
+
33
+ 1st Qu.:1.000 Recycling Script by Gay Canvasser :1046 1st Qu.: 48.00
34
+
35
+ Median :1.000 Recycling Script by Straight Canvasser :1039 Median : 52.00
36
+
37
+ Mean :1.204 Same-Sex Marriage Script by Gay Canvasser :2389 Mean : 58.43
38
+
39
+ 3rd Qu.:1.000 Same-Sex Marriage Script by Straight Canvasser:1033 3rd Qu.: 84.00
40
+
41
+ Max. :2.000 Max. :100.00
42
+
43
+
44
+
45
+ therm2 therm3 therm4
46
+
47
+ Min. : 0.00 Min. : 0.00 Min. : 0.00
48
+
49
+ 1st Qu.: 45.00 1st Qu.: 44.00 1st Qu.: 44.00
50
+
51
+ Median : 55.00 Median : 57.00 Median : 58.00
52
+
53
+ Mean : 58.68 Mean : 59.72 Mean : 59.76
54
+
55
+ 3rd Qu.: 84.00 3rd Qu.: 85.00 3rd Qu.: 85.00
56
+
57
+ Max. :100.00 Max. :100.00 Max. :100.00
58
+
59
+ NA's :1351 NA's :9835 NA's :9777
60
+
61
+
62
+
63
+ > dim(ccap2012)
64
+
65
+ [1] 43998 3
66
+
67
+ > summary(ccap2012)
68
+
69
+ X caseid gaytherm
70
+
71
+ Min. : 1 Min. : 1.0 Min. : 0.00
72
+
73
+ 1st Qu.:11000 1st Qu.: 251.0 1st Qu.: 45.00
74
+
75
+ Median :22000 Median : 501.0 Median : 54.00
76
+
77
+ Mean :22000 Mean : 500.5 Mean : 58.71
78
+
79
+ 3rd Qu.:32999 3rd Qu.: 751.0 3rd Qu.: 85.00
80
+
81
+ Max. :43998 Max. :1001.0 Max. :100.00
82
+
83
+ NA's :3097
84
+
85
+
86
+
87
+ > cor(gayreshaped$therm1[gayreshaped$study == 1 & gayreshaped$treatment == "No Contact"],
88
+
89
+ + gayreshaped$therm2[gayreshaped$study == 1 & gayreshaped$treatment == "No Contact"],
90
+
91
+ + use = "complete.obs")
92
+
93
+ [1] 0.9975817
94
+
95
+
96
+
17
- gayreshaped_2 <- gayreshaped[gayreshaped$study == 2 & gayreshaped$treatment == "No Contact",c(3,4,5,6)]
97
+ > gayreshaped_2 <- gayreshaped[gayreshaped$study == 2 & gayreshaped$treatment == "No Contact",c(3,4,5,6)]
98
+
99
+
100
+
101
+
102
+
103
+ > cor(gayreshaped_2,use = "pairwise.complete.obs")
104
+
105
+ therm1 therm2 therm3 therm4
106
+
107
+ therm1 1.0000000 0.9734449 0.9594085 0.9709017
108
+
109
+ therm2 0.9734449 1.0000000 0.9308287 0.9436621
110
+
111
+ therm3 0.9594085 0.9308287 1.0000000 0.9343249
112
+
113
+ therm4 0.9709017 0.9436621 0.9343249 1.0000000
114
+
115
+
116
+
117
+ > min(cor(gayreshaped_2,use = "pairwise.complete.obs"))
118
+
119
+ [1] 0.9308287
18
120
 
19
121
  ```