tools:regression

- regressedts.R
- multipleregress.R
- filteroutreg.R
- PoissonReg.R
- PoissonRegwTrend.R

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.

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 ..).

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.

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.

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.

./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.

./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.

./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.

./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.

./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.

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

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.

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.

- 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.

You can check the style guide for the Regression package here

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