/* Data and program from "Analyzing activity tracker data: How many steps per day do YOU take?" by Rick Wicklin http://blogs.sas.com/content/iml/2014/08/22/activity-trackers/ */ /* Data from tweets during a 10-minute period for activitiy recorded on on 8/17/2014 for a particular fitness activity tracker */ data Tracker; informat Steps COMMA. Miles; format Steps comma.; input Steps Miles; datalines; 4,314 1.8 4,635 1.9 11,343 4.6 4,991 2.1 8,708 2.3 12,469 5.1 11,863 5.5 26,686 12.7 8,283 3.5 3,533 1.5 4,580 1.8 14,029 6.4 21,606 12.8 18,069 13.5 1,104 0.5 4,348 1.9 4,804 2.3 9,452 4.1 13,672 6.1 7,639 3.5 5,091 2.3 3,482 1.6 12,731 6.3 9,729 4.4 6,209 2.8 5,508 3.1 28,469 13.4 8,220 3.5 7,922 3.7 7,728 3.3 9,084 3.8 4,038 1.8 6,653 2.7 7,999 3.3 2,925 1.3 1,996 0.8 7,475 3.6 15,584 6.9 16,246 12.2 5,872 2.6 5,159 2.4 10,844 5.3 13,116 6 12,273 5.5 7,460 3.1 5,594 2.3 3,226 1.4 5,764 2.5 953 0.4 7,000 3.1 13,486 6.2 2,979 1.3 3,070 1.2 7,371 3.5 14,090 6.6 420 0.2 11,176 2.8 7,532 3.1 6,889 2.8 1,958 0.9 11,520 6.5 4,821 2.3 10,755 4.1 4,003 1.7 6,175 2.9 53 0 2,983 1.2 17,375 12.4 13,573 6.5 2,539 1.1 13,240 5.5 12,159 4.4 2,216 1.1 13,009 2.3 12,216 5.4 3,630 1.6 7,191 3.3 13,555 5.8 7,705 3.3 73 0 8,526 3.6 6,207 2.8 12,274 5.4 7,319 3.3 10,424 4.3 14,248 6.2 1,794 0.8 10,975 4.7 3,774 1.6 11,822 4.9 6,452 2.8 8,472 3.9 1,013 0.4 2,501 1.1 12,643 5.3 3,279 1.4 5,252 2.2 1,541 0.7 4,472 1.7 8,425 3.6 10,027 4.4 1,784 0.7 2,929 1.5 7,848 3.3 2,612 1 3,642 1.7 3,686 1.6 16,102 7.6 2,703 1.2 2,107 0.9 9,634 4.4 5,022 2.2 14,209 6.3 5,922 2.4 4,341 1.9 6,415 3.1 372 0.2 10,378 4.7 9,131 4.2 4,518 2 6,685 3.3 7,978 3.3 8,893 4.1 7,090 3.1 6,731 3.1 12,507 5.5 3,648 1.4 8,659 3.4 15,251 6.8 11,349 5.2 10,381 4.4 16,675 7.2 3,101 1.4 4,594 1.9 11,006 6.1 5,028 2.4 18,019 8.8 3,661 1.6 23,684 20.2 4,218 2.4 10,499 5 11,856 5.2 9,551 4.2 6,422 2.7 1,705 0.7 5,744 2.2 2,492 1 13,906 6.3 5,628 2.6 6,557 2.9 3,518 1.5 17,107 7.6 2,546 0.7 4,203 1.8 18,468 8.7 11,601 4.9 4,664 2.1 15,841 7.7 99 0 16,526 7.8 9,587 5 503 0.2 3,394 1.7 3,369 1.4 4,012 1.5 5,361 2.4 12,771 5.4 7,107 3.7 3,152 1.3 9,629 4.5 3,291 1.3 7,997 3.6 3,168 1.4 17,202 8.1 5,161 2.3 2,420 1 18,831 8.6 5,245 2.3 10,757 4.3 4,865 1.9 20,676 9.5 6,066 2.8 5,055 2 5,674 3 1,652 0.6 12,904 6 3,450 1.4 2,118 0.9 8,233 3.5 4,792 2.2 6,820 4.8 1,880 0.8 41,734 16.9 11,054 4.8 5,913 2.4 5,709 2.5 13,910 6.5 3,156 1.4 27,828 13.1 14,920 6 2,264 1.1 8,320 3.7 4,519 1.9 12,552 5.7 10,288 4.4 10,038 4.3 1,977 0.9 4,275 2 10,278 4.6 1,139 0.5 2,365 1 7,106 3.4 8,953 5.1 1,421 0.4 5,346 2 1,874 0.8 11,858 4.8 14,413 6.7 12,459 8.8 8,068 3.6 13,915 10.9 13,398 6 26,255 14.1 10,382 4.8 11,067 5 11,491 5 11,507 5.4 5,376 2 14,636 5.6 20,389 8.9 6,850 2.9 ; proc means data=Tracker N mean Q1 median Q3 QRange; var Miles Steps; run; title "Distribution of Steps for 231 Users"; proc univariate data=Tracker; var Steps; histogram Steps / endpoints kernel(lower=0) odstitle=title odstitle2=title2; inset N Q1 median Q3 P95 / pos=NE; run; title "Miles vs. Steps from Tracker Data (N=231)"; proc sgplot data=Tracker; where Steps<=20000; scatter x=Steps y=Miles; xaxis grid; yaxis grid; run; /* fit robust regression lin. Slope is average "Miles per Step" */ proc robustreg data=Tracker method=lts fwls outest=RROut; model Miles = Steps / noint; run; data Results; set RROut; MilesPerStep = Steps; StepsPerMile = 1/MilesPerStep; FeetPerStep = 5280 * MilesPerStep; CmPerStep = 30.48 * FeetPerStep; keep StepsPerMile FeetPerStep CmPerStep; run; proc print data=Results noobs; run;