blob: c7ec278ba104e35f39c7b7709510ff8d77f8dc84 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.4"/>
<title>MADlib: cox_prop_hazards.sql_in File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script src="../mathjax/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">MADlib
&#160;<span id="projectnumber">1.1</span> <span style="font-size:10pt; font-style:italic"><a href="../latest/./cox__prop__hazards_8sql__in.html"> A newer version is available</a></span>
</div>
<div id="projectbrief">User Documentation</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.4 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('cox__prop__hazards_8sql__in.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Groups</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">cox_prop_hazards.sql_in File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>SQL functions for cox proportional hazards.
<a href="#details">More...</a></p>
<p><a href="cox__prop__hazards_8sql__in_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a3310cf98478b7c1e400e8fb1b3965d30"><td class="memItemLeft" align="right" valign="top">cox_prop_hazards_result&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="cox__prop__hazards_8sql__in.html#a3310cf98478b7c1e400e8fb1b3965d30">cox_prop_hazards_regr</a> (varchar source, varchar indepColumn, varchar depColumn, varchar status, integer maxNumIterations=20, varchar optimizer=&quot;newton&quot;, float8 precision=0.0001)</td></tr>
<tr class="memdesc:a3310cf98478b7c1e400e8fb1b3965d30"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute cox-regression coefficients and diagnostic statistics. <a href="#a3310cf98478b7c1e400e8fb1b3965d30">More...</a><br/></td></tr>
<tr class="separator:a3310cf98478b7c1e400e8fb1b3965d30"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><dl class="section date"><dt>Date</dt><dd>July 2012</dd></dl>
<dl class="section see"><dt>See Also</dt><dd>For a brief introduction to cox regression, see the module description <a class="el" href="group__grp__cox__prop__hazards.html">Cox-Proportional Hazards Regression</a> </dd></dl>
<p>Definition in file <a class="el" href="cox__prop__hazards_8sql__in_source.html">cox_prop_hazards.sql_in</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a3310cf98478b7c1e400e8fb1b3965d30"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">cox_prop_hazards_result cox_prop_hazards_regr </td>
<td>(</td>
<td class="paramtype">varchar&#160;</td>
<td class="paramname"><em>source</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">varchar&#160;</td>
<td class="paramname"><em>indepColumn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">varchar&#160;</td>
<td class="paramname"><em>depColumn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">varchar&#160;</td>
<td class="paramname"><em>status</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">integer&#160;</td>
<td class="paramname"><em>maxNumIterations</em> = <code>20</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">varchar&#160;</td>
<td class="paramname"><em>optimizer</em> = <code>&quot;newton&quot;</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">float8&#160;</td>
<td class="paramname"><em>precision</em> = <code>0.0001</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>To include an intercept in the model, set one coordinate in the <code>independentVariables</code> array to 1.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">source</td><td>Name of the source relation containing the training data </td></tr>
<tr><td class="paramname">indepColumn</td><td>Name of the independent column </td></tr>
<tr><td class="paramname">depColumn</td><td>Name of the dependent column measuring time of death </td></tr>
<tr><td class="paramname">status</td><td>Name of the column that determines right censoring support </td></tr>
<tr><td class="paramname">maxNumIterations</td><td>The maximum number of iterations </td></tr>
<tr><td class="paramname">optimizer</td><td>The optimizer to use (either <code>'newton'</code>/<code>'newton'</code> for the newton method </td></tr>
<tr><td class="paramname">precision</td><td>The difference between log-likelihood values in successive iterations that should indicate convergence. Note that a non-positive value here disables the convergence criterion, and execution will only stop after <code>maxNumIterations</code> iterations.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A composite value:<ul>
<li><code>coef FLOAT8[]</code> - Array of coefficients, \( \boldsymbol \beta \)</li>
<li><code>log_likelihood FLOAT8</code> - Log-likelihood \(l(\boldsymbol \beta)\)</li>
<li><code>std_err FLOAT8[]</code> - Array of standard errors, \( \mathit{se}(c_1), \dots, \mathit{se}(c_k) \)</li>
<li><code>z_stats FLOAT8[]</code> - Array of Wald z-statistics, \( \boldsymbol z \)</li>
<li><code>p_values FLOAT8[]</code> - Array of Wald p-values, \( \boldsymbol p \)</li>
<li><code>condition_no FLOAT8</code> - The condition number of matrix \( H \) during the iteration immediately <em>preceding</em> convergence (i.e., \( H \) is computed using the coefficients of the previous iteration)</li>
<li><code>num_iterations INTEGER</code> - The number of iterations before the algorithm terminated</li>
</ul>
</dd></dl>
<ul>
<li>Get vector of coefficients \( \boldsymbol \beta \) and all diagnostic statistics:<br/>
<pre>SELECT * FROM <a class="el" href="cox__prop__hazards_8sql__in.html#a3310cf98478b7c1e400e8fb1b3965d30">cox_prop_hazards_regr</a>(
'<em>sourceName</em>', '<em>dependentVariable</em>',
'<em>independentVariables</em>'
[, <em>numberOfIterations</em> [, '<em>optimizer</em>' [, <em>precision</em> ] ] ]
);</pre></li>
<li>Get vector of coefficients \( \boldsymbol \beta \):<br/>
<pre>SELECT (<a class="el" href="cox__prop__hazards_8sql__in.html#a3310cf98478b7c1e400e8fb1b3965d30">cox_prop_hazards_regr</a>('<em>sourceName</em>',
'<em>dependentVariable</em>', '<em>independentVariables</em>')).coef;</pre></li>
<li>Get a subset of the output columns, e.g., only the array of coefficients \( \boldsymbol \beta \), the log-likelihood of determination: <pre>SELECT coef, log_likelihood
FROM <a class="el" href="cox__prop__hazards_8sql__in.html#a3310cf98478b7c1e400e8fb1b3965d30">cox_prop_hazards_regr</a>('<em>sourceName</em>', '<em>dependentVariable</em>',
'<em>independentVariables</em>');</pre> </li>
</ul>
<p>Definition at line <a class="el" href="cox__prop__hazards_8sql__in_source.html#l00399">399</a> of file <a class="el" href="cox__prop__hazards_8sql__in_source.html">cox_prop_hazards.sql_in</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_efbcf68973d247bbf15f9eecae7f24e3.html">ports</a></li><li class="navelem"><a class="el" href="dir_a4a48839224ef8488facbffa8a397967.html">postgres</a></li><li class="navelem"><a class="el" href="dir_dc596537ad427a4d866006d1a3e1fe29.html">modules</a></li><li class="navelem"><a class="el" href="dir_505cd743a8a717435eca324f49291a46.html">stats</a></li><li class="navelem"><a class="el" href="cox__prop__hazards_8sql__in.html">cox_prop_hazards.sql_in</a></li>
<li class="footer">Generated on Wed Aug 21 2013 16:09:52 for MADlib by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.4 </li>
</ul>
</div>
</body>
</html>