Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer and show code output for each part of the question 1. Write Your Own Function - SCAD penalty function (40 points) SCAD penalty

Please answer and show code output for each part of the question

image text in transcribed
1. Write Your Own Function - SCAD penalty function (40 points) SCAD penalty function is defined as: if |x| $ 1 if 1 3 This function is linear on the interval [-1,1], quadratic on the interval [-3,-1] and [1,3] and constant outside of [-3,3). It transitions from linear to quadratic and then to constant "smoothly", and looks like this: 1.5 scad(x) 0.5 0.0 -2 2 X It is often used in the varible selection. Interested in more? Read the paper: Variable Selection via Nonconcave Penalized Likelihood and its Oracle Properties (Fan and Li, 2001). . la. Write a function scad () that takes as an input a number r, and returns the SCAD value w(z), as defined above. Hint: the body of a function is just a block of R code, e.g., in this code you can use if () and else () statements. Check that scad(1) returns 1, and scad(4) returns 2. . 1b. The scad function can be modified so that the transition from quadratic to constant happens at an arbitrary cutoff value a, as in: if la| $ 1 if 1 a Here a is required to be larger than 2. Starting with your solution code to the last question, update your scad() function so that it takes two arguments: a, a number at which to evaluate the loss, and a a number representing the cutoff value. If a $ 2, the return value should be NULL. It should now return va(x), as defined above. Check that scad (3, 3) returns 2, and scad (6, 4) returns 2.5. . le. Update your scad() function so that the default value of the cutoff a is 3. Check that acad (5) returns 2. . Id. Check that scad (a-5, x-6) returns 3. Check that scad (5, 6) returns 3.4. Explain why these are different

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modeling And Analysis Of Dynamic Systems

Authors: Ramin S. Esfandiari, Bei Lu

3rd Edition

1138726427, 9781138726420

More Books

Students also viewed these Mathematics questions

Question

India experiences which type of climate?

Answered: 1 week ago

Question

What is an aquifer?

Answered: 1 week ago