前提・実現したいこと
https://note.com/marginal_ard30/n/nccfa34a503bd?magazine_key=m7af29eded997
このサイトの (2)【研究2】コントロールグループの全回答の相関係数 の部分のc(3,4,5,6)はどういった役割なのか教えて下さい
> gayreshaped <- read.csv("gayreshaped.csv") > ccap2012 <- read.csv("ccap2012.csv") > dim(gayreshaped) [1] 11948 6 > summary(gayreshaped) study treatment therm1 Min. :1.000 No Contact :6441 Min. : 0.00 1st Qu.:1.000 Recycling Script by Gay Canvasser :1046 1st Qu.: 48.00 Median :1.000 Recycling Script by Straight Canvasser :1039 Median : 52.00 Mean :1.204 Same-Sex Marriage Script by Gay Canvasser :2389 Mean : 58.43 3rd Qu.:1.000 Same-Sex Marriage Script by Straight Canvasser:1033 3rd Qu.: 84.00 Max. :2.000 Max. :100.00 therm2 therm3 therm4 Min. : 0.00 Min. : 0.00 Min. : 0.00 1st Qu.: 45.00 1st Qu.: 44.00 1st Qu.: 44.00 Median : 55.00 Median : 57.00 Median : 58.00 Mean : 58.68 Mean : 59.72 Mean : 59.76 3rd Qu.: 84.00 3rd Qu.: 85.00 3rd Qu.: 85.00 Max. :100.00 Max. :100.00 Max. :100.00 NA's :1351 NA's :9835 NA's :9777 > dim(ccap2012) [1] 43998 3 > summary(ccap2012) X caseid gaytherm Min. : 1 Min. : 1.0 Min. : 0.00 1st Qu.:11000 1st Qu.: 251.0 1st Qu.: 45.00 Median :22000 Median : 501.0 Median : 54.00 Mean :22000 Mean : 500.5 Mean : 58.71 3rd Qu.:32999 3rd Qu.: 751.0 3rd Qu.: 85.00 Max. :43998 Max. :1001.0 Max. :100.00 NA's :3097 > cor(gayreshaped$therm1[gayreshaped$study == 1 & gayreshaped$treatment == "No Contact"], + gayreshaped$therm2[gayreshaped$study == 1 & gayreshaped$treatment == "No Contact"], + use = "complete.obs") [1] 0.9975817 > gayreshaped_2 <- gayreshaped[gayreshaped$study == 2 & gayreshaped$treatment == "No Contact",c(3,4,5,6)] > cor(gayreshaped_2,use = "pairwise.complete.obs") therm1 therm2 therm3 therm4 therm1 1.0000000 0.9734449 0.9594085 0.9709017 therm2 0.9734449 1.0000000 0.9308287 0.9436621 therm3 0.9594085 0.9308287 1.0000000 0.9343249 therm4 0.9709017 0.9436621 0.9343249 1.0000000 > min(cor(gayreshaped_2,use = "pairwise.complete.obs")) [1] 0.9308287
これだけではなんともいえません。
コードをすべて提示しましょう
回答1件
あなたの回答
tips
プレビュー