pyinnovativetrend


Namepyinnovativetrend JSON
Version 1.0 PyPI version JSON
download
home_pageNone
SummaryAn innovative trend analysis and visualization tool
upload_time2024-08-22 06:37:17
maintainerNone
docs_urlNone
authorMd Mehedi Hasan Prodhan
requires_python<4,>=3.7
licenseNone
keywords time series analysis trend analysis innovative trend trend ita ita
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyinnovativetrend

Trend analysis is a statistical technique used to examine data over time to identify patterns, trends, or movements in a particular direction. It is widely used in various fields such as finance, economics, marketing, environmental science, and many others. A very common and conventional method to detect trend is mann-kendall trend test proposed by Mann and Kendall. However, an innovative method, proposed by Sen (2012), is widely used now-a-days due to its simplicity and graphical features. This innovative trend analysis method is very sensitive and can detect trends that are overlooked by conventional methods like MK test.


## Installation
The package is installed using pip:

    pip install pyinnovativetrend

## Function details:
### pyinnovativetrend.ITA_single
**pyinnovativetrend.ITA_single( x, length, alpha = 0.05, graph={}, showgraph = True)**\
This function calculates trend and other necessary parameters for single list or numpy array and returns a named tuple. By default, a graph is illustrated and saved on the local machine.\
Example:

    import pyinnovativetrend as pit
    x = [1,2,3,4,5,6,2,3,5,2,3,4,4]
    graph ={
        'xlabel' : 'First sub-series (1980 - 1985)',
        'ylabel' : 'Second sub-series (1986 - 1991)',
        'title' : 'Time series analysis',
        'dpi' : 450,
        'fontsize' : 10
    }

    pit.ITA_single(x, 12, graph = graph)


Output:
ITA(trend='No trend', h=False, p=0.2049477839420626, z=-1.2675805428826508, slope=-0.027777777777777752, standard_deviation=1.2555432644432805, slope_standard_deviation=0.021914014011770254, correlation=0.9341987329938274, lower_critical_level=-0.0429506782197758, uper_critical_level=0.0429506782197758)

![Single trend analysis](/outputfig.png)

## pyinnovativetrend.ITA_multiple_by_station
**ITA_multiple_by_station(length, filename=[], column=[], exceptcolumn=[],graph={}, alpha =0.05, rnd=2, csv = False, directory_path = "./", output=[], out_direc="./")**\
This function calculates trend and other necessary parameters for multiple stations. The data is retrieved from excel or csv files from a desired or root directory and results are saved as excel format sorted by stations on desired or root directory. By default, multiple graphs sorted by stations are illustrated and saved on the local machine on desired directory or root directory.\
Example:

    import pyinnovativetrend as pit
    graph ={
        'xlabel' : 'First sub-series (1980 - 1985)',
        'ylabel' : 'Second sub-series (1986 - 1991)',
        'title' : 'Time series analysis',
        'dpi' : 450,
        'fontsize' : 10
    }

    pit.ITA_multiple_by_station(38, exceptcolumn=['Year'], graph = graph)


Output:\
Excel files sample
![Single trend analysis](/barisalExcel.png)
Figure Sample
![Single trend analysis](/Barisal.png)
## pyinnovativetrend.ITA_multiple_by_column
**pyinnovativetrend.ITA_multiple_by_station (length, filename=[], column=[], exceptcolumn=[],graph={}, alpha =0.05, rnd=2, csv = False, directory_path = "./", output=[], out_direc="./")**\
This function calculates trend and other necessary parameters for multiple stations. The data is retrieved from excel or csv files from a desired or root directory and results are saved as excel format sorted by columns on desired or root directory. By default, multiple graphs sorted by columns are illustrated and saved on the local machine on desired directory or root directory.\
Example:

    import pyinnovativetrend as pit
    graph ={
        'xlabel' : 'First sub-series (1980 - 1985)',
        'ylabel' : 'Second sub-series (1986 - 1991)',
        'title' : 'Time series analysis',
        'dpi' : 450,
        'fontsize' : 10
    }

    pit.ITA_multiple_by_column(38, exceptcolumn=['Year'], graph = graph)


Output:\
Excel files sample
![Single trend analysis](/postmonsoonexcel.png)
Figure Sample
![Single trend analysis](/Post-Monsoon.png)

### pyinnovativetrend.ITA_single_vis(x,length,graph={})
**pyinnovativetrend.ITA_single_vis(x,length,figsize=(10,10),graph={})**\
This function illustrates a graph and saves on the local machine.\

Example:

    import pyinnovativetrend as pit
    x = [1,2,3,4,5,6,2,3,5,2,3,4,4]
    graph ={
        'xlabel' : 'First sub-series (1980 - 1985)',
        'ylabel' : 'Second sub-series (1986 - 1991)',
        'title' : 'Time series analysis',
        'dpi' : 450,
        'fontsize' : 10
    }

    pit.ITA_single_vis(x, 12, graph = graph)


Output:

![Single trend analysis](/outputfig.png)

### pyinnovativetrend.ITA_multiple_vis_by_station
**pyinnovativetrend.ITA_multiple_vis_by_station(length, graph={}, filename=[], column=[], exceptcolumn=[], csv = False, directory_path = "./")**\
This function illustrates multiple graphs sorted by stations and saves on the local machine on desired directory or root directory. The data is retrieved from excel or csv files from a desired or root directory and results are saved as excel format sorted by stations on desired or root directory.
Example:

    import pyinnovativetrend as pit
    graph ={
        'xlabel' : 'First sub-series (1980 - 1985)',
        'ylabel' : 'Second sub-series (1986 - 1991)',
        'title' : 'Time series analysis',
        'dpi' : 450,
        'fontsize' : 10
    }

    pit.ITA_multiple_vis_by_stations(38, exceptcolumn=['Year'], graph = graph)


Output:

![Single trend analysis](/Barisal.png)

### pyinnovativetrend.ITA_multiple_vis_by_column
**pyinnovativetrend.ITA_multiple_vis_by_column(length, graph={}, filename=[], column=[], exceptcolumn=[], csv = False, directory_path = "./")**\
This function illustrates multiple graphs sorted by stations and saves on the local machine on desired directory or root directory. The data is retrieved from excel or csv files from a desired or root directory and results are saved as excel format sorted by columns on desired or root directory.
Example:

    import pyinnovativetrend as pit
    graph ={
        'xlabel' : 'First sub-series (1980 - 1985)',
        'ylabel' : 'Second sub-series (1986 - 1991)',
        'title' : 'Time series analysis',
        'dpi' : 450,
        'fontsize' : 10
    }

    pit.ITA_multiple_vis_by_stations(38, exceptcolumn=['Year'], graph = graph)


Output:

![Single trend analysis](/Post-Monsoon.png)

### Parameters:
**x : List or numpy array**\
The time series or data series whose trend is to be determined

**length : integer**\
Length of the time series. If given length of the time series is odd, the earliest/first entry will be ommitted.

**filename : List default all excel/csv files**\
List of files or stations which contain the data sorted by month/year/season.

**column : List default all columns**\
List of columns or data-series which contain the data.

**exceptcolumn : List default empty list**\
List of columns for which analysis is not required (For example, column of year).

**csv : bool default False**
The type of files. By default the file type is excel. However, if the files are in csv format, csv should be assigned to True.

**directory_path : string default root**\
Directory path of the files where the files are stored.

**output : list default station names or column names**\
Name of the files by which the results will be saved.

**out_direc : string default root**\
Directory path of the files where the results will be saved.

**alpha : float default 0.05**\
Level of significance in a two-tailed test.

**showgraph : bool default True**\
Choose if graph is to be illustrated along with calculation in single analysis.

**graph : python dictionary (optional)**
**Default values**
'trendLineStyle' : 'dashed'      # Line style of trend line, for more line style type visit documentation of matplotlib\
'scatterMarker' : '.'            # Marker type of scattered data points, for more marker visit documentation of matplotlib\
'title' : ''                     # Title of the graph or illustration\
'xlabel' : 'First sub-series'    # Label of X-axis\
'ylabel' : 'Second sub-series'   # Label of Y-axis\
'noTrendLineStyle' : 'solid'     # Line style of no trend line or 1:1 line, for more line style type visit documentation of matplotlib\
'output_dir' : './'              # Directory of output file where graph is to be saved\
'output_name' : 'outputfig.png'  # Name of the graph or illustration\
'dpi' : 300                      # Dot per inch (dpi) of the graph or illustration\
'row' : -                        # Row number of the subplots. If not provided, will be calculated automatically. (Available only for multiple analysis)\
'colm': -                        # column number of the subplots. If not provided, will be calculated automatically. (Available only for multiple analysis)\

