TransfoParam_GR1A.R 468 Bytes
Newer Older
Delaigue Olivier's avatar
Delaigue Olivier committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
TransfoParam_GR1A <- function(ParamIn,Direction){

  NParam <- 1;
  Bool <- is.matrix(ParamIn);
  if(Bool==FALSE){ ParamIn <- rbind(ParamIn); }
  if(ncol(ParamIn)!=NParam){ stop(paste("the GR1A model requires ",NParam," parameters \n",sep="")); return(NULL); }  

  if(Direction=="TR"){
    ParamOut     <-  (ParamIn+10.0)/8;
  }	
  if(Direction=="RT"){
    ParamOut     <-  ParamIn*8-10.0;
  }	

  if(Bool==FALSE){ ParamOut <- ParamOut[1,]; }
  return(ParamOut);

}