Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
2ebdff41
Commit
2ebdff41
authored
6 years ago
by
Folkert Nobels
Browse files
Options
Downloads
Patches
Plain Diff
Add documentation to the pearson correlation function
parent
2e854b77
No related branches found
No related tags found
1 merge request
!742
Fix the random number generator
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/testRandom.c
+22
-0
22 additions, 0 deletions
tests/testRandom.c
with
22 additions
and
0 deletions
tests/testRandom.c
+
22
−
0
View file @
2ebdff41
...
...
@@ -26,6 +26,28 @@
/* Local headers. */
#include
"swift.h"
/**
* @brief Compute the Pearson correlation coefficient for two sets of numbers
*
* The pearson correlation coefficient between two sets of numbers can be
* calculated as:
*
* <x*y> - <x>*<y>
* r_xy = ----------------------
* (var(x) * var(y))^.5
*
* In the case that both sets are purely uncorrelated the value of the
* Pearson correlation function is expected to be close to 0. In the case that
* there is positive correlation r_xy > 0 and in the case of negative
* correlation, the function has r_xy < 0.
*
* @param mean1 average of first series of numbers
* @param mean2 average of second series of numbers
* @param total12 sum of x_i * y_i of both series of numbers
* @param var1 variance of the first series of numbers
* @param var2 variance of the second series of numbers
* @param number of elements in both series
* */
double
pearsonfunc
(
double
mean1
,
double
mean2
,
double
total12
,
double
var1
,
double
var2
,
int
counter
)
{
const
double
mean12
=
total12
/
(
double
)
counter
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment