User Tools

Site Tools


tools:regression

Objective

Description

List of functions

  • regressedts.R
  • multipleregress.R
  • filteroutreg.R
  • PoissonReg.R
  • PoissonRegwTrend.R
Extract a signal by linear regression over a range of lags

The script named regressedts.R and stored at https://dev.cfu.local/cfu_tools.git regression extract from any 1d (time) to 3d (time-lat-lon) field the effect of greenhouse gases, ENSO, or any mode of variability through a multilinear regression over the corresponding index (greenhouse gas concentration, ENSO index ..) at a set of lags you can choose.

Extract a signal by a multilinear regression over a set of indices

The script named multipleregress.R and stored at https://dev.cfu.local/cfu_tools.git regression extract from any 1d (time) to 3d (time-lat-lon) field the combined effect of greenhouse gases, ENSO, and any mode of variability through a multilinear regression over the corresponding indices (greenhouse gas concentration, ENSO index ..).

Filtering out a signal by a linear regression over a range of lags

The script named filteroutreg.R and stored at https://dev.cfu.local/cfu_tools.git regression filters out from any 1d (time) to 3d (time-lat-lon) field the effect of greenhouse gases, ENSO, or any mode of variability through a multilinear regression over the corresponding index (greenhouse gas concentration, ENSO index ..) at a set of lags you can choose.

Compute Poisson Regressions

The function computes the Poisson regression of every timeseries in predictands.csv onto every single predictor in predictors.csv (it regresses 1 predictand onto 1 predictor). The input and output are csv format. Each column should be identified with text and the first column of all files has to be the same and must represent the time of measurements. You can find an example of input files in /home/lpcaron/git-stuff/cfutools/regression.

Compute Poisson Regressions after accounting for a Trend

The function computes the Poisson regression of every timeseries in predictands.csv onto every single predictor in predictors.csv after removing the effect of every trend in trends.csv. The input and output are csv format. Each column should be identified with text and the first column of all files has to be the same and must represent the time of measurements. You can find an example of input files in /home/lpcaron/git-stuff/cfutools/regression.

Requirements

Use

Extract a signal by linear regression over a range of lags

./regressedts.R filename varname fileindex varindex outputfile set_of_lags

Ex :

./regressedts.R file_ERSST_tos_1960-2005.nc tos CO2_concentration_MaunaLoa.nc c02 file_ERSST_tos_1960-2005_co2_contribution.nc 0 > tos_c02.out &

./regressedts.R file_ERSST_tos_1960-2005.nc tos ENSO_index.nc ENSO file_ERSST_tos_1960-2005_ENSO_contribution.nc -12 -6 0 6 12 > tos_enso.out &

You can try to use it with some index I have left in the directory :

CO2 concentration at Mauna Loa from Climate Explorer and ENSO/PDO/PNA index from NOAA website together with the corresponding index smoothed out with a 1yr running mean.

Extract a signal by a multilinear regression over a set of indices

./multipleregress.R filename varname fileindex1 varindex1 fileindex2 varindex2 … outputfile

Ex :

./multipleregress.R file_ERSST_tos_1960-2005.nc tos CO2_concentration_MaunaLoa.nc c02 ENSO_index.nc ENSO file_ERSST_tos_1960-2005_co2_and_ENSO_contribution.nc 0 > tos_c02_ENSO.out &

You can try to use it with some index I have left in the directory :

CO2 concentration at Mauna Loa from Climate Explorer and ENSO/PDO/PNA index from NOAA website together with the corresponding index smoothed out with a 1yr running mean.

Filtering out a signal by a linear regression over a range of lags

./filteroutreg.R filename varname fileindex varindex outputfile set_of_lags

Ex :

./filteroutreg.R file_ERSST_tos_1960-2005.nc tos CO2_concentration_MaunaLoa.nc c02 file_ERSST_tos_1960-2005_withoutco2.nc 0 > tos_c02.out &

./filteroutreg.R file_ERSST_tos_1960-2005.nc tos ENSO_index.nc ENSO file_ERSST_tos_1960-2005_withoutENSO.nc -12 -6 0 6 12 > tos_enso.out &

You can try to use it with some index I have left in the directory :

CO2 concentration at Mauna Loa from Climate Explorer and ENSO/PDO/PNA index from NOAA website together with the corresponding index smoothed out with a 1yr running mean.

Compute Poisson Regressions

./PoissonReg.R predictands.csv predictors.csv <betas.csv> <pval.csv> <pvalsand.csv>

Input:

predictands.csv: A list of predictands (e.g. number of cyclones). Has to be integers.

predictors.csv: A list of predictors (e.g. climate indices).

Output (can be given, else the default values will be used):

betas.csv: A matrix of the determinants of the regressions (beta values).

pval.csv: A matrix of the pvalues of the regressions.

pvalsand (optional) : The pvalues (in matrix form) after controlling for mild violation of the distribution assumption (pvalues robust to autoregression and heteroskedasticity). - Will only be produced if pvalsand.csv is given in the command line.

Compute Poisson Regressions after accounting for a Trend

./PoissonReg.R predictands.csv predictors.csv trends.csv <betas.csv> <pval.csv> <pvalsand.csv>

Input:

predictands.csv: A list of predictands (e.g. number of cyclones). Has to be integers.

predictors.csv: A list of predictors (e.g. climate indices).

trends.csv: A list (max 6) of hockey stick funtions.

Output (can be given, else the default values will be used):

betas.csv: A matrix of the determinants of the regressions (beta values).

pval.csv: A matrix of the pvalues of the regressions.

pvalsand (optional) : The pvalues (in matrix form) after controlling for mild violation of the distribution assumption (pvalues robust to autoregression and heteroskedasticity). - Will only be produced if pvalsand.csv is given in the command line.

Repository

The link to the GIT repository is https://dev.cfu.local/cfu_tools.git

Contact

The coordinator of this project is Domingo Manubens Gil domingo.manubens@ic3.cat

Virginie Guemas virginie.guemas@ic3.cat, Louis-Philippe Caron louis-philippe.caron@ic3.cat

As a new user, please register to this mailing list: http://cfutools.ic3.cat/mailman/listinfo/cfutools You'll then have access to the history of all the emails sent to the users and presenting the functions and their available options.

Development

Package structure

How to develop

Download the repository folder to your computer ( git clone https://dev.cfu.local/cfu_tools.git <local_folder> ) and check-out to the branch you want to develop in.

Steps to add a new function to a package

  • Put the code of the function in a file.
  • Make sure the code of the function follows the style rules (information below header, history, …).
  • Fill in the file with the function documentation.

Style Guide

You can check the style guide for the Regression package here

tools/regression.txt · Last modified: 2015/05/26 11:29 (external edit)