<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Aptech &#187; Answers for "Empirical CDF"</title>
	<atom:link href="http://www.aptech.com/questions/empirical-cdf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aptech.com</link>
	<description></description>
	<lastBuildDate>Fri, 08 Feb 2013 19:12:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>By: caj1024</title>
		<link>http://www.aptech.com/questions/empirical-cdf/#answer-2998</link>
		<comments>http://www.aptech.com/questions/empirical-cdf/#answer-2998#comments</comments>
		<pubDate>Mon, 14 Jan 2013 00:00:49 +0000</pubDate>
		<dc:creator>caj1024</dc:creator>
		
		<guid isPermaLink="false">http://www.aptech.com/questions/empirical-cdf/#answer-2998</guid>
		<description><![CDATA[I am not sure if any of the GAUSS applications have an ECDF function, but I think this procedure will do what you need. proc (1) = ecdf(x); local bp_start, bp_end, bp_inc, bp_pts, out, num_breaks; num_breaks = rows(x); //calculate breakpoints &#8230; <a href="http://www.aptech.com/questions/empirical-cdf/#answer-2998">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am not sure if any of the GAUSS applications have an ECDF function, but I think this procedure will do what you need.</p>
<pre>proc (1) = ecdf(x);
local bp_start, bp_end, bp_inc, bp_pts, out, num_breaks;

	num_breaks = rows(x);

	<span style="color: #008000">//calculate breakpoints</span>
	bp_start = minc(x);
	bp_end = maxc(x);
	bp_inc = (bp_end - bp_start)./num_breaks;
	bp_pts = seqa(bp_start, bp_inc, num_breaks + 1);

	<span style="color: #008000">//pre-allocate 'out' vector to avoid concatenation</span>
	out = zeros(rows(bp_pts), 1);
	out2 = out;

	<span style="color: #008000">//Clear code to calculate how many in each breakpoint</span>
	for i(1, rows(bp_pts), 1);
		out[i] = sumc(x .&lt; bp_pts[i]);
	endfor;

	retp(out);
endp;</pre>
<p>You can adjust the number of breakpoints <tt>num_breaks</tt> to trade-off between speed and the smoothness of the curve. Though, if speed is a concern you might want to replace the <tt>for</tt> loop at the end with a matrix based operation like this:</p>
<pre><span style="color: #008000">//Faster matrix based code to calculate how many in each breakpoint</span>
x = reshape(x', rows(bp_pts), rows(x));
out = sumr(x .&lt; bp_pts);</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.aptech.com/questions/empirical-cdf/#answer-2998/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.aptech.com @ 2013-02-09 01:44:05 --