**DTI data processing**

- Data preparation
- Convert dicom files to nifti
- Use
**dcm2nii**or**dcm2niigui**from mricron

- Use
- Rename files using the following scheme:
- dti.nii – for DTI images
- dti.bval – for the bval file
- dti.bvec – for the bvec file
- anat.nii – for T1 anatomical file

- create a text file listing the directories containing the DTI files, one directory per subject (e.g., dirlist.txt)

- Convert dicom files to nifti

- Preprocess DTI datasets
- Script:
**fn_dtipreproc.sh <dirlist> <TBSSdir>** - <dirlist> – text file containing directory list (see 1.c)
- <TBSSdir> – optional, directory where output will be saved, default value is tbss in the current directory, will be created by the script if doesn’t exist
- The script performs the following operation
- Correct for effects of movement and eddy current by running
**eddy_current**- Output is dti_ecc.nii.gz
- Assumed first volume in dti.nii is the B0 volume

- Extract B0 volume from dti.nii using
**fslroi**- Output is dti_nodif.nii.gz
- Assumed B0 is first volume in dti.nii

- Create brain mask using
**bet**and B0 image- Output is dti_nodif_brain.nii.gz – extracted brain (betted), dti_nodif_brain_mask.nii.gz – binarized extracted brain

- Fit the diffusion tensor model to the data using dtifit and the dti_ecc image
- Output files has dti prefix and stored in the same location as the original image
- dti_V1, _V2, _V3 – 1
^{st}, 2^{nd}, and 3^{rd}eigenvectors - dti_L1, _L2, _L3 – 1
^{st}, 2^{nd}, and 3^{rd}eigenvalues - dti_MD – mean diffusivity
- dti_FA – fractional anisotrophy
- dti_MO – mode of anisotrophy (oblate: ~-1, isotrophic: ~0, prolate: ~1)
- dti_SO – raw T2 signal without diffusion weighting

- dti_V1, _V2, _V3 – 1

- Output files has dti prefix and stored in the same location as the original image
- Copy dti_FA.nii.gz to the TBSS directory (see 2.c) and renamed it as <subjdir>_FA.nii.gz, where <subjdir> is the subject directory
- After processing all subjects’ data, the script runs the following commands in the TBSS directory
- tbss_1_preproc *.nii.gz
- prepare FA data in the right format

- tbss_2_reg -T
- apply nonlinear registration of all FA images into 1x1x1 standard space
- -T : target is FMRIB58_FA

- tbss_3_postreg -S
- create mean FA and skeletonized it
- -S : use derived mean from subjects’ data

- tbss_4_prestats 0.2
- project all subjects’ FA onto the mean FA skeleton

- tbss_1_preproc *.nii.gz

- Correct for effects of movement and eddy current by running
- references

- Script:

- TBSS analysis (tract-based spatial statistics)
- Do two-sample t-test using randomise
- Change directory to <TBSSdir>/stats
[user]

**cd <TBSSdir>/stats** - Generate design matrix and contrast using design_ttest2 for simple model
[user]

**design_ttest2 <outputname> <N1> <N2>**- This will output
*<outputname>.mat*and*<outputname>.con*, which you will need in**randomise** *<N1>*is the number of participants in group 1*<N2>*is the number of participants in group 2- Make sure that you have the correct order by running
**imglob**to check what group is listed first[user]

