Use Sekhar’s method to create award and category matrices
## Warning: package 'dplyr' was built under R version 3.1.3
##
## Attaching package: 'dplyr'
##
## The following object is masked from 'package:stats':
##
## filter
##
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## Warning: package 'tidyr' was built under R version 3.1.3
## movie_id year category_id won
## 1 1 2010 1 0
## 2 2 2010 1 0
## 3 2 2010 4 0
## 4 2 2010 6 0
## 5 2 2010 7 0
## 6 2 2010 8 0
## Source: local data frame [6 x 25]
##
## movie_id year 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
## 1 1 2010 0 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 2 2 2010 0 NA NA 0 NA 0 0 0 0 NA NA NA NA NA NA 0 NA NA 0
## 3 3 2010 0 NA NA NA NA NA 0 NA 0 NA NA 1 NA 1 NA 0 NA NA 0
## 4 4 2010 1 0 NA 0 NA 0 0 0 1 NA NA 0 NA 0 NA 1 NA NA 0
## 5 5 2010 0 NA NA NA NA NA NA NA NA NA NA 0 NA 0 0 0 NA NA NA
## 6 6 2010 NA 1 NA 1 NA NA NA NA 0 NA NA 0 NA NA NA 0 NA NA NA
## Variables not shown: 20 (int), 21 (int), 22 (int), 23 (int)
Correlation Matrix
Modify awards matrix to set NA = 0
awards_mod <- awards_re_modified #create new var to preserve original
awards_mod[is.na(awards_mod)] <- 0 #set NA = 0
Correlation matrix, display circles
library(corrplot)
## Warning: package 'corrplot' was built under R version 3.1.3
W <- cor(awards_mod[3:25]) #correlate c1:c23
corrplot(W, method = "circle")
Correlation matrix, display numbers
corrplot(W, method = "number")
Correlation matrix, display squares
corrplot(W, method = "square")
***Correlation matrix, using ggplot2
library(ggplot2)
library(reshape2)
## Warning: package 'reshape2' was built under R version 3.1.3
qplot(x=Var1, y=Var2, data=melt(cor(awards_mod[3:25])), fill=value, geom="tile")
***Correlatio matrix, numerical results
x <- awards_mod[3:25]
y <- awards_mod[3:25]
cor(x, y)
## c1 c2 c3 c4 c5
## c1 1.000000000 0.031442183 0.0637557625 0.069755123 -0.007796584
## c2 0.031442183 1.000000000 0.0447025037 0.090204750 -0.007314613
## c3 0.063755763 0.044702504 1.0000000000 0.108928458 -0.007749632
## c4 0.069755123 0.090204750 0.1089284579 1.000000000 -0.007314613
## c5 -0.007796584 -0.007314613 -0.0077496318 -0.007314613 1.000000000
## c6 0.072506810 0.080054937 0.0839561720 0.125503007 -0.008813338
## c7 0.058936153 0.087843420 0.0595665577 0.132112232 -0.009061580
## c8 0.078686034 0.033580145 0.0420486161 0.073047923 -0.007559144
## c9 0.267328311 0.197464921 0.0879173749 0.120839042 -0.007796584
## c10 -0.018964075 -0.017791749 -0.0188498701 -0.017791749 -0.007062251
## c11 -0.018825820 -0.017662041 -0.0187124480 -0.017662041 -0.007010764
## c12 0.131378762 0.101967154 0.0182542530 0.101967154 -0.007413321
## c13 0.007197662 0.009224239 0.0272607454 -0.011783712 -0.004677423
## c14 0.074022300 0.039563592 0.0347082404 0.028980108 0.016754610
## c15 0.030521724 0.021538257 0.0055738644 -0.018676191 0.025842324
## c16 0.295265477 0.174406734 0.1138887590 0.135644487 -0.007702417
## c17 -0.020168626 -0.018921837 -0.0200471669 -0.018921837 -0.007510827
## c18 -0.023553485 -0.022097450 -0.0234116423 -0.022097450 -0.008771354
## c19 0.091877626 0.113451180 -0.0075252400 0.060501973 -0.007510827
## c20 -0.013917970 0.005933184 -0.0138341537 -0.013057585 0.041930610
## c21 0.016160545 0.002224411 0.0004362834 -0.014693358 -0.005832377
## c22 0.272537746 0.141419198 0.1728635223 0.132467112 -0.011380431
## c23 -0.004497010 -0.004219012 -0.0044699280 -0.004219012 -0.001674693
## c6 c7 c8 c9 c10
## c1 0.072506810 0.05893615 0.078686034 0.267328311 -0.018964075
## c2 0.080054937 0.08784342 0.033580145 0.197464921 -0.017791749
## c3 0.083956172 0.05956656 0.042048616 0.087917375 -0.018849870
## c4 0.125503007 0.13211223 0.073047923 0.120839042 -0.017791749
## c5 -0.008813338 -0.00906158 -0.007559144 -0.007796584 -0.007062251
## c6 1.000000000 0.37068628 0.417374104 0.222109306 -0.021437183
## c7 0.370686282 1.00000000 0.223022531 0.256699968 -0.022040997
## c8 0.417374104 0.22302253 1.000000000 0.152924338 -0.018386537
## c9 0.222109306 0.25669997 0.152924338 1.000000000 -0.018964075
## c10 -0.021437183 -0.02204100 -0.018386537 -0.018964075 1.000000000
## c11 -0.021280899 -0.02188031 -0.018252492 -0.018825820 -0.017052681
## c12 0.257903256 0.28276926 0.162519375 0.408735615 -0.018031842
## c13 0.073692036 0.03676774 0.069235822 0.046713306 -0.011377161
## c14 0.236824382 0.19461560 0.200844175 0.213373931 -0.023111450
## c15 0.022362133 0.04241460 0.032648003 0.043128854 -0.004165055
## c16 0.268522271 0.23922825 0.217791704 0.720580863 -0.018735026
## c17 -0.022798820 -0.02344099 -0.019554404 -0.020168626 -0.018269012
## c18 -0.026625099 -0.02737504 -0.022836180 -0.023553485 -0.021335064
## c19 0.209798842 0.18154401 0.147168546 0.253722211 -0.018269012
## c20 0.016047368 0.07669114 0.023303969 0.057524736 -0.012607084
## c21 0.095541216 0.05073911 0.066768589 0.032071581 -0.014186421
## c22 0.152717654 0.13958953 0.126487780 0.407247664 -0.027681270
## c23 -0.005083466 -0.00522665 -0.004360056 -0.004497010 -0.004073452
## c11 c12 c13 c14 c15
## c1 -0.018825820 0.131378762 0.007197662 0.07402230 0.030521724
## c2 -0.017662041 0.101967154 0.009224239 0.03956359 0.021538257
## c3 -0.018712448 0.018254253 0.027260745 0.03470824 0.005573864
## c4 -0.017662041 0.101967154 -0.011783712 0.02898011 -0.018676191
## c5 -0.007010764 -0.007413321 -0.004677423 0.01675461 0.025842324
## c6 -0.021280899 0.257903256 0.073692036 0.23682438 0.022362133
## c7 -0.021880311 0.282769264 0.036767744 0.19461560 0.042414599
## c8 -0.018252492 0.162519375 0.069235822 0.20084417 0.032648003
## c9 -0.018825820 0.408735615 0.046713306 0.21337393 0.043128854
## c10 -0.017052681 -0.018031842 -0.011377161 -0.02311145 -0.004165055
## c11 1.000000000 -0.017900384 -0.011294218 -0.02294296 -0.017900384
## c12 -0.017900384 1.000000000 0.008795693 0.25782754 0.073701618
## c13 -0.011294218 0.008795693 1.000000000 0.03381370 0.029534115
## c14 -0.022942959 0.257827544 0.033813704 1.00000000 0.174245949
## c15 -0.017900384 0.073701618 0.029534115 0.17424595 1.000000000
## c16 -0.018598441 0.401247896 0.067549655 0.21648362 0.044108527
## c17 -0.018135825 -0.019177180 -0.012099810 -0.02457943 -0.019177180
## c18 -0.009288812 -0.022395647 -0.014130497 -0.02870455 -0.022395647
## c19 -0.018135825 0.372846880 0.049337977 0.23334904 0.020025226
## c20 -0.012515174 0.155490284 0.079791297 0.02744237 0.005513327
## c21 -0.014082997 0.118714091 0.095297214 0.06002750 0.068611942
## c22 -0.027479464 0.218385155 0.023215303 0.13718831 0.015128829
## c23 -0.004043755 -0.004275947 -0.002697901 -0.00548049 -0.004275947
## c16 c17 c18 c19 c20
## c1 0.295265477 -0.020168626 -0.023553485 0.091877626 -0.013917970
## c2 0.174406734 -0.018921837 -0.022097450 0.113451180 0.005933184
## c3 0.113888759 -0.020047167 -0.023411642 -0.007525240 -0.013834154
## c4 0.135644487 -0.018921837 -0.022097450 0.060501973 -0.013057585
## c5 -0.007702417 -0.007510827 -0.008771354 -0.007510827 0.041930610
## c6 0.268522271 -0.022798820 -0.026625099 0.209798842 0.016047368
## c7 0.239228246 -0.023440987 -0.027375040 0.181544012 0.076691137
## c8 0.217791704 -0.019554404 -0.022836180 0.147168546 0.023303969
## c9 0.720580863 -0.020168626 -0.023553485 0.253722211 0.057524736
## c10 -0.018735026 -0.018269012 -0.021335064 -0.018269012 -0.012607084
## c11 -0.018598441 -0.018135825 -0.009288812 -0.018135825 -0.012515174
## c12 0.401247896 -0.019177180 -0.022395647 0.372846880 0.155490284
## c13 0.067549655 -0.012099810 -0.014130497 0.049337977 0.079791297
## c14 0.216483617 -0.024579432 -0.028704548 0.233349036 0.027442375
## c15 0.044108527 -0.019177180 -0.022395647 0.020025226 0.005513327
## c16 1.000000000 -0.019925028 -0.023269005 0.269773396 0.040460535
## c17 -0.019925028 1.000000000 -0.022690214 -0.019429415 -0.013407855
## c18 -0.023269005 -0.022690214 1.000000000 -0.022690214 -0.015658068
## c19 0.269773396 -0.019429415 -0.022690214 1.000000000 0.245771967
## c20 0.040460535 -0.013407855 -0.015658068 0.245771967 1.000000000
## c21 0.048918152 -0.015087507 -0.017619613 0.199308678 0.273509746
## c22 0.429787279 -0.029439516 -0.034380290 0.110189225 -0.007795813
## c23 -0.004442695 -0.004332187 -0.005059250 -0.004332187 -0.002989557
## c21 c22 c23
## c1 0.0161605455 0.2725377457 -0.004497010
## c2 0.0022244112 0.1414191978 -0.004219012
## c3 0.0004362834 0.1728635223 -0.004469928
## c4 -0.0146933581 0.1324671121 -0.004219012
## c5 -0.0058323766 -0.0113804313 -0.001674693
## c6 0.0955412164 0.1527176545 -0.005083466
## c7 0.0507391100 0.1395895318 -0.005226650
## c8 0.0667685886 0.1264877804 -0.004360056
## c9 0.0320715813 0.4072476641 -0.004497010
## c10 -0.0141864212 -0.0276812702 -0.004073452
## c11 -0.0140829972 -0.0274794641 -0.004043755
## c12 0.1187140907 0.2183851548 -0.004275947
## c13 0.0952972142 0.0232153029 -0.002697901
## c14 0.0600275014 0.1371883115 -0.005480490
## c15 0.0686119417 0.0151288288 -0.004275947
## c16 0.0489181524 0.4297872785 -0.004442695
## c17 -0.0150875074 -0.0294395156 -0.004332187
## c18 -0.0176196131 -0.0343802898 -0.005059250
## c19 0.1993086779 0.1101892247 -0.004332187
## c20 0.2735097458 -0.0077958126 -0.002989557
## c21 1.0000000000 -0.0005542952 -0.003364070
## c22 -0.0005542952 1.0000000000 -0.006564145
## c23 -0.0033640699 -0.0065641452 1.000000000