Skip to content
Back to formatted view

Raw Message

Message-ID: <30EE421B-DC71-4D93-832D-E1191F3381B7@comcast.net>
Date: 2011-10-07T21:36:38Z
From: David Winsemius
Subject: Find a particular point on a curve
In-Reply-To: <1318021614935-3883719.post@n4.nabble.com>

On Oct 7, 2011, at 5:06 PM, Joanie wrote:

> Here is a sample of my data:
>
> time                   temperature
> 40717.0140390	37.5
> 40717.0140510	37.5
>

> 40717.0519680	37.6
> 40717.0519790	37.6
> 40717.0520020	37.6
> 40717.0520140	37.6
After making that data into a dataframe named "dat"
 > plot(dat)
 > min(which(dat$temperature <37.5))
[1] 72
 > max(which(dat$temperature >37.5))
[1] 2146
 > dat$time[ max(which(dat$temperature >37.5)) ]
[1] 40717.05
 > dat$time[ min(which(dat$temperature <37.5)) ]
[1] 40717.02
 > dat$time[ max(which(dat$temperature >37.5)) ]-dat 
$time[ min(which(dat$temperature <37.5)) ]
[1] 0.036644
 > sum(dat$temperature - 37.5)
[1] -441.2

 > # Units = degree-what .... minute? hours?, days?
 > sum(dat$temperature - 37.5)*(dat$time[ max(which(dat$temperature  
 >37.5)) ]-dat$time[ min(which(dat$temperature <37.5)) ])
[1] -16.16733

So the area under the curve is -16.16 degree-<some-time-units>  
(probably days)

You did not include the first request, which was something about the  
duration of time that the temperature was at the minimum value (there  
being no real plateau). Noting that the minumum (read off the plot)  
was 36.7) I find:

 > 60*24*(dat$time[ max(which(dat$temperature==36.7)) ]-dat 
$time[ which.min(dat$temperature) ])
[1] 1.65024    # minutes (I think) spend at the nadir of temperature



-- 

David Winsemius, MD
West Hartford, CT