Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Loop and If 1. Write an R code to define a function which keeps drawing a random number from N(0,1) until the number is positive.
Loop and If
1. Write an R code to define a function which keeps drawing a random number from N(0,1) until the number is positive. Use rnorm() and while() to answer this question.
You are generating a random draw from a truncated normal distribution. 2. Write an R code to repeat the previous function for 100 times. Use for() to answer this question.
3. Take the sample mean of 100 values you have generated. (It should be near 0.7979.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started