[R] Log transformation and -Inf values for use in glm()

Paul Warren Simonin Paul.Simonin at uvm.edu
Fri Feb 6 22:25:37 CET 2009

   I am writing regarding log transformation of data in a single  
matrix column, and subsequent use of these data in a glm model fit. I  
have a data matrix in which I am using the log function to transform  
the values. This transformation results in -Inf values in some places,  
though. I then receive an error when this matrix is used in the glm  
function, and would like to know this can be avoided.
   I have attempted several methods already including the use of  
na.exclue commands in the glm statement:

> DistributionT<-glm(EarlyLn$yoyras~EarlyLn$temp,family=gaussian(link  
> = "identity"),na.exclude)

I have also attempted to use the is.finite command:


I know another option would be to use a type of find and replace  
command to remove entire rows of the matrix that contain 0's (before  
log transformation) or -Inf (after transformation), but I do not know  
how this is done.

Thank you for any advice or tips regarding conducting this  
transformation and feeding the data matrix into glm.

Paul S.

More information about the R-help mailing list