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.  
"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 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...
Write a simple shell in C language and show some outputs.
Write a simple shell in C language and show some outputs.
I need the code in SAS and R and outputs please 2. The data below come...
I need the code in SAS and R and outputs please 2. The data below come from a study investigating a method of measuring body composition, and give the body fat percentage (% fat), age and sex for 18 adults aged between 23 and 61 years. Source: Mazess, R.B., Peppler, W.W., and Gibbons, M. (1984) Total body composition by dual-photon (153GD) absorptiometry. American Journal of Clinical Nutrition, 40, 834-839. age % fat sex 23 9.5 male 23 27.9 female 27...
Write RTL code to design a sequence generator which will generate the sequence : 0,0,1,0,1,1 and...
Write RTL code to design a sequence generator which will generate the sequence : 0,0,1,0,1,1 and repeat .  (FSM shouldn't be used in RTL) 
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT