blob: d1cd767e269c121d523489983ccc853b85c49dd4 [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"/>
<title>MADlib: cox_prop_hazards.sql_in File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</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 src="../mathjax/MathJax.js">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<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">0.7</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>
<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="dynsections.js"></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>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('cox__prop__hazards_8sql__in.html','');
</script>
<div id="doc-content">
<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>
<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><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><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#a9c04e1fd1353bb3cfb942b6251851179">cox_prop_hazards</a> (varchar source, varchar indepColumn, varchar depColumn, integer maxNumIterations=20, varchar optimizer=&quot;newton&quot;, float8 precision=0.0001)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute cox-regression coefficients and diagnostic statistics. <a href="#a9c04e1fd1353bb3cfb942b6251851179"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><dl class="date"><dt><b>Date:</b></dt><dd>July 2012</dd></dl>
<dl class="see"><dt><b>See also:</b></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><hr/><h2>Function Documentation</h2>
<a class="anchor" id="a9c04e1fd1353bb3cfb942b6251851179"></a><!-- doxytag: member="cox_prop_hazards.sql_in::cox_prop_hazards" ref="a9c04e1fd1353bb3cfb942b6251851179" args="(varchar source, varchar indepColumn, varchar depColumn, integer maxNumIterations=20, varchar optimizer=&quot;newton&quot;, float8 precision=0.0001)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">cox_prop_hazards_result cox_prop_hazards </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">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><dt><b>Parameters:</b></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 dependant column measuring time of death </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="return"><dt><b>Returns:</b></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#a9c04e1fd1353bb3cfb942b6251851179">cox_prop_hazards</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#a9c04e1fd1353bb3cfb942b6251851179">cox_prop_hazards</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#a9c04e1fd1353bb3cfb942b6251851179">cox_prop_hazards</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#l00362">362</a> of file <a class="el" href="cox__prop__hazards_8sql__in_source.html">cox_prop_hazards.sql_in</a>.</p>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="cox__prop__hazards_8sql__in.html">cox_prop_hazards.sql_in</a> </li>
<!-- 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></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>
<li class="footer">Generated on Fri May 10 2013 01:37:13 for MADlib by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
</ul>
</div>
</body>
</html>