首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
CST2330程序讲解、Data Analysis程序辅导、辅导Python,R程序设计 讲解SPSS|解析C/C++编程
项目预算:
开发周期:
发布时间:
要求地区:
MIDDLESEX UNIVERSITY COURSEWORK 1
CST2330
Data Analysis for Enterprise Modelling
This assignment is worth 50% of the overall grade. The submission date is Week 12, Friday, 19:00 January 8, 2021.
Contents
1The net present value (NPV) problem (10%) 1
2Optimisation and linear programming (20%) 2
2.1Solution using analysis and graphs (10%) . . . . . . . . . . . . . . 2
2.2 Solution using solver (10%) . . . . . . . . . . . . . . . . . . . . . . 3
3Data import, plotting and transformation (20%) 3
3.1 Plot prices (5%) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.2 Create prices table (10%) . . . . . . . . . . . . . . . . . . . . . . . 5
3.3 Convert prices to log-returns (5%) . . . . . . . . . . . . . . . . . . 6
Software and data required
You are recommended to use R-Studio — an integrated development environment for R language. It is available on the University computers from Apps Anywhere. It can also be installed on personal computers, a free copy is available at:
https://rstudio.com/products/rstudio/
You may need to load the following libaries in R-Studio:
●lpSovle — to solve linear programming problems in Task 2.
●DBI — if you need to connect and read databases in Task 3.
●xts — for extensible timeseries objects in Task 3.
Note, however, that all tasks in this coursework can be implemented in other languages (e.g. Python, Common Lisp, Julia or even more visual projects, such as KNIME or RapidMiner), and you can use them, if you feel more comfortable.
A specific dataset is required for Task 3 as well as the tasks in Coursework 2.
It is available on My Learning in the Data folder of the CST2330 page.
1The net present value (NPV) problem (10%)
A car manufacturer is looking to bring a new range of electric vehicles (EV) in the next five years. This will require an initial investment of f500M and has running costs of f100M per year after that. The predicted incomes from this range are:
Year 2020 2021 2022 2023 2024 2025
fM 0 10 50 200 300 500
Notice that the initial expenditure takes place in 2020.
1.Assume a discount rate of 1% per year, and perform analysis of discounted cashflow. You should create a data table in R with variables Year, Outflow
and in the first three columns:
year outflow inflow net n pvf
1 2020 500 0
2 2021 100 10
3 2022 100 50
4 2023 100 200
5 2024 100 300
6 2025 100 500
Write a function to analyse the cashflow table:
This function should modify the table by adding columns showing the net returns, the numbers of years to discount, the present value factors and the discounted returns. Your function must be able to take different cashflow tables and discount rates as the input, print the modified cashflow table and return the (total) net present value (NPV) for the investment. Include your
code into the report. 5 marks
2.Decide whether or not this is a worthwhile investment, justifying your answer
by your results. 1 mark
3.Calculate the NPV for discount rates of 2%, 3%, 4% and 5%, giving your
answers to two decimal places. 1 mark
4.Plot NPV against the discount rates ranging from 0% to 5%. 1 mark
5.Use your graph to estimate the discount rate that would give an NPV of zero. What is the significance of this discount rate? (Hint: What happens
at discount rates lower and higher than this figure?) 2 marks
2Optimisation and linear programming (20%)
2.1Solution using analysis and graphs (10%)
A car manufacturer produces conventional cars, which generate f4,000 profit per car, and a newly developed EVs, which generate f5,000 per car. The objective is to maximise profit by selecting the right combination of conventional cars and EVs, subject to the following constraints:
●The factory can produce up to 1,000 conventional cars and up to 500 EVs per day.
●The logistics and warehouse facilities do not allow for production of more than 750 vehicles per day in total (i.e. both conventional and EVs).
●The manufacturer has a contract to produce at least 100 conventional and 50 EVs per day.
Your task is to:
1.Write the objective function. 1 mark
2.Write the constraints for production and logistics. 2 marks
3.Plot or draw the feasible region and the isoprofit line. 3 marks
4.Find the optimal numbers of conventional cars and EVs to be produced (the
solution) in order to achieve the maximum profit (the optimal value). 2 marks
5.Explain the solution analytically or using the graph. 2 marks
2.2Solution using solver (10%)
Assume that the manufacturer adds hybrid vehicles to their range, which generate f4,500 profit per car. The factory can produce up to 1,000 hybrid cars per day, and there are no obligations to the smallest number. The warehouse constraints remain the same.
Your task is to:
1.Write the updated objective function. 1 mark
2.Write the updated constraints for production and logistics. 2 marks
3.Use the lpSolve library in R to find the solution (an optimal combination of three types of cars) and the optimal value (the maximum profit) to this
problem. Include your code into the report. 5 marks
4.What happens if the contract to supply at least 100 conventional cars is
replaced by the same number of hybrid cars? 2 marks
3Data import, plotting and transformation (20%)
In this task, you should use the crypto-candles dataset, which contains daily exchange rates between major crypto-currencies between Jan 2019—Sept 2020. This dataset can be downloaded from the data folder on the course’s webpage (My Learning). There are two versions of this dataset:
crypto-candles.csv crypto-candles.db
The first is a comma separated values (csv) file, and the second is an SQLite database. You can read the csv file with the read.csv command. Alternatively, you can connect to the database and read table candles from the db file using the dbReadTable command. You should assign the result to a variable, which you may call candles. Note that if you read data from the database, then the timestamps have to be converted into dates by the command:
Regardless of which method you use, you should now have the same dataset, the first 6 rows of which are:
TIMESTAMP OPEN CLOSE HIGH LOW VOLUME SYMBOL
1 2020 -09 -16 01:00:00 10789 10803 10803 10789 12.05823 tAAABBB
2 2020 -09 -14 01:00:00 10316 500 10377 500 4658.04400 tAAABBB
3 2020 -09 -13 01:00:00 10459 10324 10586 10238 822.69780 tAAABBB
4 2020 -09 -12 01:00:00 10407 10443 10489 10297 499.03366 tAAABBB
5 2020 -09 -11 01:00:00 10355 10406 10415 10218 810.13170 tAAABBB
6 2020 -09 -10 01:00:00 10302 10355 10484 10271 901.84625 tAAABBB
The column SYMBOL contains names of the trading pairs (e.g. tBTCUSD is the ex- change rate between Bitcoin and the US Dollar). Thus, each row of the dataset contains a record of the prices (open, close, high, low) and volume data on a spec- ified date (given by the TIMESTAMP) and for each trading pair (given by SYMBOL).
The goal of this task is to make several transformations of this dataset into
other formats, so that it is ready for further analysis in Coursework 2.
3.1Plot prices (5%)
Plot closing prices against time for several (2–5) trading pairs, such as the graph below shown for the tBTCUSD pair:
BTCUSD 2019−01−02 / 2020−09−19 01:00:00
12000 12000
10000 10000
8000 8000
6000 6000
4000 4000
Jan 02 Apr 01 Jul 01 Oct 01 Jan 01 Apr 01 Jul 01 Sep 19
2019 2019 2019 2019 2020 2020 2020 2020
To do this, you will need to select subsets from the data corresponding to the trading pairs of your choice (e.g. tETHUSD, tETHBTC, tIOTBTC, tEOSJPY), and then selecting columns TIMESTAMP and CLOSE. Note that before plotting the subset, you can convert it into the extensible timeseries format (xts) using the command:
where
is your subset for a specific trading pair. 5 marks
3.2Create prices table (10%)
Convert the dataset into a new format, which contains the closing prices for each trading pair in different columns side-by-side and ordered according to their TIMESTAMP. Thus, each row should correspond to a specific date and contain closing prices for all trading pairs, as shown below:
tAAABBB tABSUSD ... tBTCEUR tBTCGBP tBTCJPY tBTCUSD
2019 -01 -02 NA NA ... 3577.195 3233.9 435370.0 4048.8
2019 -01 -03 NA 0.0075 ... 3441.500 3101.6 423820.0 3924.3
2019 -01 -04 NA 0.0078 ... 3476.100 3116.6 429750.0 3954.9
2019 -01 -05 NA NA ... 3432.478 3075.2 424538.3 3911.9
2019 -01 -06 NA NA ... 3653.900 3285.9 452870.0 4168.4
2019 -01 -07 NA 0.0077 ... 3583.700 3215.3 446690.0 4113.9
Note that the table above shows only some of the columns for just a few pairs (i.e. "tAAABBB", "tBTCUSD", etc). The dataset contains more than 270 trading pairs. One possible way of converting the candles is as follows:
●Create a list (or vector) all_pairs of all trading pair names. This can be done by selecting the SYMBOL column from the data, and then removing duplicates using function unique.
●Create an empty variable prices that will be used to assemble closing prices for all pairs.
●Run a loop for (pair in all_pairs), in which
1.Select TIMESTAMP and CLOSE columns from a subset for the pair and assign the result into a temporary table (e.g. call it temp).
2.Convert the result into class xts using CLOSE as data and order by
TIMESTAMP (see the commands in Task 3.1).
3.Add the result into the prices table using the cbind function:
●On finish, give names to columns: colnames(prices) <- all_pairs
In your report, you should print the dimensions of the resulting table using command dim(prices) and show the first 10 rows and randomly chosen 5 columns using the command:
3.3Convert prices to log-returns (5%)
If s(t) and s(t + 1) are the prices on two consecutive days, then the difference s(t + 1) · s(t) is called a return, while the difference of their logarithms is called log-return:
They represent price changes and are more interesting for analysis and forecasting than the prices themselves. Thus, in this task you have to convert the prices table into a table of their log_returns. This can be done by the following command:
Notice the use of as.matrix to preserve the precision of numerical operations as well as dates as the rownames. This allows us to convert the result into the timeseries format using as.xts, which uses dates in the rownames as time index. The problem is that the prices table has some data missing: notice the NA (‘not available’) entries in the prices table. This is because prices for some pairs were not available on certain dates in the original dataset (e.g. some pairs were not traded during some periods and no prices were recorded). Thus, before the log-returns can be computed, the NA entries must be filled in by some values. This
can be done in the following way:
1.Fill in the NA values by the last observations (i.e. most recent available prices). This is equivalent to assuming that the price remained the same rather than missing, and so log-return will be zero rather than NA.
2.In the cases when no more recent prices were observed (e.g. a pair was not traded before certain date), then fill in the NA values by the next observations. This means that log-returns will also be zero in this case rather than NA.
If the prices table is in the xts (timeseries) format, then both operations above can be performed by the function na.locf and using its argument fromLast to control the direction of the operations.
After filling in the NA values, convert the prices table into log_returns, as described above. In your report, you should print the dimensions of the resulting table using command dim(log_returns) and show the first 10 rows and randomly chosen 5 columns using the command:
In addition, include a couple of plots of log-returns for some of the pairs (e.g. those used in Task 3.1). For example, below is the plot of log-returns of tBTCUSD:
Presentation
Your report should be well presented. A good guide is the Publication Manual of the American Psychological Association (e.g. see http://www.apastyle.org/). At the very least, your report should be clear, typed or nicely hand-written doc- ument with good spelling, grammar and easy to understand English. There is no word limit, but a useful report should be just long enough to describe the work. A sensible limit is about 10 pages of typed text. Beyond this, you are probably being a bit too verbose. Tables, graphs, careful labelling and numbering are all well established and effective presentation tools.
Things to avoid are:
●Including images or diagrams that you did not create yourself or did not obtain the permission to use from the author (even if the image is from the Internet).
●Including graphs or diagrams that you do not describe in the text.
●Forgetting to label the axes on the charts.
●Using 3D charts to display 2D information.
●Including material irrelevant to the work.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做 program、代写 c++设计程...
2024-12-23
comp2012j 代写、代做 java 设...
2024-12-23
代做 data 编程、代写 python/...
2024-12-23
代做en.553.413-613 applied s...
2024-12-23
代做steady-state analvsis代做...
2024-12-23
代写photo essay of a deciduo...
2024-12-23
代写gpa analyzer调试c/c++语言
2024-12-23
代做comp 330 (fall 2024): as...
2024-12-23
代写pstat 160a fall 2024 - a...
2024-12-23
代做pstat 160a: stochastic p...
2024-12-23
代做7ssgn110 environmental d...
2024-12-23
代做compsci 4039 programming...
2024-12-23
代做lab exercise 8: dictiona...
2024-12-23
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!