Consider this dataset of the spending habits of 100 families. Specifically, their food spending per month and their clothing spending per year. (A1spend.csv)
[8 points, 2 per question.] Use R code given below
3a) Find the Pearson correlation coefficient. Test the hypothesis that the parameter rho = 0 at the 0.01 level?
3b) How much of the variation in clothing spending can be explained by food spending?
3c) Verify the statistical significance of the correlation with a two-sided t-test. Report the t-score, degrees of freedom and p-value.
3d) Produce a scatterplot to better see the relation. Is there any trend in the plot that could be a problem?
“”,”family”,”food”,”clothing”
“1”,1,64.92,192.41
“2”,2,54.8,157.11
“3”,3,67.29,130.86
“4”,4,40.93,86.04
“5”,5,53.57,133.36
“6”,6,67.98,172.41
“7”,7,68.17,185.65
“8”,8,59.89,75.71
“9”,9,58.6,173.72
“10”,10,106.49,271.21
“11”,11,65.36,176.28
“12”,12,46.85,101.28
“13”,13,54.77,102.71
“14”,14,106.36,144.17
“15”,15,70.72,126.01
“16”,16,72.83,167.29
“17”,17,48.79,109.19
“18”,18,108.42,161.13
“19”,19,70.21,199.54
“20”,20,78.05,131.06
“21”,21,95.09,189.71
“22”,22,110.69,284.47
“23”,23,71.34,180.9
“24”,24,69.65,157.82
“25”,25,136.05,365.6
“26”,26,32.68,82.36
“27”,27,65.79,174.83
“28”,28,36.58,83.17
“29”,29,85.44,199.35
“30”,30,93.34,139.55
“31”,31,119.48,276.41
“32”,32,84.42,264.79
“33”,33,60.61,122.03
“34”,34,139.73,321.28
“35”,35,71.76,131.23
“36”,36,153.36,350.51
“37”,37,49.93,94.48
“38”,38,80.19,170.11
“39”,39,42.46,81.98
“40”,40,108.91,265.58
“41”,41,57.89,99.57
“42”,42,144.11,216.34
“43”,43,84.25,178.4
“44”,44,65.96,62.81
“45”,45,42.28,90.7
“46”,46,53.37,104.04
“47”,47,16.7,57.95
“48”,48,125.85,59.94
“49”,49,73.68,165.8
“50”,50,54.45,160.27
“51”,51,100.2,197.18
“52”,52,76.39,95.65
“53”,53,59.64,106.18
“54”,54,39.86,72.23
“55”,55,73.39,78.09
“56”,56,80.46,201.05
“57”,57,66.33,146.83
“58”,58,86.94,196.89
“59”,59,74.26,178.27
“60”,60,91.54,16.31
“61”,61,102.88,297.66
“62”,62,85.2,106.87
“63”,63,60.48,136.55
“64”,64,59.06,123.26
“65”,65,48.89,96.96
“66”,66,106.24,265.09
“67”,67,97.8,89.76
“68”,68,119.06,250.68
“69”,69,51.3,99.95
“70”,70,103.76,182.52
“71”,71,90.77,226.66
“72”,72,79.14,142.14
“73”,73,82.64,174.43
“74”,74,110.68,271.6
“75”,75,107.27,192.18
“76”,76,84.43,207.31
“77”,77,37.42,89.95
“78”,78,75.12,119.19
“79”,79,62.12,156.07
“80”,80,100.18,319.53
“81”,81,60.1,154.25
“82”,82,42.48,99.23
“83”,83,43.39,106.25
“84”,84,91.76,79.14
“85”,85,94.78,234.62
“86”,86,34.29,86.45
“87”,87,53.8,114.88
“88”,88,124.46,199.54
“89”,89,106.42,416.75
“90”,90,77.54,205.8
“91”,91,105.97,91.32
“92”,92,49.36,137.42
“93”,93,72.42,183.72
“94”,94,82.29,161.55
“95”,95,84.69,148.26
“96”,96,62.6,102.64
“97”,97,73.4,80.01
“98”,98,102.76,248.9
“99”,99,112.36,290.53
“100”,100,89.29,254.59
R code Q3 = read.csv(“A1spend.csv”)
head(Q3)
# Find the correlation, and test it
cor(Q3$food, Q3$clothing)
cor.test(Q3$food, Q3$clothing)
# Make a scatterplot
plot(Q3$food, Q3$clothing)