On Aug 26, 2011, at 9:12 AM, David Winsemius wrote:

This arrived without a refers to in its headers and was a follow up to:

On Aug 25, 2011, at 9:33 PM, Jim Silverton wrote:
Hi all,
I have some data. I want to fit a smooth cdf to the data. Then I want to find both the value of x and the % on the y axis for which the the slope is 1 ( or the point where the slope change is the greatest...hummh well the part where you can identify where there is a point of inflection...for want
of a better word. Any ideas?
On Aug 26, 2011, at 12:59 AM, Jim Silverton wrote:

x = c(runif(1000, 0,2.5), runif(100, 2.5, 4))
plot(ecdf(x))

You will notice a sharp turn around x = 2.5
How do I get that value of x using R?

So you are not interested in a specific slope or in the inflection points (since there is no no inflection in this example but rather in the point at which the slope changes. The is a package, structcahange that looks at segmented models but in this simple instance I could not get it to return resuslts that I thought were consistent with the data.

Not one of my better speling efforts. The package name is 'strucchange'

http://finzi.psych.upenn.edu/R/library/strucchange/doc/strucchange-intro.pdf

These were my half-assed efforts that did not produce what seemed to be an accurate estimate, but I'm not a user of htat package and maybe someone can throw me a clue sincse that example seemed so "easy".

library(strucchange)

# After reading (skimming actually) the vignette and the help page for Fstats
> fs.x <- Fstats(x ~ 1)
> plot(fs.x)
> breakpoints(fs.x)

         Optimal 2-segment partition:

Call:
breakpoints.Fstats(obj = fs.x)

Breakpoints at observation number:
935

Corresponding to breakdates:
0.8490909


In a sense it is like a statistical process control problem. Cusums are often used to follow measurements that have a random and systematic component and which may shift their behavior. This is a simple demonstration of the advantages of that approach. Just take the median value and track cumulative sums:

csum.x <- cumsum(x-median(x))
plot( csum.x)
which.min(csum.x)
#'[1] 999

--
David Winsemius, MD
West Hartford, CT

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

David Winsemius, MD
West Hartford, CT

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

Reply via email to