Critical value and establishing significance

Assignment Help Other Subject
Reference no: EM132812550

Instruction

Your task in this coursework is to write a C++ program to analyse an fMRI time course to determine whether it is significantly activated using permutation testing. This program should perform the following main steps:

Question 1. Load the measured time course data from file;

Question 2. Determine the size of the blocks used in the task (i.e. how many samples correspond to a ‘rest' or ‘task' period);

Question 3. Compute the expected time course signal;

Question 4. Compute the correlation coefficient between the expected time course (generated in step 3) and measured time course (as loaded in step 1);

Question 5. Generate 5000 new time courses signals by random permutations of the measured signal (as loaded in step 1). For each of these signals, compute the correlation coefficient between it and the expected time course (as generated in step 3);

Question 6. Display a histogram of the 5,000 correlation coefficients computed in step 5;

Question 7. Estimate the critical value for statistical significance at the p = 0.05 level;

Question 8. Determine whether the observed correlation coefficient (as computed in step 4) exceeds the critical value (computed in step 7), and report whether the correlation is statistically significant.

Loading the data and determining the block size

You are provided with 4 data files, consisting of a list of values stored as plain text, one per line. These data files were produced from 2 different experiments with different parameters, leading to differences in the number of sample points (64 vs. 128) and differences in the block size (8 vs. 16). The block size information is encoded in the filename, after the final underscore (‘ '); e.g. for the file exp1_roi1_8.txt a block size of 8 samples was used. Your program should load the full time course in each case and determine the block size from the filename, and should be able to cope with any number of sample points or block size.

For each of the two experiments, two time courses are provided, estimated from different regions of interest (ROI). You should observe a significant correlation for ROI 1, but not for ROI 2.

Computing the expected time course signal

The expected time course signal should look like the red curves in figure2. For a block size of n sample points, the expected signal consists of a ‘block' of n zeros, followed by a ‘block' of n ones, and another ‘block' of n zeros, and so on until the end of the time course. The expected signal is expected to always start with a ‘rest' (zero) block. The total number of sample points in the time course should match the number in the measured time course.

Computing the correlation coefficient

You should compute the absolute value of thePearson correlation coefficient |r|, which can be computed efficiently for two equal-sized arrays of values x = {xi} and y = {yi} using the following
formula:

r = n Σxiyi -ΣxiΣyi/√nΣxi2-Σxi2(Σxi)2 √nΣyi2 - (Σyi)2

Remember to take the absolute value of the correlation coefficient: no effect implies a correlation coefficient of zero; we are interested in any non-zero correlation, whether positive or negative.

Permutations

Random permutations of the array of measured data values can be performed using the standard C++ function std::random shuffle(). This function can be used with an STL std::vector as follows:

# include <algorithm > 1
... 2
std :: vector <double > x; 3
... 4
std :: random_shuffle (x. begin () , x.end ()); 5

Note that this function performs the reordering in-place: the values in the original vector will be reordered, and the original ordering will be lost. If you need to keep the original vector intact, make a copy of it first and apply std::random_shuffle to that copy.
Displaying the histogram

The 5,000 correlation coefficients estimated from permuted data should be displayed as a horizontal histogram, as shown in the example listing below. Your code should divide up the desired range of values (defined by the min & max value) into the desired number of bins, and then count how many values fall within each bin. Your program should then display the histogram by printing each bin of the histogram on its own line, displayed as a sequence of some character (you can use the character = or # for this) of length given by the count.

Ideally, the count should be scaled to ensure the histogram can fit on the terminal within a display width of 80 characters (based on the maximum count). It should also display the value of the centre of each bin on the left of the histogram, on the same line as the corresponding bin. Your code should be capable of handling any number of bins, defined over any interval. For the purposes of this assignment, you should use 25 bins arranged over the interval [0, 1] (as shown in the example below).

Estimating the critical value and establishing significance

The critical value corresponds to the 95th percentile of the values in the null distribution. You can obtain an estimate of this value by first sorting your array of correlation coefficients, and then looking up the value of the element whose index is closest to 95% of the size of the array (e.g. for a sorted array x of size 1,000, the 95th percentile is x[950]).

You may find the std::sort() function useful here, which can be used with an STL std::vector as follows:

# include <algorithm >
...
std :: vector <double > x;
...
std :: sort (x. begin () , x.end ());

Reporting Requirements

You should submit a C++ project that meets as many of the requirements as possible. You do not need to submit any written report but do try to use variable/function naming, comments and indentation to make your program as easy to understand as possible. Also try to make your program as resilient to runtime errors as possible.

Attachment:- Permutation testing.rar

Reference no: EM132812550

Questions Cloud

What is the cost per container for super clean dish-washing : During December 2019, the company produced 140,000 litres of Super Clean mixture. What is the cost per container for Super Clean dish-washing liquid
What type of research study design would you use to address : Consider a patient-centered issue you have observed recently. Formulate a research question related to that issue. Identify the independent and dependent.
What is strategic leadership : What is Strategic Leadership? What is Operational Leadership? What is Tactical Leadership? Offer An analogy of the three levels of leadership.
Explain how the gain on residential property is calculated : Explain how the gain on residential property is calculated if the property has not always been the taxpayer's main residence and during some periods
Critical value and establishing significance : Compute the expected time course signal - Compute the correlation coefficient between the expected time course (generated in step 3) and measured time course
Discuss about a selected nursing theory : Select a Nursing Theory that closely aligns with your current practice or personal viewpoint. Reflect why you chose your theory and how it applies to your.
Changing nature of business in a global economy : Explain in detail the changing nature of business in a global economy.
Find the net present value for caspian sea drinks : Find the net present value for Caspian Sea Drinks. The expansion of the plant and the purchase of the equipment necessary to produce
What is central repository : Kindly help me provide answers to the following seven questions. The professor gave this link

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd