Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Programming Assignment for BIO337 Module

Sub-setting/indexing methods for a vector

This assignment accounts for 30% of the BIO337 module marks. Your submission should include the R code solutions to the questions. While it is most important that your code gives the correct answers and produces the right outputs, the readability of your code (structure, layout, indentation) and its efficiency will also be taken into account in awarding marks. Please put all your R code into a single R script (text) file, using appropriate comments, where needed, to label, describe, and address the questions. Your R script file and all the output files from your script should be packed into a single zip file and submitted to the Dropbox in the “CourseworkAssignment 1” folder of the Assessment section on Blackboard by 23:59 Sunday 8 November 2020.

Question 1 : Please describe (with examples and R code): How to extract a subset of elements from vector(s) using the following sub-setting/indexing methods: (a) The index is a vector of logical values. (b) The index is a vector of positive numbers. (c) The index is a vector of negative numbers. (d) The index is a vector of character strings.

Question 2 : What is a prime number? Write an R function to test if a given integer is a prime number. Test your written function with a couple of examples to show that it gives the correct results.

Question 3 : Write an R program to demonstrate that Goldbach's conjecture is true for all the even numbers between 6 and 500 inclusive. Goldbach's conjecture states that Every even integer greater than 2 can be expressed as the sum of two prime numbers. For example: 10 = 3 + 7, where both 3 and 7 are prime numbers. In this particular example, by showing that 10 equals the sum of 3 and 7, where both 3 and 7 are prime numbers, you demonstrated that Goldbach’s conjecture is true for this even number 10. This exercise requires you to demonstrate that Goldbach's conjecture is true for all the even numbers between 6 and 500.

Question 4 : The file “GSE4922-GPL96_log2Mas5Sc500-N17.tab” is a tab delimited text file, which contains the gene expression data for 17 breast cancer patients. Each patient has a unique ID, which is a string starting with “GSM” followed by some digits. Each row in that file corresponds to a gene (represented by a ProbeSetID). These 17 patients belong to three different groups: Control, Treatment1, and Treatment2, with their group memberships specified in another tab delimited text file “Patient-Groups-N17.tab”.

Read in the data from the two input files above. Then, for each ProbeSetID:

(a) Calculate the mean expression values of the three groups;

(b) Calculate the difference in mean expression between Treatment1 and Control groups;

(c) Calculate the difference in mean expression between Treatment2 and Control groups; Output the results to a text file, which should be in the following format. It should be a tabdelimited tabular text file, with a header row giving the column names as follows:

Question 5 : Suppose x is a vector of numerical values recording a random sample of observations from a normal population with unknown mean and unknown variance. y is a vector of numerical values recording another independent random sample of observations from a normal population with an unknown mean, but with the same unknown variance as above.

Write R function(s) to carry out Two-sample T-test applicable to the two samples x and y

mentioned above. The input parameters (arguments) to this function should include: x, y, the hypothesized mean difference delta0, and an option indicating which p-value, left-tailed, righttailed or two-tailed is calculated. The returned object should be a list including the following information: The sample sizes and sample means for both samples, the t-statistic and its degree of freedom, and the appropriate p-value.

Question 6 : Using the gene expression data “GSE4922-GPL96_log2Mas5Sc500- N17.tab” and patient grouping data “Patient-Groups-N17.tab” described above. Apply the Two-sample t test function(s) written above to all the ProbeSetIDs (genes) individually (comparing the control patient group and treatment 1 patient group) with the following null hypothesis and alternative hypothesis:

support
close