Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Load the data into R from the site http://www.stat.berkeley.edu/users/nolan/ dat

ID: 3639409 • Letter: L

Question

Load the data into R from the site http://www.stat.berkeley.edu/users/nolan/
data/Cache500.rda. These data are stored as an R object called Cache500. Read
the data directly into R from the web; DO NOT download it first and then read in
the local file.


3. Function: PlotRanks()
(a) This function should use the previous functions and sapply() to get a rank for
each website in whichOK amongst the simulated data. The rank should be
between 1 and n+1, for now using the default value of n=1000.
(b) Scale the ranks between 0 and 1 (in other words, divide by n+1).
(c) Make a histogram of the scaled ranks for all the websites in whichOK. Include
on your histogram a vertical red line through .95. Use the breaks argument to
make it so that the edge of a bar is at .95.
(d) Use return() to pass back the vector of ranks.


Explanation / Answer

function plotRanks(r1, r2, r3, N) close all rank1 = normalizeRank(r1(1:N,2)); rank2 = normalizeRank(r2(1:N,2)); rank3 = normalizeRank(r3(1:N,2)); figure R = [rank1 rank2 rank3]; h = area(log(100000*R+1)); C = [1 0 0]; a = .1; b = .5; c = .9; % set(get(h(1),'BaseLine'),'LineWidth',5,'LineStyle',':') set(h(1),'facecolor',a*C,'EdgeColor',a*C) % use color name % set(get(h(2),'BaseLine'),'LineWidth',5,'LineStyle',':') set(h(2),'facecolor',b*C,'EdgeColor',b*C) % or use RGB triple % set(get(h(3),'BaseLine'),'LineWidth',5,'LineStyle',':') set(h(3),'facecolor',c*C,'EdgeColor',c*C) % or use a color defined in the help for PLOT % colormap hsv legend('','','') function r = normalizeRank(r) r = 1/sum(r)*r; display(sum(r))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote