In this question, we will look at a location-scale transformation based on a user-defined function. (i) Write a R function g to implement the following function for the location-scale transformation: x-a g(x) = b Your function accepts a vector x and returns the transformed vector and has three arguments: the input value x, location parameter a, and scale parameter b. (ii) To transform x to the interval [0, 1], we can use the following arguments in the g function: g(x, a = min(x), b = max(x) min(x)) Use the function g to transform the following sample x to the interval [0,1]: set.seed(10);x<-rnorm (100,-1,3). To check the result, plot two histograms for the original and transformed samples with relevant titles. (iii) In Statistics, we frequently standardize a variable in the following way: where 8 for 1,2,..., 100, and s are the sample mean and the sample standard deviation of x,'s.¹ Use the function g to standardize the sample 2. To check the result, plot a histogram for the standardized samples with a vertical reference line at 0 and a relevant title.
In this question, we will look at a location-scale transformation based on a user-defined function. (i) Write a R function g to implement the following function for the location-scale transformation: x-a g(x) = b Your function accepts a vector x and returns the transformed vector and has three arguments: the input value x, location parameter a, and scale parameter b. (ii) To transform x to the interval [0, 1], we can use the following arguments in the g function: g(x, a = min(x), b = max(x) min(x)) Use the function g to transform the following sample x to the interval [0,1]: set.seed(10);x<-rnorm (100,-1,3). To check the result, plot two histograms for the original and transformed samples with relevant titles. (iii) In Statistics, we frequently standardize a variable in the following way: where 8 for 1,2,..., 100, and s are the sample mean and the sample standard deviation of x,'s.¹ Use the function g to standardize the sample 2. To check the result, plot a histogram for the standardized samples with a vertical reference line at 0 and a relevant title.
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter13: Structures
Section: Chapter Questions
Problem 4PP
Related questions
Question
Using R language
![In this question, we will look at a location-scale transformation based on a user-defined function.
(i) Write a R function g to implement the following function for the location-scale transformation:
x-a
g(x) =
b
Your function accepts a vector x and returns the transformed vector and has three arguments: the
input value x, location parameter a, and scale parameter b.
(ii) To transform x to the interval [0, 1], we can use the following arguments in the g function:
g(x, a = min(x), b = max(x) min(x))
Use the function g to transform the following sample x to the interval [0,1]:
set.seed(10);x<-rnorm (100,-1,3).
To check the result, plot two histograms for the original and transformed samples with relevant titles.
(iii) In Statistics, we frequently standardize a variable in the following way:
where
8
for 1,2,..., 100,
and s are the sample mean and the sample standard deviation of x,'s.¹
Use the function g to standardize the sample 2. To check the result, plot a histogram for the
standardized samples with a vertical reference line at 0 and a relevant title.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F4a1c925e-790f-448e-9276-e5adcf0e8758%2F598e50f2-e79c-423a-95a6-f554695a3e47%2Fknv4a1w_processed.png&w=3840&q=75)
Transcribed Image Text:In this question, we will look at a location-scale transformation based on a user-defined function.
(i) Write a R function g to implement the following function for the location-scale transformation:
x-a
g(x) =
b
Your function accepts a vector x and returns the transformed vector and has three arguments: the
input value x, location parameter a, and scale parameter b.
(ii) To transform x to the interval [0, 1], we can use the following arguments in the g function:
g(x, a = min(x), b = max(x) min(x))
Use the function g to transform the following sample x to the interval [0,1]:
set.seed(10);x<-rnorm (100,-1,3).
To check the result, plot two histograms for the original and transformed samples with relevant titles.
(iii) In Statistics, we frequently standardize a variable in the following way:
where
8
for 1,2,..., 100,
and s are the sample mean and the sample standard deviation of x,'s.¹
Use the function g to standardize the sample 2. To check the result, plot a histogram for the
standardized samples with a vertical reference line at 0 and a relevant title.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 3 images

Recommended textbooks for you

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L