Activity3solutions__1_.docx

# Activity3solutions__1_.docx - SOLUTIONS Activity 3...

• Homework Help
• 15

This preview shows pages 1–4. Sign up to view the full content.

SOLUTIONS - Activity 3 Associations pt 2 Feb 3/4 2016 Question 1: Load up SURVEY10 using data(SURVEY10) . Making student profiles is valuable from a marketing perspective so that advertisments can be targeted to the right set of people. To make a profile, associations must be analyzed. a Run cor.matrix on the first 7 columns of the data frame to obtain a correlation matrix (there are so many variables doing cor.matrix on the entirety of the data frame results in too many values to look at). data (SURVEY10) cor_matrix (SURVEY10[ , 1 : 7 ]) ## Height Weight DesiredWeight GPA TxtPerDay MinPerDayFaceBook ## Height 1.000 0.601 0.774 -0.138 -0.085 -0.082 ## Weight 0.601 1.000 0.871 -0.215 -0.030 0.022 ## DesiredWeight 0.774 0.871 1.000 -0.212 -0.073 -0.064 ## GPA -0.138 -0.215 -0.212 1.000 0.072 -0.027 ## TxtPerDay -0.085 -0.030 -0.073 0.072 1.000 0.109 ## MinPerDayFaceBook -0.082 0.022 -0.064 -0.027 0.109 1.000 b Now run all.correlations on the entirety of the dataframe to get the pairwise correlations between every quantitative variable. Add the argument sorted="strength" to have this list sorted by strength (from most negative to most positive). What pair of quantities has the strongest positive, strongest negative, and strongest overall relationship? all_correlations (SURVEY10, sorted= "strength" ) ## var1 var2 correlation pval ## 1 DesiredWeight NumBodyPiercings -0.588011431 3.123079e-66 ## 2 Height NumBodyPiercings -0.581874637 1.415521e-64 ## 3 Weight NumBodyPiercings -0.440424465 1.571993e- 34 ## 4 NumBodyPiercings PercMoreAthleticThan -0.264786905 1.115451e-12

This preview has intentionally blurred sections. Sign up to view the full version.

## 5 NumBodyPiercings WeeklyHrsVideoGame -0.257427414 4.824701e-12 ## 6 NumBodyPiercings PercFunnierThan -0.246268218 4.076588e-11 ## 7 NumBodyPiercings PercMoreAttractiveThan -0.223745463 2.218836e-09 ## 8 Weight GPA -0.214698664 9.857550e-09 ## 9 DesiredWeight GPA -0.212174164 1.477443e-08 ## 10 NumBodyPiercings PercMoreIntelligentThan -0.201370289 7.894653e-08 ## 11 GPA PercentDateable -0.140393901 1.963759e-04 ## 12 Height GPA -0.137646918 2.621714e-04 ## 13 TxtPerDay PercMoreIntelligentThan -0.136561419 2.934565e-04 ## 14 Height NumTattoos -0.110066194 3.572351e-03 ## 15 NumBodyPiercings PercentDateable -0.096963721 1.031627e-02 ## 16 TxtPerDay PercFunnierThan -0.089300927 1.820185e- 02 ## 17 Height TxtPerDay -0.084561819 2.537136e-02 ## 18 Height MinPerDayFaceBook -0.082193276 2.979055e- 02 ## 19 GPA OwnAttractiveness -0.080982150 3.229498e-02 ## 20 MinPerDayFaceBook PercMoreIntelligentThan -0.078829486 3.719155e-02 ## 21 NumBodyPiercings OwnAttractiveness -0.077846977 3.962803e-02 ## 22 DesiredWeight TxtPerDay -0.072822623 5.429963e- 02 ## 23 GPA NumTattoos -0.070025086 6.426685e-02 ## 24 DesiredWeight MinPerDayFaceBook -0.064472414 8.851521e-02 ## 25 GPA WeeklyHrsVideoGame -0.064185847 8.994345e- 02 ## 26 GPA PercFunnierThan -0.063677498 9.252254e-02 ## 27 MinPerDayFaceBook PercMoreAthleticThan -0.062591100 9.823294e-02 ## 28 DesiredWeight NumTattoos -0.059258761 1.175147e- 01 ## 29 TxtPerDay WeeklyHrsVideoGame -0.056908874 1.328089e-01 ## 30 TxtPerDay PercMoreAttractiveThan -0.051914439 1.703707e-01 ## 31 GPA PercMoreAttractiveThan -0.042028059 2.671434e- 01 ## 32 PercentDateable PercMoreIntelligentThan -0.038684528 3.071043e-01 ## 33 NumTattoos DistanceMovedToSchool -0.038465652 3.098513e-01 ## 34 NumTattoos PercMoreIntelligentThan -0.034824876
3.579113e-01 ## 35 WeeklyHrsVideoGame NumPhoneContacts -0.034002156 3.693880e-01 ## 36 PercentDateable OwnAttractiveness -0.031128683 4.112333e-01 ## 37 Weight TxtPerDay -0.030450056 4.215110e-01 ## 38 GPA MinPerDayFaceBook -0.026650097 4.817720e- 01 ## 39 Weight NumPhoneContacts -0.024653539 5.152159e- 01 ## 40 PercentDateable PercMoreAthleticThan -0.022101644 5.596495e-01 ## 41 Height NumPhoneContacts -0.019108335 6.140227e- 01 ## 42 DistanceMovedToSchool NumPhoneContacts -0.017688344 6.406038e-01 ## 43 TxtPerDay PercMoreAthleticThan -0.017477194 6.445971e-01 ## 44 NumBodyPiercings DistanceMovedToSchool -0.013874380 7.142305e-01 ## 45 WeeklyHrsVideoGame DistanceMovedToSchool -0.012612616 7.392276e-01 ## 46 Weight NumTattoos -0.011058382 7.703983e-01 ## 47 GPA PercMoreAthleticThan -0.010727704 7.770802e- 01 ## 48 TxtPerDay PercentDateable -0.008327162 8.260516e- 01 ## 49 NumTattoos PercMoreAthleticThan -0.007794828 8.370107e-01 ## 50 DesiredWeight NumPhoneContacts -0.007253297 8.481915e-01 ## 51

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.
• Fall '16
• BrianStevens
• Correlation and dependence, Pearson product-moment correlation coefficient, Spearman's rank correlation coefficient

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern