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 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...
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%
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
Q18. // This program finds the average time spent programming by a student // each day...
Q18. // This program finds the average time spent programming by a student // each day over a three day period. // PLACE YOUR NAME HERE #include using namespace std; int main() { int numStudents; float numHours, total, average; int student, day = 0; // these are the counters for the loops cout << "This program will find the average number of hours a day" << " that a student spent programming over a long weekend\n\n"; cout << "How many...
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.
Write a Java program using using WHILE loop to find the sum of all integers between...
Write a Java program using using WHILE loop to find the sum of all integers between 200 to 250 which are divisible by 7. Sample Output: Numbers between 200 and 250, divisible by 7: 203 210 217 224 231 238 245 The sum is: 1568
write a program that finds the average of all positive, non-zero values found in a given...
write a program that finds the average of all positive, non-zero values found in a given array of doubles and prints that to the console. Any negative or zero values do not contribute to the average. The program should use the array provided in the code, and you may assume that it has already been populated with values. The results should be printed out to the console in the following format: “Average: ”<<average value>> Values denoted in “<< >>” represent...
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?
Write a program that finds and prints all of the prime numbers between 3 and X...
Write a program that finds and prints all of the prime numbers between 3 and X (X is input from the user). A prime number is a number such that 1 and itself are the only numbers that evenly divide it (for example, 3, 5, 7, 11, 13, 17, …). One way to solve this problem is to use a doubly nested loop (a loop inside another loop). The outer loop can iterate from 3 to N while the inner...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT