-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62d41b5
commit 481f015
Showing
1 changed file
with
16 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
# nfactor-decomp | ||
N-factor decomposition code implementing the Sun (1998) method | ||
N-factor decomposition code implementing the Sun (1998) method. | ||
|
||
## Usage: | ||
Use two lists of length `n`: one for the start year, the other for end year. | ||
|
||
``` | ||
decomposition(n, values_start, values_end) | ||
``` | ||
|
||
This returns the value at the start (product of `values_start`), the value at the end (product of `values_end`) and a list of `n` values, which are the differences due to each factor. The sum of the differences is equal to the difference between the value at the end and the value at the start. | ||
|
||
Make sure to import `numpy` and `itertools`: | ||
``` | ||
import numpy as np | ||
import itertools | ||
``` |