Question

In: Statistics and Probability

Write a R-script to (and show the outputs of your code) (a) Create a sequence of...

Write a R-script to (and show the outputs of your code)

(a) Create a sequence of numbers starting at 3.5 and ending at 10.7 with increments of 0.79. Find the variance and mean of those numbers. And finally sort the vector in a decreasing manner

(b) Create a 3 different 3 by 3 matrices such that each of the numbers 1,2,...,9 appear exactly once (Sudoku style) in each of the matrices.

Solutions

Expert Solution

(a)

vector <- seq(3.5, 10.7, by = 0.79)
mean(vector) #Ans: 7.055
var(vector) #Ans: 5.720917
sort(vector, decreasing = T) #Ans: 10.61 9.82 9.03 8.24 7.45 6.66 5.87 5.08 4.29 3.50

(b)

library(sudoku)

#Generate Sudoku: 1
set.seed(1)
sudoku1 <- generateSudoku(Nblank = 0, print.it = T)

#Generate Sudoku: 2
set.seed(2)
sudoku1 <- generateSudoku(Nblank = 0, print.it = T)

#Generate Sudoku: 3
set.seed(3)
sudoku1 <- generateSudoku(Nblank = 0, print.it = T)

**If this answers do not match or any kind of confusion you have please comment


Related Solutions

Use the R script to answer the following questions: (write down your answers in the R...
Use the R script to answer the following questions: (write down your answers in the R script with ##) (1). Import FarmSize.csv to Rstudio. Use the correct function to build a linear regression model predicting the average size of a farm by the number of farms; Give the model a name (e.g. FarmSize_Model). Call the model name to inspect the intercept and slope of the regression model. Verify the answers in your manual calculation. (2). Use the correct function to...
Use the R script to answer the following questions: (write down your answers in the R...
Use the R script to answer the following questions: (write down your answers in the R script with ##) (1). Import FarmSize.csv to Rstudio. Use the correct function to build a linear regression model predicting the average size of a farm by the number of farms; Give the model a name (e.g. FarmSize_Model). Call the model name to inspect the intercept and slope of the regression model. Verify the answers in your manual calculation. (2). Use the correct function to...
Please show screenshot outputs and fully functional code for the Java program. Write the following methods...
Please show screenshot outputs and fully functional code for the Java program. Write the following methods to   1) read the content of an array of 5 doubles public static double[] readingArray() 2) find and print:the smallest element in an array of 5 double public static void smallest(double [] array) 3) find and print:the largest element in an array of 5 doubles pubic static void largest (double [] array) In the main method - invoke readingArray and enter the following numbers...
Write an R Script that does the following for "sampleData1.dta"
Write an R Script that does the following for "sampleData1.dta" a) Regress "earn," "adcc," and "tinc" on a constant. b) Regress earnings on "higrade," "age," and "agesq." Display TSS, RSS, ESS and R Squared Value c) Reestimate the regression from pt. b, this time omitting the constant term.  
Show what occurs with the control hazards in the following code sequence. Using forwarding. Write out...
Show what occurs with the control hazards in the following code sequence. Using forwarding. Write out the instructions one at a time, not every instruction is executed, pay attention to following which instruction is fetched, the order is not in sequence. Assume Taken. J label A Add r1, r2, r3 Add r4, r5, r6 Add r7, r8, r9 Add r10, r11, r12 Add r13, r14, r15 Label B Add r16, r7, r18 Add r19, r20, r21 J end Add r22,...
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G,...
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Assume simonPattern and userPattern are always the same length. Ex: The following patterns yield a userScore of 4: simonPattern: RRGBRYYBGY userPattern: RRGBBRYBGY #include <stdio.h>...
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G,...
"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares the two strings starting from index 0. For each match, add one point to userScore. Upon a mismatch, exit the loop using a break statement. Ex: The following patterns yield a userScore of 4: simonPattern: RRGBRYYBGY userPattern: RRGBBRYBGY
) Write queries for the following. Include screenshots of the queries and the outputs. Create a...
) Write queries for the following. Include screenshots of the queries and the outputs. Create a procedure named DisplayInfo which takes customer name as a parameter and displays information of that customer. (database – sql_store)
Write a simple shell in C language and show some outputs.
Write a simple shell in C language and show some outputs.
WRITE CODE IN JAVA it is now your turn to create a program of your choosing....
WRITE CODE IN JAVA it is now your turn to create a program of your choosing. If you are not sure where to begin, think of a task that you repeat often in your major that would benefit from a program. For example, chemistry unit conversions, finding the area for geometric shapes, etc. You can also create an interactive story that changes based on the user input/decisions. The possibilities are endless. The program must include instructions for the user. Be...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT