Question

Need help with this in R please! Using your set code as in quiz 2.3, in...

Need help with this in R please!

Using your set code as in quiz 2.3, in R create data using the commands to create the vector "x":

set code = 328

set.seed(set code)

x=rnorm(50,3,1.5)

Then find

  1. sample mean
  2. sample median
  3. sample 57th percentile (using weighted average approach)
  4. create histogram of your data
0 0
Add a comment Improve this question Transcribed image text
Answer #1

R code:

x=rnorm(50,3,1.5)
mean(x) # sample mean
median(x)# sample median
#sample 57th percentile (using weighted average approach)
t=sort(x)
r=floor(50*57/100)
q=(50*57)/100-r
p=t[r]+q*(t[r+1]-t[r])
p# sample 57th percentile
hist(x)

Output:

> mean(x) # sample mean
[1] 2.976824
> median(x)# sample median
[1] 2.779572
> p# sample 57th percentile
[1] 3.104637
6 5 4 3 2 1 「0 Aouenbe」し

Add a comment
Know the answer?
Add Answer to:
Need help with this in R please! Using your set code as in quiz 2.3, in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PLEASE HELP WITH THE FOLLOWING R CODE! I NEED HELP WITH PART C AND D, provided...

    PLEASE HELP WITH THE FOLLOWING R CODE! I NEED HELP WITH PART C AND D, provided is part a and b!!!! a) chiNum <- c() for (i in 1:1000) { g1 <- rnorm(20,10,4) g2 <- rnorm(20,10,4) g3 <- rnorm(20,10,4) g4 <- rnorm(20,10,4) g5 <- rnorm(20,10,4) g6 <- rnorm(20,10,4) mse <- (var(g1)+var(g2)+var(g3)+var(g4)+var(g5)+var(g6))/6 M <- (mean(g1)+mean(g2)+mean(g3)+mean(g4)+mean(g5)+mean(g6))/6 msb <- ((((mean(g1)-M)^2)+((mean(g2)-M)^2)+((mean(g3)-M)^2)+((mean(g4)-M)^2)+((mean(g5)-M)^2)+((mean(g6)-M)^2))/5)*20 chiNum[i] <- msb/mse } # plot a histogram of F statistics h <- hist(chiNum,plot=FALSE) ylim <- (range(0, 0.8)) x <- seq(0,6,0.01) hist(chiNum,freq=FALSE, ylim=ylim)...

  • I am working on a tutorial r question set where I need to create a "new"...

    I am working on a tutorial r question set where I need to create a "new" variable that characterizes "old" in the following manner. Define a tract to have a low rate, less than the median for the data set, medium rate between medium and 75 percentile, and high if the rate is higher than 75 percentile. What would the r code look like? Not sure how to pull "old" variable out of the data set and define a high,...

  • a) Use the following R code to empirically check the Central Limit Theorem via simulation .n...

    a) Use the following R code to empirically check the Central Limit Theorem via simulation .n <- 40 # sample size m <- c(1:200) #create a vector of length 200 for (i in 1:200) { #simulate 200 samples x <- rnorm(n) m[i] <- mean(x) } hist(m) b) Repeat part (a) with n=200 and compare the histograms. Describe what you observe and what you expect when n increases. c) Repeat parts (a) and (b) with runif() and rexp() respectively instead of...

  • Need help for the coding using the R Markdown in R Studio for question2 and question2....

    Need help for the coding using the R Markdown in R Studio for question2 and question2. Please provide a detailed solution with an original R code, outputs and a clear statement of the final answer. First, verify by typing out the terms in the appropriate formulas for the t-statistic and the confidence limits that you and R agree about how these should be calculated. For instance, your R code should be structured the way the Excel commands for confidence limits...

  • I need to plot a histogram for estimates of Beta_0 and Beta_1 (over the 100 simulations)....

    I need to plot a histogram for estimates of Beta_0 and Beta_1 (over the 100 simulations). I know I can use the coefficients function with the model to display these estimates for each simulation, but how can I access them individually, or save them to a column vector such that I can plot the histogram as needed? Suppose we want to simulate the following linear model: Bo + BiX; + Ei where ti~ N(0,22). Assume Xi~ N(0,12), Bo = 0.5...

  • Solve d,e and f please using R code Part I: qqplots This part deals with qqplots...

    Solve d,e and f please using R code Part I: qqplots This part deals with qqplots of all kinds. Let's do some easy expe riments, first. Let's take a sample from a normal distribution with mu-2, sigma 3, and then look at the hist and the qqplot of that data: set.seed(3) n 100 # Sample size x norm(n,2,3) # Sample from N(mu-2, sigma-3) hist(x) # Looks normal. But that depends on breaks. qqnorm(x) # This doesn't depend on binsize, and...

  • please I need help with excel or matlab part. part 3 Lab 1 BASIC DATA PROCESSING...

    please I need help with excel or matlab part. part 3 Lab 1 BASIC DATA PROCESSING PRE-LAB ASSIGNMENT 1. Read the lab manual carefully so you know what you have to do when you walk into the lab. 2. In a lab, the resistance of a resistor was measured using 50 samples giving the following values: 119.95 (6), 121.32 (5), 119.57 (7), 117.43(1), 120.76 (15), 120.67 (1), 119.78 (8), 121.43(3), 121.82(1), and 118.47 (3) 2 Estimate the average value of...

  • Using R, Exercise 4 (CLT Simulation) For this exercise we will simulate from the exponential distribution....

    Using R, Exercise 4 (CLT Simulation) For this exercise we will simulate from the exponential distribution. If a random variable X has an exponential distribution with rate parameter A, the pdf of X can be written for z 2 0 Also recall, (a) This exercise relies heavily on generating random observations. To make this reproducible we will set a seed for the randomization. Alter the following code to make birthday store your birthday in the format yyyymmdd. For example, William...

  • QUIZ 2.3 EXAMPLE 2.25 Please help me build the MATLAB code Use MATLAB to build a...

    QUIZ 2.3 EXAMPLE 2.25 Please help me build the MATLAB code Use MATLAB to build a simulation of Quiz 2.3. Simulate the transmission of 10000 packets, each containing 100 bits. Count the number of packets that contain no error, one, two, three- bit errors, calculate their probabilities. Also calculate the probability of a packet is decoded correctly. Compare your numbers from MATLAB with your theoretical calculation. (Hint: look at Example 2.25.) Data packets containing 100 bits are transmitted over a...

  • Following commands in R computes 5000 simulations of and sample means of size 12 from a normal di...

    NEED HELP WITH PART B following commands in R computes 5000 simulations of and sample means of size 12 from a normal distribution with mean μ-100 standard deviation ơ--14 require(fastR2) nsamplesum <-do (5000) c(sample.mean-mean(rno * c(sample.mean-mean (rnorm (12,100,14))) The following commands compute the approxim ate mean and standard distribution of the sample mean. sample mean and plot the histogram giving the approximate mean (sample.mean, data-nsamplesum) sd( sample.mean, data-nsamplesum) gf .dhistogram( sample.mean, data- nsamplesum, bins (a Compare the approximate values of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT