Question

In: Computer Science

Using R: write a program that finds the standard deviation between each column. Find the average...

Using R: write a program that finds the standard deviation between each column. Find the average standard deviation for Set A and B, and then use that average to guess the next (fifth) column. Set A: 2, 5, 7, 8 Set B: 2, 3, 6, 9

Solutions

Expert Solution

In R, we need to comine the two vectors in a 2D vector using rbind. Then get the sd for each column.

Then calculate the average sd from the values.

Then in order to generate next column values, we require mean, and sd values for function rnorm().

For mean we get the trend of means from the given series and decide a mean that follows that progression.

Finally generate the next column:

CODE:

library(matrixStats)
A<- c(2, 5, 7, 8)
B<- c(2, 3, 6, 9)
C <- rbind(A,B)
#displaying C
C

#finding SDs per column
col_sd <- colSds(C)
col_sd
#getting average sd from col_sd
avg_sd = round(mean(col_sd))
avg_sd

#means of the columns to get next mean:
col_mean <- colMeans(C)
col_mean

#taking mean as 11 for next numbers and sd as avg_sd:
next_col <- ceiling(rnorm(2,mean=11,sd=avg_sd))
next_col

OUTPUT:


Related Solutions

*****Using Java Write a program that finds the standard deviation while also using a graphical user...
*****Using Java Write a program that finds the standard deviation while also using a graphical user interface.
Write a program, using C#, windows forms, that will find the mean and standard deviation of...
Write a program, using C#, windows forms, that will find the mean and standard deviation of a number of data points. The ONE PROGRAM should allow the user to enter data manually OR via a text file. The program should be very easy to use. I will also need a step by step how to set up window for the answer. Please and thank you!!
Part 1: Write a program that finds the sum and average of a series of numbers...
Part 1: Write a program that finds the sum and average of a series of numbers entered by the user. The program will first ask the user how many numbers there are. It then prompts the user for each of the numbers in turn and prints out the sum, average, the list of number from the user. Note: the average should always be a float, even if the user inputs are all ints. Part 2: Same as part 1 except...
Write a C++ program that reads in a table of numbers and finds out the average...
Write a C++ program that reads in a table of numbers and finds out the average of each row and column. This program should first take two numbers as number of rows and columns as input from the user
Find the average return and standard deviation of an equal-weighted (1/3 in each) portfolio consisting of...
Find the average return and standard deviation of an equal-weighted (1/3 in each) portfolio consisting of the three stocks. Explain how a portfolio’s standard deviation can be lower than any of the three stock’s standard deviations that make up that portfolio. Year LAX return UWL return WIS return 2013 5% 2% 10% 2014 10% 4% 12% 2015 -3% 3% 8% 2016 12% -2% 9% 2017 1% 5% 15%
write C++ program using functions (separate function for each bottom) Write a program to find if...
write C++ program using functions (separate function for each bottom) Write a program to find if a number is large word for two given bottom base - bottom1 and bottom2. You can predict that a number, when converted to any given base shall not exceed 10 digits. . the program should ask from user to enter a number that it should ask to enter the base ranging from 2 to 16 after that it should check if the number is...
The average GPA at a college is 2.73 with a standard deviation of 0.8. Find the...
The average GPA at a college is 2.73 with a standard deviation of 0.8. Find the probability that 10 randomly selected students will have an average GPA greater than 2.37
Using NumPy etc. How to calculate a population mean and population standard deviation of a column...
Using NumPy etc. How to calculate a population mean and population standard deviation of a column with values. Also, how to calculate the range of values around the mean that includes 95% confidence interval of values within the column.
Using the data in the following array write a program that finds and outputs the highest...
Using the data in the following array write a program that finds and outputs the highest value, the lowest value, the count of elements in the array, the average value in the array, and the mode - the value that appears most often. dataArray = {173.4, 873.7, 783.9. 000.0, -383.5, 229.5, -345.5, 645.5, 873.7, 591.2};
What is the difference between standard deviation and average deviation? Which calculation is more useful for...
What is the difference between standard deviation and average deviation? Which calculation is more useful for determining if a data point can be omitted from a data set?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT