Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
10857
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here Console.WriteLine("Hello, world!"); } } }#------------------------ WESTMINSTER INTERNATIONAL UNIVERSITY IN TASHKENT -----------------------# #-------------------------- INTRODUCTION TO STATISTICS AND DATA SCIENCE --------------------------# #------------------------------- PORTFOLIO OF INDIVIDUAL EXERCISES -------------------------------# ID <- # TO DO: <--- Insert your ID in front of the hash sign. Do not include the zeros (0's) in the beginning of your ID. # For example, if your ID is 00010200, then you need to enter your ID as 10200. # Failure to provide the ID results in 0 mark. # Some exercises require the student to insert his/her last 4 digits of ID as abcd. # A student with an ID of 0123 as the last four digits has the following values: a = 0, b = 1, c = 2, d = 3. # You only must provide the R code which will store the correct answer in the given variable names. DO NOT use rounding functions for your answers. # You can add additional rows before the answer line if you have more than one line of code. # But you must store the final code into the provided variable names for each task. # You can use any packages in R you want to solve these tasks. # DO NOT CHANGE THE VARIABLE NAMES (e.g. answer1, answer2, etc). We will only give full marks if your code provides the correct answer. # There is no partial credit for these tasks. #--------------------------------------PACKAGE INSTALLATION AND LOADING PART-----------------------# # Skip this part if you are only using the Base package of R. # If you use any packages other than the base package, # please add the installation and loading codes here #-------------------------------------END OF PACKAGE INSTALLATIONS AND LOADING---------------------# #------ TASK 1 -------# [5 marks] # Oriyat FM, a radio station, finds that the distribution of the lengths of time listeners # are tuned to the station follows the normal distribution. The mean of the # distribution is 3a.0 minutes and the standard deviation is 4.b minutes. What is the # probability that a particular listener will tune in between 3c.0 and 4d.0 minutes? answer1 <- NULL # TO DO: replace NULL with your correct code. #------ TASK 2 -------# [5 marks] # Light bulbs are tested for their life-span. It is found that (c+d+5)% of the light bulbs are rejected. # A random sample of 50 bulbs is taken from stock and tested. The random variable X is the number of bulbs that are rejected. # What is the probability that the value of X is at least 5? answer2 <- NULL # TO DO: replace NULL with your correct code. #------ TASK 3 -------# [5 marks] # It is estimated that 1825 of the callers to the Customer Service department of Dell Inc. will receive a busy signal per year. # Suppose the number of customers who receive a busy signal follows a Poisson distribution. Assume there are 365 days in a year. # What is the probability that at least (d+1) will receive a busy signal in a single day? answer3 <- NULL # TO DO: replace NULL with your correct code. #------ TASK 4 -------# [10 marks] # The closing price of Schnur Sporting Goods Inc. common stock is uniformly distributed # between $2c and $4d per share. # 1. What is the probability that the stock price will be less than $35? answer4_1 <- NULL # TO DO: replace NULL with your correct code. # 2. What is the probability that the stock price will be less than $35 if we know for sure it will be greater than 30? answer4_2 <- NULL # TO DO: replace NULL with your correct code. #------- TASK 5 -------# [5 marks] # The price of shares of Bank of America Corp at the end of each trading day for the last year # followed the normal distribution. Assume there were 240 trading days in the year. The # mean price was $3d.00 per share and the standard deviation was $2.ab per share. # What is the minimum share price for the top 15% of end-of-day trading prices? answer5 <- NULL # TO DO: replace NULL with your correct code. #------- TASK 6 -------# [12 marks] # Majesty Video Production Inc. wants the mean length of its advertisements to be 3c seconds. # Assume the distribution of ad length follows positively skewed distribution with a # population standard deviation of 2.d seconds. Suppose we select a sample of 36 ads # produced by Majesty. # 1. What is the standard error of the mean time? answer6_1 <- NULL # TO DO: replace NULL with your correct code. # 2. What percent of the sample means will be greater than 31.25 seconds? answer6_2 <- NULL # TO DO: replace NULL with your correct code. # 3. What is the length of advertisement (in seconds) on the 80th percentile? answer6_3 <- NULL # TO DO: replace NULL with your correct code. #------- TASK 7 -------# [9 marks] # Let's import a dataset using R's built-in data loading function (i.e., see ?data); # We will load the iris data set, which is a famous data set involving iris flower species. data(iris) # load the "iris" data.frame object into the current session head(iris) # provides the first 6 rows of this dataset. # 1. Count the number of observations in this dataset. answer7_1 <- NULL # TO DO: replace NULL with your correct code. # 2. Calculate the mean petal lengths of only the "setosa" flowers. answer7_2 <- NULL # TO DO: replace NULL with your correct code. # 3. Calculate the standard deviaton of sepal lengths of only the "virginica" flowers. answer7_3 <- NULL # TO DO: replace NULL with your correct code. #------- TASK 8 -------# [20 marks: questions 1 through 5 - 3 marks each, question 6 - 5 marks] # Let's import the Titanic data set, which is a famous data set involving passengers of Titanic Cruiseship. dat <- read.csv(url("https://web.stanford.edu/class/archive/cs/cs109/cs109.1166/stuff/titanic.csv")) # You can learn more about each variable from the following link: https://www.kaggle.com/c/titanic/data # by checking out the Data Library. # You can add exra rows if needed on top of each answer line, but your code which provides the final answer must # be provided in the provided answer lines. # If NAs are present in the dataset, they should be removed before answering the questions. head(dat) # you can see the first 6 rows of your Titanic dataset #1 Write the code that provides the percentage of female passengers who perished. answer8_1 <- NULL # TO DO: replace NULL with your correct code. #2 How many passengers aged 17 and below were perished in this disaster? answer8_2 <- NULL # TO DO: replace NULL with your correct code. #3 What percentage of passengers from 1st class have survived? answer8_3 <- NULL # TO DO: replace NULL with your correct code. #4 Calculate the average fare amount of the passengers who were males and were in the 3rd class. answer8_4 <- NULL # TO DO: replace NULL with your correct code. #5 Calculate the average fare amount of the adult passengers (aged 18 or above) who were in the 2nd class or were females. answer8_5 <- NULL # TO DO: replace NULL with your correct code. #6 Calculate the average age of those passengers who have a title of "Miss" in their names and do not have parents/children aboard. answer8_6 <- NULL # TO DO: replace NULL with your correct code. #------- TASK 9 -------# [10 marks] set.seed(1234) # TO DO: insert your last four digits instead of 1234. companies <- c("Kroger Co", "Cisco Systems", "WellsFargo & Co", "Bank of America Corp", "Norwegian Cruise Line Holdings Ltd", "Delta Air Lines Inc", "Pfizer Inc", "American Airlines Group Inc", "ConocoPhillips") rlist <- as.vector(sample(companies, 3)) # run these 4 lines of code ONLY ONCE to get random three company names. cat("Your company list:", rlist, sep = " ") # this line of code prints the names of 3 companies that you use for your plot. # For this task, you need to randomly select 3 companies out of the company list provided above. # Then, import stock price data from Yahoo Finance (finance.yahoo. com) for each of three companies from Jan c, 2016 to Feb d, 2021 (c, d - your ID values). # Hint: you can either use Quantmod package or manually download from Yahoo Finance for each stock and import to R Studio) # Convert the daily stock data to Weekly data (only last trading day of each week will be stored) and plot a line graph showing all three stock prices in one plot. # Use the column for Close Price in y axis of your graph and use three different colors for the lines. # Use ylim option to make sure all 3 lines are visible in your plot for the whole period. # Use legend option to place a legend on an empty spot of your graph. #------- TASK 10 -------# [10 marks] # Create a function named "refer_list" which takes a dataframe as an argument and prints only the ids whose marks are lower than 40. # For example, if we pass the following dataframe, "students" as shown below, as an argument into the "refer_list" function, # the function must print the following ID's: 6234, 5786. The data type of the output is not important. # If we make any change to the "students" data frame, your function should still work properly with the new data. students <- data.frame("id" = c(6234, 6235, 5786, 5250), "mark" = c(38, 55, 20, 44)) refer_list <- NULL # TO DO: fill in the code to create the function # TO DO: <--- Your code goes here #------- TASK 11 -------# [6 marks] # The following paragraph consists of some meaningful statements. But some of the letters were replaced with characters. # Your task is to replace those characters programmatically to the appropriate letters and provide the final meaningful statement. # Please pay attention to upper/lower cases. statement <- "!;, [SDS t;+m, h~p; th+t }~u ;nj~};d }~ur ;x;rcis;s +nd w;r; +bl; t~ c~mpl;t; th;m ~n tim;. Pl;+s; s+v; }~ur fil; in R ;xt;nsi~n +nd d~ n~t f~rg;t t~ r;n+m; th; fil; with }~ur ~wn [D. [t is tim; t~ h+v; + g~~d r;st +nd c~m; t~ }~ur cl+ss;s with fr;sh mind. S;; }~u n;xt tim; in th; cl+ss." # TO DO: Add more rows here if needed. answer11 <- NULL # TO DO: Use R code to replace these characters with correct letters and save your final statement in the "answer11". #------- TASK 12 -------# [3 marks] # Provide your constructive feedback with few sentences about ISDS module. Use the print() function to provide your feedback :). # TO DO: Your feedback should be printed using print() function. #-------------------------------------------------------------- END OF TASKS --------------------------------------------------------------------------------# #--------------------------------------------------------------- GOOD LUCK!----------------------------------------------------------------------------------#
run
|
edit
|
history
|
help
0
Reward
concurrentStack
any predicate test
Huffman Algorithm
Ship! Wall
Int number to String Array
sdfghjkilujyht
Plt-D v.0.9
Examples of JS-Like higher-order functions in C#
File_operations