Question: in R code please ! if anyone could help with q1 a-d i would really appreciate it ! f(x)={ba10ifax1otberwise Wo want to write a function

in R code please ! if anyone could help with q1 a-d i would really appreciate it ! in R code please ! if anyone could help with q1 a-d

f(x)={ba10ifax1otberwise Wo want to write a function duniforn (x,a,b) that taikon an arbitrary value of x and parameters a and b and retum the appropriate height of the densty function. For various values of x, a, and b. demonstrate that your function returns the correct density value. a. Write your function without regand for at working with vectors of data. Demonstate that it works by caling the function with a three times, once where xy ggplot ( aes (xx2,yyy)++ geon_step() e. Instal the R package microbenchnark. We will use this to dscover the nuerage duration your function takes. nicrobenchmarki:aicrobenchmarki dunifornt segi 4,12, byr, eotif. This will call the input A expression 100 times and repon summary statistics on how long a took for the code to nu, In particulat, look at the median time for evaluation. d. Instead of using a for loop, it might have been easier to use an ifelse() command. Plowrte your function to avoid the for- locp and just use an ifelse () command. Verify that your function works conectly by producing a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!