**imglob ../origdata/*.nii.gz**

- This will output
- Run randomise
[user]

**randomise -i all_FA_skeletonised -o tbss -m mean_FA_skeleton_mask -d <outputname>.mat -t <outputname>.con -n 5000 --T2**- this will output several files with “tbss_” prefix
- of interest is the file named tbss_tfce_corrp_tstat*.nii.gz, which are the TFCE corrected p-value image

- Check results

- Change directory to <TBSSdir>/stats

- Do two-sample t-test using randomise

- Run bedpostx – fitting probabilistic diffusion model on corrected data
- Script:
**fn_bedpostx.sh <dirlist>** - <dirlist> – a text file containing directory list (see 1.c)
- This script performs the following operation
- Create tracto/ directory in the subject directory as output location
- Copies relevant files from subject directory to tracto directory
- nii.gz to data.nii.gz
- bval to bvals
- bvec to bvecs
- nii.gz to nodif_brain.nii.gz
- nii.gz to nodif_brain_mask.nii.gz

- Creates condor job description and save it in <dirlist>_bedpostx.job
- Submits job to condor for processing
- Output will be in the subject directory tracto.bedpostX

- Script:

- Register DTI images to standard MNI space/template
- Script:
**fn_dtiregister.sh <dirlist>** - <dirlist> – a text file containing directory list (see 1.c)
- Output will be in the bedpost directory, i.e., tracto.bedpostX/xfms
- Linear
- DTI -> structural: diff2str.mat
- Structural -> DTI: str2diff.mat
- Structural -> standard: str2standard.mat
- Standard -> structural: standard2str.mat
- DTI -> standard: diff2standard.mat
- Standard -> DTI: standard2diff.mat

- Nonlinear
- Structural -> standard: str2standard_warp.nii.gz
- Standard -> structural: standard2str_warp.nii.gz
- DTI -> standard: diff2standard_warp.nii.gz
- Standard -> DTI: standard2diff_warp.nii.gz

- Linear
- NOTE: be sure to check ranat_brain.nii.gz if bet is working properly. If not, you may need to run bet manually.

- Script:

After step 5, you’re ready to run probabilistic tractography. Just run Fdt and enter the needed parameters in the GUI.

]]>

Applications:

- J. Paul Hamilton, Gary H. Glover, Epifanio Bagarinao, Catie Chang, Sean Mackey, Matthew D. Sacchet, Ian H. Gotlib, Effects of salience-network-node neurofeedback training on affective biases in major depressive disorder, Psychiatry Research: Neuroimaging, 2016, doi: 10.1016/j.pscychresns.2016.01.016
- Megan deBettencourt, Jonathan Cohen, Ray Lee, Kenneth Norman, Nicholas Turk-Brownie, Closed-loop training of attention with real-time brain imaging, Nature Neuroscience 18, 470-475, 2015
- J Yoo, et al., When the brain is prepared to learn: Enhancing human learning with real-time fMRI, Neuroimage 59, 846-852, 2012
- Leena Subramanian, et al., Real-time functional magnetic resonance imaging neurofeedback for treatment of Parkinson’s disease, J. Neuroscience 31, 16309-16317, 2011

Reviews:

- J Sulzer, S Haller, et al., Real-time fMRI neurofeedback: Progress and challenges, Neuroimage 76, 386-399, 2013
- Heather Chapin, Epifanio Bagarinao, and Sean Mackey, Real-time fMRI applied to pain management, Neuroscience Letters 520, 174-181, 2012 doi:10.1016/j.neulet.2012.02.076
- Epifanio Bagarinao, Toshiharu Nakai, and Yoshio Tanaka, Real-Time Functional MRI: Development and Emerging Applications, Magn Reson Med Sci 5, 157-165, 2006

Methods/System:

- Sebastian Baecke, et al, A proof-of-principle study of multi-site real-time functional imaging at 3T and 7T: Implementation and validation, Scientific Reports 5, 1-8, 2015
- Vadim Zotev, Raquel Phillips, Han Yuan, Masaya Mizaki, and Jerzy Bodurka, Self-regulation of human brain activity using simultaneous real-time fMRI and EEG neurofeedback, Neuroimage 85, 985-995, 2014

**Search and replace**

- :s/foo/bar/g – change ‘foo’ to ‘bar’ in the current line
- :%s/foo/bar/g – change ‘foo’ to ‘bar’ in all lines

**Cut and paste**

- position cursor where you want to begin cutting
- press ‘v’ (upper ‘V’ to cut whole lines)
- move cursor to end of selection
- press ‘d’ to cut, or ‘y’ to copy
- move cursor to where you would like to paste
- press ‘P’ to paste before cursor, or ‘p’ to paste after

That’s all!

]]>

To create your own wordle, you can visit SciVerse Hub homepage, look for the Author Wordle application (located in the lower right corner of the page), and click the Create Wordle button. You can then enter your name and click the search button. It will give you a list of authors and their corresponding affiliation. Click your name from the list and the app will automatically generate your own research wordle. You can customize the font, layout, color scheme, and even remove some of the irrelevant words in the resulting wordle image. You can also use the generated images however you like, such as print them out, use them in t-shirts, share with friends, or place them in your website as a visual summary of your research.

Have fun! Here’s what mine looks like.

]]>Re-posting this one from my old university website. A brief introduction of my graduate research topic.

Studies in nonlinear time series analysis have provided reliable techniques for the evaluation of signals from dynamical systems. Some of these techniques are used to gain insights into the unknown physical processes, to do prediction, as well as to determine invariants associated to the dynamics of the system. Others are employed to determine whether irregularities in signals are due to the intrinsic nonlinearity of the system or are caused by extrinsic random processes impinging on the system. Several others are applied to build models capturing the dynamics of the system from the observed data. In this study, new methods to uncover the underlying mechanisms of dynamical systems using time series are introduced. This set of algorithms can be used to evaluate how sensitive the system is to the values of its parameters and how the system’s behavior changes as the parameters are varied. Since these issues are best explored by means of **bifurcation diagrams** (BDs), this work describes the algorithms in constructing BDs from time series.

Extracting physically interesting and useful information from the observed data is the primary goal of time series analysis. Nonlinear time series analysis has particularly provided additional tools for the characterization of irregular, broadband signals that are products of nonlinear dynamical systems. Without these tools, these signals are incomprehensible observations rather than vital sources of physically interesting information. Since these signals are prevalent in nature, their evaluation is very important and relevant. A few examples include the electrical activities within the brain, the beating of the heart, the spiking of neurons, the spread of epidemics, the swings in animal populations, and the changes in global climate. The analyses of these signals can be loosely grouped into: 1) the reconstruction and quantification of attractors, and 2) model-building and prediction, which includes parameter estimation using time series.

Dissipative systems are typically characterized by the presence of attracting sets or **attractors **in the phase space. An attractor is a bounded subregion of the phase space of a dynamical system to where regions of initial conditions of nonzero volumes eventually converge with increasing time. It can be a point in the phase space, of dimension equal to 0, or a closed curve, of dimension equal to 1. Some other attracting sets can be very irregular and in fact, can have a dimension which is not an integer value. Such sets are called **fractals**, and when they are attractors they are referred to as strange attractors. Strange attractors can be characterized by a spectrum of dimension values such as **box-counting dimension**, **information dimension**, and **correlation dimension**. The motion on a strange attractor can also display **sensitivity to initial conditions** such that the distance between neighboring points on the attractor can grow exponentially with time. This motion is referred to as being **chaotic**. The existence of chaos means that small errors grow exponentially in time that long term prediction becomes impossible. A quantitative description of the sensitivity to initial condition is provided by the **Lyapunov exponents**, quantities characterizing the stretching of infinitesimal displacements in a strange attractor.

The reconstruction of attractors by **delay embedding** and their quantification in terms of dimensions, Lyapunov exponents, among other attractor invariants have yielded means of revealing intrinsic nonlinear behavior of a dynamical system from time series. For example, the presence of a positive Lyapunov exponent or a fractional value of the attractor’s dimension affirms the nonlinear nature of the system. These invariants can also be used to identify systems in a manner similar to natural frequencies of some physical systems. These quantities, however, do not give a complete description of the dynamics *per se* and thus, a different set of methods is required.

On the other hand, the goal of model-building is to construct a template of the dynamics using the observed data. Loosely speaking, this can be done by obtaining an appropriate set of coefficients in a predetermined class of functional forms such that the resulting function captures the dynamics of the system under study. The model is used either to represent the global behavior of the observed data or to describe the local dynamics in the reconstructed attractor or a mixture of both. The use of nonlinear autoregressive models, the measure-based functional reconstruction of Giona, radial basis functions, and neural networks are among the many functions that represent global models describing the dynamics in the whole phase-space. On the other hand, local linear maps using neighboring points, local averaging, and the use of higher-order polynomials whose coefficients are fitted using near neighbors are just a few of the many local modeling approaches. The effectiveness of the model is measured by its **prediction performance**, defined as the ability of the model to give accurate values at steps forward in time.

The description of dynamical systems in terms of invariants or sets of coefficients in a predetermined class of functions is already sufficient to solve many significant problems. However, these invariants, though they remain constant with coordinate transformation, are not robust to changes in system parameters. Model coefficients also vary from one observation to another when observations are taken at different parameter values. Thus, problems that involve changes in parameters require a broader framework than the above description. This framework is provided by the study of **bifurcations**. A bifurcation is a qualitative change in the dynamics, for example from a stable behavior to an unstable behavior, which occurs as a system parameter varies. The knowledge of the bifurcation structure of a dynamical system is therefore important in order to understand the system’s response to the changes in parameter values. This is particularly necessary for the case of nonlinear systems where small perturbations, for parameter values near critical points, can cause dramatic changes in the system’s output. The study of bifurcations from time series, however, has received less attention in the past years. It is only recently that this problem is addressed rigorously. The problem is that the analysis requires *a priori* knowledge of the dynamics in the form of differential or difference equations that can prove difficult to construct even for simple systems. This makes the problem of reconstructing bifurcation structures from time series a formidable task.

In this research, a new and equally important theme in nonlinear time series analysis, **the study of bifurcations**, is introduced. The tools developed can be used to analyze time series measured at different parameter values. The motivation of the study is to unveil the bifurcation structure of the system using the observed data. In particular, the study aims to: 1) know the sequence of bifurcations that the system undergoes as the parameters are changed; and 2) uncover behaviors of the system, which may be present but not readily observed. To achieve these goals, the problem of reconstructing bifurcation diagrams is systematically investigated. Methods to obtain qualitatively the same BD as that of the given system using time series at a finite number of parameter values are presented. The reconstruction does not assume any knowledge of the explicit form of the dynamical system (differential/difference equation). Instead, time series at different parameter values are used to obtain a suitable family of predictor functions, which exhibits qualitatively similar bifurcations as the given system. The BD of this family of predictor functions on some parameter region, termed as **projection region**, is then regarded as the reconstructed BD. In other words, the projection region is the region in the parameter space of the model with similar bifurcation structure as the system. For parameter values within this region, the dynamics of the model is therefore the same as that of the given system. Thus, one can take the BD of the model in this region as the reconstructed BD. The problem therefore is to determine the projection region using parameter values computed from the available time series.

For functional MRI, it is not uncommon to store the dataset in a single 4D (3D space + time) Nifti file, especially when experiments involved several hundreds of image volumes. Just imagine the convenience of working with a single file as compared to several hundreds of files. However, there are also instances when it is convenient to manipulate datasets one volume at a time. In this case, having a single volume stored in a single file is very handy.

In this post, I will outline a simple Matlab script that can be used to extract the 3D images from the 4D NifTI file. The script uses some SPM functions such as *spm_select()*, *spm_vol()*, *spm_read_vols()*, and *spm_write_vol()*. Type “help function_name” in Matlab for a description of each function. Be sure that SPM is in Matla’s path before using this script. Without further ado, here is the full function list:

function abk_4Dto3D(fname) % function abk_4Dto3D(fname) % % Splits a 4D nifti file into a series of 3D nifti files. % Needs SPM functions to work. If input file is fdata.nii, % the output files will have filenames like fdata_001.nii, % fdata_002.nii, etc. if (nargin < 1) [fname,sts] = spm_select; if (sts == 0) fprintf('abk_4Dto3D: Operation cancelled.n'); return; end end vol = spm_vol(fname); img = spm_read_vols(vol); sz = size(img); tvol = vol(1); tvol = rmfield(tvol,'private'); tvol.descrip = 'generated by abk_4Dto3D.m'; [dn,fn,ext] = fileparts(fname); for ctr=1:sz(4) tvol.fname = sprintf('%s%s%s_%.3d%s',dn,filesep,fn,ctr,ext); fprintf('Writing %sn',tvol.fname); spm_write_vol(tvol,img(:,:,:,ctr)); end fprintf('done.n'); end

The script accepts a filename, given by the *fname* input parameter, of the 4D Nifti file. If *fname* is not specified, the script will prompt the user to select a file using *spm_select()*. Once the filename is specified, it will then read the 4D image data, and save it back one 3D image at a time.

Now to the code. Line 1 is simply the usual Matlab function declaration. This is followed by several lines of comments starting with the % character (lines 2 – 7). In line 9, the script checks if the function was called with an input parameter. If none was provided, it prompts the user to make a selection (line 10). It then checks if the user cancelled the operation (lines 11 – 14) and returns if true. Otherwise, it reads the header information using SPM’s *spm_vol()* function (line 17), loads the 4D data into *img* variable (line 18) using *spm_read_vols()*, and gets the image dimension (line 19).

In lines 21 – 23, the header information is copied into the *tvol* variable (line 21), which will be used later to save the images. The *private* field of *tvol* is then removed (line 22) and the header description is changed (line 23) to indicate the new file generator. In line 25, the filename is split into three variables *dn*, *fn*, and *ext* correspoding to the directory location, the base filename, and the extension, respectively.

In lines 27 – 31 is where the 4D image data is actually split into a series of 3D image files. Note how the variable *tvol* is repeatedly used, changing only the *fname* field each time. This is because the 3D images have basically the same header information.

Note that the same function could also be used to extract only certain volumes from the 4D nifti files with a slight modification. To implement this, we need to change the function declaration in line 1 into:

function abk_4Dto3D(fname,idx)

where the additional parameter *idx* is a vector containing the volume numbers to extract. We also need to change lines 27 – 31 as follows:

for ctr=1:length(idx) tvol.fname = sprintf('%s%s%s_%.3d%s',dn,filesep,fn,ctr,ext); fprintf('Writing %sn',tvol.fname); spm_write_vol(tvol,img(:,:,:,idx(ctr))); end

*ctr* now runs from 1 to the total number of volumes to extract given by the length of *idx*. The filenames will still be consecutively numbered from 1 to the length of* idx* (line 2). But this time, the 3D images that are saved are only the volumes specified in *idx* (line 4).

Have questions, leave a comment.

]]>Re-posting this article on real-time functional MRI I wrote several years ago.

The technique known as functional magnetic resonance imaging (fMRI) has been extensively used to elucidate the functions of the human brain. Functional MRI provides a “window” where we can see what part of the brain is involved when we think, smell, taste, feel, or move. These windows are the activation maps indicating sites in the subject’s brain that are activated while the subject performs a given task and are usually obtained after analyzing voluminous amount of functional MRI images.

In a typical fMRI scanning session, the accumulated data can reach several hundreds of brain image volumes. The computational demand is usually very high that functional analyses are often delayed and activation maps are obtained long after the scanning session is completed and the subject is no longer inside the MR scanner. In most cases, this delay in analysis is often not an issue. However, the problem arises when after the analysis the data turned out to be corrupted with significant noise that no reliable activation could be extracted resulting in a waste of scanning time and delaying progress in research. To avoid this, the ideal scenario would be to “know” the results while the subject is still inside the MR scanner and before the experiment is concluded. This scenario calls for the immediate analysis of fMRI images as they are acquired and thus motivated the development of the real-time analysis of fMRI data.

Fig. 1. The conceptual framework of the real-time functional magnetic resonance imaging system composing of an MR scanner, a data storage device, and a computational server. |

The real-time analysis of fMRI data offers several advantages both for theoretical studies and clinical applications. With real-time analysis, monitoring the task performance of the subject and the resulting quality of the acquired data can be easily achieved. It could also make functional mapping experiment more interactive by allowing ongoing paradigms to be altered if a need arises, making fMRI a more flexible tool for neurological investigations. Moreover, it also enables researchers to locate regions of interest that could be used for the next experimental run.

Fully real-time fMRI analysis could also provide an immediate feedback of the subject’s “ongoing” brain activity and thus enabling researchers to investigate the dynamical nature of the human brain. From a clinical perspective, some applications of real-time fMRI could be in pre-surgical planning. For instance, a surgeon operating a lesion could use functional brain studies to minimize the extent of the damage that could result in the operation. Real-time results of these functional studies are therefore critical. In spreading disorders such as Jacksonian seizures or migraine, the possibility of observing activation maps of such phenomena in real time could lead to a better understanding of the spreading mechanism of the disorder as well as to the development of therapeutic interventions to arrest the symptoms progression.

By providing an immediate feedback of the patient’s brain activity, real-time fMRI could also be used in assessing recovery treatment after a loss of, say for example motor function. These and several other potential applications are the compelling factors that motivate us to develop a fully real-time analysis system for fMRI time series. In simple terms, the research’s goal is to see the activation map unfolds in time as the subject performs the designated task, thereby enabling us to look how the brain works in real time.

Fig. 2. The above schematic shows the computational flowchart of the real-time analysis of fMRI time series, which starts immediately after an image is acquired and ends after the statistical parametric map is updated. The steps are repeated when a new image data is acquired. |

In order to achieve this goal, we need to overcome two main difficulties, namely: 1) the need for a general real-time parametric analysis tool and 2) the computational requirement. The former requires analysis tools that we can use in real-time to be able to process fMRI data in the same rigor as that of offline analysis methods, while the latter demands computational prowess that can cope up with the needed computations. To overcome the first problem, we develop an algorithm to estimate the coefficients of general linear model (GLM), a versatile tool for parametric analysis, using an orthogonalization procedure. The algorithm offers several advantages including incremental estimation, minimal use of memory during the estimation process, fixed computational cost for each estimate update, among others, making it highly suitable for real-time applications. Using this as the basis for general real-time parametric analysis, a real-time analysis system is developed. To achieve results of comparable quality to that obtained by offline processing methods, realignment for motion correction and smoothing operations are incorporated into the computational pipeline. To meet the computational demand, we employ inexpensive and economically viable cluster of personal computers or PC cluster. The result is the real-time fMRI analysis system schematically shown in Fig. 1.

Fig. 3. Real-time activation maps at different time steps (n = 30, 50, 70, 90, 110, and 130) of a slice containing the primary motor cortex. |

The system is composed of an MR scanner subsystem for data acquisition and paradigm control, a computational server (a PC cluster) for real-time fMRI data analysis, and a storage device for storing data. For offline operation, the MR scanner subsystem sends data to the storage device where the computational server can access for future analysis. For real-time operation, the MR scanner subsystem sends the data directly to the computational server for immediate processing. With this system, we achieved a fully real-time analysis of high spatial resolution whole-brain fMRI time series. The analysis includes realignment, smoothing, GLM estimation, and statistics computation (Fig. 2). All computations were performed immediately after the acquisition of each image volume and completed within TR set to 3 s. Real-time activation maps at different times for a slice containing the primiary motor area are shown in Fig. 3.

The real-time analysis system is designed such that the computational server does not have to be in the same site as the MR scanner. The idea is for imaging facilities that do not have a dedicated computational facility to be able to use remote computing resources on demand. This means that when needed the MR scanner subsystem could connect to a remote computational server via a high speed network and still be able to perform the required real-time operations. One way to realize this is to employ GRID technology. This will be the next step we will be taking, that is, the development of GRID-enabled real-time fMRI analysis system. The motivation is to make imaging facilities real-time capable by simply connecting to the GRID.

]]>

]]>

1. Create the mirror repository *mirror_repos/* using *svnadmin* command

[user@mycomp] svnadmin create mirror_repos

2. Go to *hooks/* subdirectory in the newly created repository

[user@mycomp] cd mirror_repos/hooks

You should see several *.tmpl files. One of these files is *pre-revprop-change.tmpl*. Copy it to *pre-revprop-change*, that is, without the .tmpl extension

[user@mycomp] cp pre-revprop-change.tmpl pre-revprop-change

Open this file using any text editor. Change it to the following:

USER="$2" if [ "$USER" = "username" ]; then exit 0; fi echo "Only username can change revprops" >&2 exit 1

Change “username” to the actual user name. Save the file and exit. Make sure it is also executable.

[user@mycomp] chmod 755 pre-revprop-change

3. Initialize the mirror repository using the *svnsync init* command

[user@mycomp] svnsync init DEST_URL SOURCE_URL Copied properties for revision 0

In this example, DEST_URL is* file:///home/user/mirror_repos* and SOURCE_URL is *svn+ssh://ruser@remote.com/home/ruser/master_repos*

This initialize the mirror repository and it is now ready to be populated.

4. Start synchronizing. Use *svnsync sync* command to do it:

[user@mycomp] svnsync sync file:///home/user/mirror_repos ruser@remote.com's password: xxxxxx Committed revision 1. Copied properties for revision 1. Transmitting file data ........ Committed revision 2. Copied properties for revision 2. Transmitting file data .... :

In case you want to commit back to the master repository, you can do it by issuing the command *svn switch –relocate* FROM_URL TO_URL before committing the changes. To do this, you also need to have the same UUID between the mirror and master repository.

Get the UUID from the master repository and copy it to the mirror repository. In the system where the master repository is running, run *svnadmin dump*

[ruser@remote] svnadmin dump -r0 /home/ruser/master_repos | head -n 3 > saved-uuid

Load it in the mirror repository

[user@mycomp] svnadmin load --force-uuid /home/user/mirror_repos < saved-uuid

The mirror and master repositories should now have the same UUID.

That’s it!

]]>Given two random variables *X* and *Y*, Pearson’s correlation coefficient *ρ* is defined as the ratio between the covariance of the two variables and the product of their standard deviations:

where are the means and standard deviations of *X* and *Y*. The correlation coefficient is usually used as a measure of the strength of the linear relation between the two variables. Substituting the values of the covariance and standard deviations computed from sample time series gives the *sample correlation coefficient*, commonly denoted as *r*:

where

Alternatively, *r* can also be written as

To test for the significance of the estimated correlation coefficient against the null hypothesis that the true correlation is equal to 0, one can compute the statistic

which has a Student’s *t*-distribution in the null case (zero correlation) with *N-2* degrees of freedom. For instance in Matlab, you can compute the *p*-value using the function *tcdf*(). In particular, *p* = 2**tcdf*(-*abs*(*t*), *N*-2) will give you the *p*-value for a two-tail *t*-test for a given *t*.

Alternatively, one can also convert the correlation coefficient using Fisher transform, given by

approximately follows a normal distribution with mean and standard deviation . With this, a *z*-score can now be defined as

Under the null hypothesis that *r* = *r*_{0} and given the assumption that the sample pairs are independent and identically distributed, *z* follows a bivariate normal distribution. Thus an approximate *p*-value can be obtained from a normal probability table.

One can also use the Fisher transformation to test if two correlations *r*_{1} and *r*_{2} are significantly different by computing the z-score using the formula:

which is distributed approximately as *N*(0,1) when the null hypothesis is true. Here and are the number of samples used to compute and , respectively.

Define as follows: and The correlation coefficient can now be written as

To estimate the correlation coefficient incrementally, use the following algorithm:

Initialize n = 1:

for n = 2 to N, compute

Re-compute *r* using the above equation

end

]]>