当前位置:天才代写 > R语言代写,r语言代做-无限次修改 > Write functions代写 编写函数代写 R代写

Write functions代写 编写函数代写 R代写

2020-07-27 17:40 星期一 所属: R语言代写,r语言代做-无限次修改 浏览:1150

Write functions代写

Project 2:  Write functions to do the following:

Write functions代写 You need to write your r codes,not to use the existing r functions.You may use the existing r function to check your results.

Write functions代写
Write functions代写

You need to write your r codes, not to use the existing r functions. You may use the existing r function to check your results. If you only provide the results from the existing r function, you will not receive any point.Write functions代写

a)Write functions to compute the sample mean and 100(1-α)% confidence interval of sample mean.

Plot a histogram for the original sample of 50 cases for “rs” and “dpi” variable and impose a smooth curve on the top of the histogram, respectively.Write functions代写

Add proper x-axis label, y-axis label, and a title for each histogram.

Plot these two histograms in one row and side-by-side.

Add a global title for the two plots.

 

Apply the function to the variables “sr” and “dpi” of the data set LifeCycleSavings, which is a data set provided in R [in R Studio, ?LifeCycleSavings  to see the description of this data set].Write functions代写

 

The data frame with 50 observations on 5 variables.

[,1] sr numeric aggregate personal savings
[,2] pop15 numeric % of population under 15
[,3] pop75 numeric % of population over 75
[,4] dpi numeric real per-capita disposable income
[,5] ddpi numeric % growth rate of dpi

Present the results in the following for variable “sr”, and a table for the variable “dpi”

Variable Mean SD of Mean 95% CI:

Lower Bound

95% CI:

Upper Bound

“rs”: Aggregate personal savings
“dpi”: Real per-capita disposable income

And plot the histograms following the table.

b)Write a function to compute the trimmed mean and 100(1-α)% confidence interval of trimmed mean.

perform similar plots as described in (a) for trimmed sample.

[NOTE: Trimmed mean is explained at the end of the Project 2]

Apply the function to the variables “sr” and “dpi” of the data set LifeCycleSavings.

 

Present the table results and the histogram plots similar to (a).

c)Write a function to compute bootstrapping mean and 100(1-α)% confidence interval of bootstrapping mean.
[NOTE: Bootstrapping mean is explained below.]

Perform histogram plots similar to that described in (a) for the 500 bootstrapping sample means for each variable.

Apply the function to the variables “sr” and “dpi” of the data set LifeCycleSavings.

Present the table results and histogram plots similar to (a).

Explanation of Trimmed Mean

Given a sample, x1, x2, x3, …., xn; n cases, drop the smallest k% and largest k% from the sample. Based on this timed sample, compute the sample mean, standard deviation(SD), Standard deviation of Mean = SD/Sqrt(n),  and (100-α)% confidence bounds.Write functions代写

Explanation of Bootstrapping Mean:

Given a sample, x1, x2, x3, …., xn; n cases. Treat the n cases as the “population” to be sampled. The sampling process for obtaining bootstrapping samples:

  • Select a random sample of size n (the same the original sample size) WITH REPLACEMNT:

{b1,b2,b3, …., bn} form a bootstrapping sample. Compute a bootstrapping sample mean.

  • Repeat step (i) for 500 times. You should have 500 sample means.
  • Bootstrapping mean, BM = Average of these 500 bootstrapping sample means.

Bootstrapping standard deviation (BSD) is the standard deviation of these 500 sample means.

100(1-α) % confidence limit:

Lower bound = BM – Zα/2 (SBD), Upper Bound = BM + Zα/2 (SBD)

NOTE: You need to specify seed for each bootstrapping sample. Using the seed (1) for the first bootstrapping sample, then, use 11, 21, 31, 41, and so on as the new seed for the next bootstrapping sample, in sequence.Write functions代写

Reporting your results for Project 2:

In your R-Markdown report with the file names, such as:

Submit Test1_LeeC_prj2.rmd  and Test2_LeeC_prj2.pdf

The R-Markdown should include three chunks of r-code. Each chunk is the r-codes for solving (a), (b), and (c) respectively.Write functions代写

Write functions代写
Write functions代写

 

 

 

 

 

 

 

更多其他:r语言代写 代写 代写CS 代写CS作业  代写作业 代写加急 代码代写 作业帮助

合作平台:天才代写 幽灵代写  写手招聘 Essay代写

 

 

天才代写-代写联系方式