Re: [R] Understanding cenros Error

2012-07-11 Thread Jim Lemon

On 07/11/2012 05:54 AM, Rich Shepard wrote:

Before reading water chemistry into a data frame I removed all missing
data. Yet when I try to run cenros() to summarize a specific chemical I get
an error that I do not understand:

with( subset(chem, param=='Ag'), cenros(quant,ceneq1) )
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'

I would like to learn what I did incorrectly so I can avoid these errors
in the future.

The data frame structure is

str(chem)
'data.frame': 120309 obs. of 8 variables:
$ site : Factor w/ 65 levels ;Influent,D-1,..: 2 2 2 2 2 2 ...
$ sampdate: Date, format: 2007-12-12 2007-12-12 ...
$ preeq0 : logi TRUE TRUE TRUE TRUE TRUE TRUE ...
$ param : Factor w/ 37 levels Ag,Al,Alk_tot,..: 1 2 8 17 3 9 ...
$ quant : num 0 0.106 1 231 231 0.011 0 0.002 0 100 ...
$ ceneq1 : logi FALSE FALSE TRUE FALSE FALSE FALSE ...
$ floor : num 0 0.106 0 231 231 0.011 0 0 0 100 ...
$ ceiling : Factor w/ 3909 levels 0.000,0.000),..: 1 116 841 1771 ...

I ran dput() on the data frame but cannot make sense of the output (a 5.5M
ASCII text file).


Hi Rich,
I don't have the NADA package, but I suspect that the cenros function is 
doing something like dividing by zero. With that much data, it may be 
hard to pinpoint where this is occurring. I would cut my data in half, 
run it, cut the remainder in half, run it and so on until the error goes 
away. With any luck, the last slice of data that was removed won't be 
too large to work out which value is causing the problem and what the 
problem is.


Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Understanding cenros Error

2012-07-11 Thread Rich Shepard

On Wed, 11 Jul 2012, Jim Lemon wrote:


I don't have the NADA package, but I suspect that the cenros function is
doing something like dividing by zero. With that much data, it may be hard
to pinpoint where this is occurring. I would cut my data in half, run it,
cut the remainder in half, run it and so on until the error goes away.
With any luck, the last slice of data that was removed won't be too large
to work out which value is causing the problem and what the problem is.


Jim,

  That is a great idea. I'll chunk the data into smaller files and see if I
can isolate the problem. Also, there are 37 different chemicals in the data
set and I first should try them all and see if the problem is consistent; I
tried only silver and aluminum before asking for guidance.

  Another potential approach that might be worth pursuing is to subset the
data frame by chemical and working separately with each. As I'm just
beginning to learn how to analyze left-censored data I've a long way to go.

Thanks for the suggestion,

Rich

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Understanding cenros Error

2012-07-11 Thread MacQueen, Don
An my easy but not very useful answer is that this particular subset
probably violates some assumption of the cenros() model. I myself would
start with simple inspections of the data, such as

  with( subset(chem, param=='Ag'),  table(ceneq1) )
  with( subset(chem, param=='Ag'), qqnorm(quant) )
  with( subset(chem, param=='Ag'), range(quant) )


in the hopes that something pops out.

Do you have any zeros in quant?  (see ?cenros)

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 7/10/12 12:54 PM, Rich Shepard rshep...@appl-ecosys.com wrote:

   Before reading water chemistry into a data frame I removed all missing
data. Yet when I try to run cenros() to summarize a specific chemical I
get
an error that I do not understand:

with( subset(chem, param=='Ag'),  cenros(quant,ceneq1) )
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
   NA/NaN/Inf in 'y'

   I would like to learn what I did incorrectly so I can avoid these
errors
in the future.

   The data frame structure is

str(chem)
'data.frame':  120309 obs. of  8 variables:
  $ site: Factor w/ 65 levels ;Influent,D-1,..: 2 2 2 2 2 2 ...
  $ sampdate: Date, format: 2007-12-12 2007-12-12 ...
  $ preeq0  : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
  $ param   : Factor w/ 37 levels Ag,Al,Alk_tot,..: 1 2 8 17 3 9 ...
  $ quant   : num  0 0.106 1 231 231 0.011 0 0.002 0 100 ...
  $ ceneq1  : logi  FALSE FALSE TRUE FALSE FALSE FALSE ...
  $ floor   : num  0 0.106 0 231 231 0.011 0 0 0 100 ...
  $ ceiling : Factor w/ 3909 levels 0.000,0.000),..: 1 116 841 1771
...

   I ran dput() on the data frame but cannot make sense of the output (a
5.5M
ASCII text file).

   Pointers appreciated.

Rich

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Understanding cenros Error

2012-07-11 Thread Rich Shepard

On Wed, 11 Jul 2012, MacQueen, Don wrote:


An my easy but not very useful answer is that this particular subset
probably violates some assumption of the cenros() model. I myself would
start with simple inspections of the data, such as

 with( subset(chem, param=='Ag'),  table(ceneq1) )
 with( subset(chem, param=='Ag'), qqnorm(quant) )
 with( subset(chem, param=='Ag'), range(quant) )


Don,

  Good points. I'll do these.


Do you have any zeros in quant?  (see ?cenros)


  Many, many. My client contact is trying to determine whether they are true
zeros or represent missing data. Data starts in 1994 and sometimes there are
blanks (definitely missing data) and sometimes zeros ... even on the same
spreadsheet row. Sigh. So we need to figure out just what they represent;
perhaps the original analytical lab reports can be found and examined.

  I don't recall reading in Dennis' book about too many zeros so I'll check
the R help. There are also errors trying cenboxplot() on the data frame.

  Only 9 of 37 chemicals produce results with cenros(), including 2 with
censored values and 1 with  80% of concentrations censored. The remaining
28 all have censored values and/or many zeros.

  When I have more information, presumably positive results, I'll post here
so the thread can be complete for posterity.

Thanks again,

Rich

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Understanding cenros Error

2012-07-10 Thread Rich Shepard

  Before reading water chemistry into a data frame I removed all missing
data. Yet when I try to run cenros() to summarize a specific chemical I get
an error that I do not understand:

with( subset(chem, param=='Ag'),  cenros(quant,ceneq1) )
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
  NA/NaN/Inf in 'y'

  I would like to learn what I did incorrectly so I can avoid these errors
in the future.

  The data frame structure is

str(chem)
'data.frame':   120309 obs. of  8 variables:
 $ site: Factor w/ 65 levels ;Influent,D-1,..: 2 2 2 2 2 2 ...
 $ sampdate: Date, format: 2007-12-12 2007-12-12 ...
 $ preeq0  : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
 $ param   : Factor w/ 37 levels Ag,Al,Alk_tot,..: 1 2 8 17 3 9 ...
 $ quant   : num  0 0.106 1 231 231 0.011 0 0.002 0 100 ...
 $ ceneq1  : logi  FALSE FALSE TRUE FALSE FALSE FALSE ...
 $ floor   : num  0 0.106 0 231 231 0.011 0 0 0 100 ...
 $ ceiling : Factor w/ 3909 levels 0.000,0.000),..: 1 116 841 1771 ...

  I ran dput() on the data frame but cannot make sense of the output (a 5.5M
ASCII text file).

  Pointers appreciated.

Rich

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.