### Output:
**trend:**\
Tells if trend exists and type of trend\
**h:**\
True (if trend is present) and False (if trend is absent)\
**p:**\
p-value for the significant test (2-tailed test)\
**z:**\
Normalized test statistics (2-tailed test)\
**slope:**\
Slope of the trend\
**standard_deviation:**\
standard deviation of the data series\
**slope_standard_deviation:**\
Standard deviation of slope
**correlation:**\
Correlation between the sorted sub-series\
**lower_critical_level:**\
Lower critical value for 2-tailed test\
**upper_critical_level:**\
Upper critical value for 2-tailed test

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyinnovativetrend",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.7",
    "maintainer_email": null,
    "keywords": "time series analysis, trend analysis, innovative trend, trend, ITA, ita",
    "author": "Md Mehedi Hasan Prodhan",
    "author_email": "mehediprodhan1613@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/85/42/46668033b74053cc8d3bd932e0ff3c8c986641ae787064a5d1b7c042d533/pyinnovativetrend-1.0.tar.gz",
    "platform": null,
    "description": "# pyinnovativetrend\r\n\r\nTrend analysis is a statistical technique used to examine data over time to identify patterns, trends, or movements in a particular direction. It is widely used in various fields such as finance, economics, marketing, environmental science, and many others. A very common and conventional method to detect trend is mann-kendall trend test proposed by Mann and Kendall. However, an innovative method, proposed by Sen (2012), is widely used now-a-days due to its simplicity and graphical features. This innovative trend analysis method is very sensitive and can detect trends that are overlooked by conventional methods like MK test.\r\n\r\n\r\n## Installation\r\nThe package is installed using pip:\r\n\r\n    pip install pyinnovativetrend\r\n\r\n## Function details:\r\n### pyinnovativetrend.ITA_single\r\n**pyinnovativetrend.ITA_single( x, length, alpha = 0.05, graph={}, showgraph = True)**\\\r\nThis function calculates trend and other necessary parameters for single list or numpy array and returns a named tuple. By default, a graph is illustrated and saved on the local machine.\\\r\nExample:\r\n\r\n    import pyinnovativetrend as pit\r\n    x = [1,2,3,4,5,6,2,3,5,2,3,4,4]\r\n    graph ={\r\n        'xlabel' : 'First sub-series (1980 - 1985)',\r\n        'ylabel' : 'Second sub-series (1986 - 1991)',\r\n        'title' : 'Time series analysis',\r\n        'dpi' : 450,\r\n        'fontsize' : 10\r\n    }\r\n\r\n    pit.ITA_single(x, 12, graph = graph)\r\n\r\n\r\nOutput:\r\nITA(trend='No trend', h=False, p=0.2049477839420626, z=-1.2675805428826508, slope=-0.027777777777777752, standard_deviation=1.2555432644432805, slope_standard_deviation=0.021914014011770254, correlation=0.9341987329938274, lower_critical_level=-0.0429506782197758, uper_critical_level=0.0429506782197758)\r\n\r\n![Single trend analysis](/outputfig.png)\r\n\r\n## pyinnovativetrend.ITA_multiple_by_station\r\n**ITA_multiple_by_station(length, filename=[], column=[], exceptcolumn=[],graph={}, alpha =0.05, rnd=2, csv = False, directory_path = \"./\", output=[], out_direc=\"./\")**\\\r\nThis function calculates trend and other necessary parameters for multiple stations. The data is retrieved from excel or csv files from a desired or root directory and results are saved as excel format sorted by stations on desired or root directory. By default, multiple graphs sorted by stations are illustrated and saved on the local machine on desired directory or root directory.\\\r\nExample:\r\n\r\n    import pyinnovativetrend as pit\r\n    graph ={\r\n        'xlabel' : 'First sub-series (1980 - 1985)',\r\n        'ylabel' : 'Second sub-series (1986 - 1991)',\r\n        'title' : 'Time series analysis',\r\n        'dpi' : 450,\r\n        'fontsize' : 10\r\n    }\r\n\r\n    pit.ITA_multiple_by_station(38, exceptcolumn=['Year'], graph = graph)\r\n\r\n\r\nOutput:\\\r\nExcel files sample\r\n![Single trend analysis](/barisalExcel.png)\r\nFigure Sample\r\n![Single trend analysis](/Barisal.png)\r\n## pyinnovativetrend.ITA_multiple_by_column\r\n**pyinnovativetrend.ITA_multiple_by_station (length, filename=[], column=[], exceptcolumn=[],graph={}, alpha =0.05, rnd=2, csv = False, directory_path = \"./\", output=[], out_direc=\"./\")**\\\r\nThis function calculates trend and other necessary parameters for multiple stations. The data is retrieved from excel or csv files from a desired or root directory and results are saved as excel format sorted by columns on desired or root directory. By default, multiple graphs sorted by columns are illustrated and saved on the local machine on desired directory or root directory.\\\r\nExample:\r\n\r\n    import pyinnovativetrend as pit\r\n    graph ={\r\n        'xlabel' : 'First sub-series (1980 - 1985)',\r\n        'ylabel' : 'Second sub-series (1986 - 1991)',\r\n        'title' : 'Time series analysis',\r\n        'dpi' : 450,\r\n        'fontsize' : 10\r\n    }\r\n\r\n    pit.ITA_multiple_by_column(38, exceptcolumn=['Year'], graph = graph)\r\n\r\n\r\nOutput:\\\r\nExcel files sample\r\n![Single trend analysis](/postmonsoonexcel.png)\r\nFigure Sample\r\n![Single trend analysis](/Post-Monsoon.png)\r\n\r\n### pyinnovativetrend.ITA_single_vis(x,length,graph={})\r\n**pyinnovativetrend.ITA_single_vis(x,length,figsize=(10,10),graph={})**\\\r\nThis function illustrates a graph and saves on the local machine.\\\r\n\r\nExample:\r\n\r\n    import pyinnovativetrend as pit\r\n    x = [1,2,3,4,5,6,2,3,5,2,3,4,4]\r\n    graph ={\r\n        'xlabel' : 'First sub-series (1980 - 1985)',\r\n        'ylabel' : 'Second sub-series (1986 - 1991)',\r\n        'title' : 'Time series analysis',\r\n        'dpi' : 450,\r\n        'fontsize' : 10\r\n    }\r\n\r\n    pit.ITA_single_vis(x, 12, graph = graph)\r\n\r\n\r\nOutput:\r\n\r\n![Single trend analysis](/outputfig.png)\r\n\r\n### pyinnovativetrend.ITA_multiple_vis_by_station\r\n**pyinnovativetrend.ITA_multiple_vis_by_station(length, graph={}, filename=[], column=[], exceptcolumn=[], csv = False, directory_path = \"./\")**\\\r\nThis function illustrates multiple graphs sorted by stations and saves on the local machine on desired directory or root directory. The data is retrieved from excel or csv files from a desired or root directory and results are saved as excel format sorted by stations on desired or root directory.\r\nExample:\r\n\r\n    import pyinnovativetrend as pit\r\n    graph ={\r\n        'xlabel' : 'First sub-series (1980 - 1985)',\r\n        'ylabel' : 'Second sub-series (1986 - 1991)',\r\n        'title' : 'Time series analysis',\r\n        'dpi' : 450,\r\n        'fontsize' : 10\r\n    }\r\n\r\n    pit.ITA_multiple_vis_by_stations(38, exceptcolumn=['Year'], graph = graph)\r\n\r\n\r\nOutput:\r\n\r\n![Single trend analysis](/Barisal.png)\r\n\r\n### pyinnovativetrend.ITA_multiple_vis_by_column\r\n**pyinnovativetrend.ITA_multiple_vis_by_column(length, graph={}, filename=[], column=[], exceptcolumn=[], csv = False, directory_path = \"./\")**\\\r\nThis function illustrates multiple graphs sorted by stations and saves on the local machine on desired directory or root directory. The data is retrieved from excel or csv files from a desired or root directory and results are saved as excel format sorted by columns on desired or root directory.\r\nExample:\r\n\r\n    import pyinnovativetrend as pit\r\n    graph ={\r\n        'xlabel' : 'First sub-series (1980 - 1985)',\r\n        'ylabel' : 'Second sub-series (1986 - 1991)',\r\n        'title' : 'Time series analysis',\r\n        'dpi' : 450,\r\n        'fontsize' : 10\r\n    }\r\n\r\n    pit.ITA_multiple_vis_by_stations(38, exceptcolumn=['Year'], graph = graph)\r\n\r\n\r\nOutput:\r\n\r\n![Single trend analysis](/Post-Monsoon.png)\r\n\r\n### Parameters:\r\n**x : List or numpy array**\\\r\nThe time series or data series whose trend is to be determined\r\n\r\n**length : integer**\\\r\nLength of the time series. If given length of the time series is odd, the earliest/first entry will be ommitted.\r\n\r\n**filename : List default all excel/csv files**\\\r\nList of files or stations which contain the data sorted by month/year/season.\r\n\r\n**column : List default all columns**\\\r\nList of columns or data-series which contain the data.\r\n\r\n**exceptcolumn : List default empty list**\\\r\nList of columns for which analysis is not required (For example, column of year).\r\n\r\n**csv : bool default False**\r\nThe type of files. By default the file type is excel. However, if the files are in csv format, csv should be assigned to True.\r\n\r\n**directory_path : string default root**\\\r\nDirectory path of the files where the files are stored.\r\n\r\n**output : list default station names or column names**\\\r\nName of the files by which the results will be saved.\r\n\r\n**out_direc : string default root**\\\r\nDirectory path of the files where the results will be saved.\r\n\r\n**alpha : float default 0.05**\\\r\nLevel of significance in a two-tailed test.\r\n\r\n**showgraph : bool default True**\\\r\nChoose if graph is to be illustrated along with calculation in single analysis.\r\n\r\n**graph : python dictionary (optional)**\r\n**Default values**\r\n'trendLineStyle' : 'dashed'      # Line style of trend line, for more line style type visit documentation of matplotlib\\\r\n'scatterMarker' : '.'            # Marker type of scattered data points, for more marker visit documentation of matplotlib\\\r\n'title' : ''                     # Title of the graph or illustration\\\r\n'xlabel' : 'First sub-series'    # Label of X-axis\\\r\n'ylabel' : 'Second sub-series'   # Label of Y-axis\\\r\n'noTrendLineStyle' : 'solid'     # Line style of no trend line or 1:1 line, for more line style type visit documentation of matplotlib\\\r\n'output_dir' : './'              # Directory of output file where graph is to be saved\\\r\n'output_name' : 'outputfig.png'  # Name of the graph or illustration\\\r\n'dpi' : 300                      # Dot per inch (dpi) of the graph or illustration\\\r\n'row' : -                        # Row number of the subplots. If not provided, will be calculated automatically. (Available only for multiple analysis)\\\r\n'colm': -                        # column number of the subplots. If not provided, will be calculated automatically. (Available only for multiple analysis)\\\r\n\r\n### Output:\r\n**trend:**\\\r\nTells if trend exists and type of trend\\\r\n**h:**\\\r\nTrue (if trend is present) and False (if trend is absent)\\\r\n**p:**\\\r\np-value for the significant test (2-tailed test)\\\r\n**z:**\\\r\nNormalized test statistics (2-tailed test)\\\r\n**slope:**\\\r\nSlope of the trend\\\r\n**standard_deviation:**\\\r\nstandard deviation of the data series\\\r\n**slope_standard_deviation:**\\\r\nStandard deviation of slope\r\n**correlation:**\\\r\nCorrelation between the sorted sub-series\\\r\n**lower_critical_level:**\\\r\nLower critical value for 2-tailed test\\\r\n**upper_critical_level:**\\\r\nUpper critical value for 2-tailed test\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "An innovative trend analysis and visualization tool",
    "version": "1.0",
    "project_urls": null,
    "split_keywords": [
        "time series analysis",
        " trend analysis",
        " innovative trend",
        " trend",
        " ita",
        " ita"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b618e011e87ecd52d6411a1e7f3c9db712bb35204f8f9b5196f51450195ece99",
                "md5": "42febb871ce39bc6c655bcb7bed5ac90",
                "sha256": "93e03c2c64b2e16b829d773b1a47e42bc0101d2c46715aece989e37411e24ae5"
            },
            "downloads": -1,
            "filename": "pyinnovativetrend-1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "42febb871ce39bc6c655bcb7bed5ac90",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.7",
            "size": 9708,
            "upload_time": "2024-08-22T06:37:15",
            "upload_time_iso_8601": "2024-08-22T06:37:15.562455Z",
            "url": "https://files.pythonhosted.org/packages/b6/18/e011e87ecd52d6411a1e7f3c9db712bb35204f8f9b5196f51450195ece99/pyinnovativetrend-1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "854246668033b74053cc8d3bd932e0ff3c8c986641ae787064a5d1b7c042d533",
                "md5": "ae39cbfde1f33d8f6a1a498c0b82923f",
                "sha256": "a4086946d6fe5730aecfd88252af8f6f9559dc60ac094f27c9667579d000de58"
            },
            "downloads": -1,
            "filename": "pyinnovativetrend-1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ae39cbfde1f33d8f6a1a498c0b82923f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.7",
            "size": 10383,
            "upload_time": "2024-08-22T06:37:17",
            "upload_time_iso_8601": "2024-08-22T06:37:17.341310Z",
            "url": "https://files.pythonhosted.org/packages/85/42/46668033b74053cc8d3bd932e0ff3c8c986641ae787064a5d1b7c042d533/pyinnovativetrend-1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-22 06:37:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pyinnovativetrend"
}
        
Elapsed time: 0.27764s