### 统计代写|r语言作业代写代做|Shiny App Portfolio Returns

R是一种用于统计计算和图形的编程语言，由R核心团队和R统计计算基金会支持。R由统计学家Ross Ihaka和Robert Gentleman创建，在数据挖掘者和统计学家中被用于数据分析和开发统计软件。用户已经创建了软件包来增强R语言的功能。

statistics-lab™ 为您的留学生涯保驾护航 在代写r语言方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写r语言代写方面经验极为丰富，各种代写r语言相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 统计代写|r语言作业代写代考|Shiny App Portfolio Returns

A Shiny application is a flexible, useful and powerful way to share our work. It is an interactive web application, which means we are about to become web programmers. In this section, we will build a Shiny app to display portfolio returns based on user inputs. Since this is our first Shiny app, we will review the code in detail and then reuse much of this code in future apps where we want to display different visualizations and statistics.
We want to empower an end user to do the following:
1) build a portfolio by choosing assets and weights
2) choose a start date

This encompasses much of our work thus far as it requires importing daily price data, converting to monthly log returns, assigning portfolio weights, calculating portfolio returns, and visualizing with ggplot(). The user can choose any 5 assets and our app could easily support 50 assets, though consider the user experience there – will any user manually enter 50 ticker symbols? At that number of assets, the preference would probably be to upload a csv file.

We will use RMarkdown to build our Shiny applications by inserting into the yaml runtime: shiny. This will alert the server (or our laptop) that this is an interactive document. The yaml also gives us a space for the title and to specify the format as flexdashboard. This is what the yaml looks like for the app (and the yaml for all of our future apps will be identical, except for the title).

## 统计代写|r语言作业代写代考|‘submit’ button

The ‘submit’ button is very important because it enables the use of eventReactive() to control our computation. An eventReactive() is a reactive function that will not start until it observes some event. In the next code chunk, we tell portfolio_returns_byhand to wait for input\$go by calling eventReactive (input\$go…. Now, have a quick look back at the previous code chunk, and note that we have actionButton (“go”…). Our reactive is waiting for the user to click on the submit button we have labeled with go.
After that, the code chunk below should look very familiar from our previous work, except it depends on user inputs for symbols, weights and starting date.
For example, when we previously built our portfolio, we statically defined symbols as symbols <- c(“SPY”, “EFA”, “IJS”, “EEM”, “AGG”).

In the chunk below, it is defined reactively as symbols <- c (input\$stock1, input\$stock2, input\$stock3, input\$stock4, input\$stock5). I copy the full code below even though it is very similar to how we calculated portfolio returns in the non-Shiny context. For future Shiny apps, we will not be reviewing this code again but they will all use a similar flow to take tickers and weights for constructing a portfolio. Take a close look and identify how our tickers, weights and starting date get passed to the eventReactive () function. The tickers are input\$stock1, input\$stock2, etc, the weights are input\$w1, input $\$ 22$, etc. The date is input$\ date.

## 统计代写|r语言作业代写代考|Concluding Returns

We have reviewed several paths, packages and code flows for building a multiasset portfolio and calculating monthly log returns. At this point, you should feel comfortable with the difference between an xts object and a tibble, how to import prices, transform to returns, and employ various visualization techniques.

From a general data science paradigm perspective, we can think of this as data import, wrangling and transformation where:
(i) pulling daily prices from Yahoo! Finance, csv or xls = data import
(ii) isolating adjusted prices and converting to monthly prices = data wrangling
(iii) converting to log returns, portfolio returns = data transformation
We were painstaking about our process to provide ourselves and collaborators with a clear data provenance, plus a variety of code paths for visualizing and inspecting data.

In the following sections, we will see how having several base portfolio returns objects facilitates our more analytic work. Make sure the tibble and xts objects are familiar and intuitive because we will use them throughout the rest of the book without reviewing their lineage.

If you are firing up a new $\mathrm{R}$ session and want to run the code to build all of our base portfolio returns objects, you can grab the code, with no text or explanations, here:
www.reproduciblefinance.com/code/get-returns/

## 统计代写|r语言作业代写代考|Shiny App Portfolio Returns

Shiny 应用程序是一种灵活、有用且强大的方式来分享我们的工作。它是一个交互式网络应用程序，这意味着我们即将成为网络程序员。在本节中，我们将构建一个闪亮的应用程序来根据用户输入显示投资组合回报。由于这是我们的第一个 Shiny 应用程序，我们将详细审查代码，然后在未来希望显示不同可视化和统计信息的应用程序中重用大部分代码。

1）通过选择资产和权重来构建投资组合
2）选择开始日期

## 统计代写|r语言作业代写代考|‘submit’ button

“提交”按钮非常重要，因为它可以使用 eventReactive() 来控制我们的计算。eventReactive() 是一个反应函数，它在观察到某个事件之前不会启动。在下一个代码块中，我们通过调用 eventReactive (input $go… ) 告诉portfolio_returns_byhand 等待输入$ go。现在，快速回顾一下前面的代码块，并注意我们有 actionButton (“go”…)。我们的响应式等待用户点击我们标记为 go 的提交按钮。之后，下面的代码块应该与我们之前的工作非常相似，除了它依赖于用户输入的符号、权重和开始日期。例如，当我们之前构建投资组合时，我们将符号静态定义为符号 <- c(“SPY”、“EFA”、“IJS”、“EEM”、“AGG”)。

## 统计代写|r语言作业代写代考|Concluding Returns

(i) 从 Yahoo! 获取每日价格 Finance、csv 或 xls = 数据导入
(ii) 隔离调整后的价格并转换为月度价格 = 数据整理
(iii) 转换为对数回报、投资组合回报 = 数据转换

www.reproduciblefinance.com/code/get-returns/

## 广义线性模型代考

statistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。