[Genabel-commits] r1911 - pkg/ProbABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jan 5 16:37:08 CET 2015
Author: lckarssen
Date: 2015-01-05 16:37:08 +0100 (Mon, 05 Jan 2015)
New Revision: 1911
Modified:
pkg/ProbABEL/src/reg1.cpp
pkg/ProbABEL/src/reg1.h
Log:
Added some more doxygen documentation to ProbABEL's reg1.{h,cpp}.
Modified: pkg/ProbABEL/src/reg1.cpp
===================================================================
--- pkg/ProbABEL/src/reg1.cpp 2015-01-05 14:16:45 UTC (rev 1910)
+++ pkg/ProbABEL/src/reg1.cpp 2015-01-05 15:37:08 UTC (rev 1911)
@@ -249,6 +249,28 @@
}
+/**
+ * \brief Apply a genetic model to a transposed design matrix
+ * \f$X\f$. Similar to apply_model(), but used in case the design
+ * matrix is transposed.
+ *
+ * The function transposes a temporary copy of the input matrix,
+ * applies the model (using apply_model()), transposes it back again
+ * and returns that matrix.
+ *
+ * Used only when doing Cox PH regression.
+ * @param X The transposed design matrix, including SNP column(s).
+ * @param model Integer describing the genetic model to be
+ * applied. See apply_model() for details.
+ * @param interaction Column number of the covariate used in the
+ * interaction term.
+ * @param ngpreds Number of genetic predictors (1 for dosage data, 2
+ * for probability data).
+ * @param iscox Indicates whether a CoxPH regression is being done.
+ * @param nullmodel Indicates whether the null model is being analysed.
+ *
+ * @return (transposed) Matrix with the model applied to it.
+ */
mematrix<double> t_apply_model(const mematrix<double>& X,
const int model,
const int interaction,
@@ -256,6 +278,10 @@
const bool iscox,
const int nullmodel)
{
+ /* TODO: Why does this function not have a param called
+ is_interaction_excluded like t_apply_model has? Currently the
+ interaction parameter value is passed to apply_model() in that
+ slot. */
mematrix<double> tmpX = transpose(X);
mematrix<double> nX = apply_model(tmpX, model, interaction, ngpreds,
interaction, iscox, nullmodel);
Modified: pkg/ProbABEL/src/reg1.h
===================================================================
--- pkg/ProbABEL/src/reg1.h 2015-01-05 14:16:45 UTC (rev 1910)
+++ pkg/ProbABEL/src/reg1.h 2015-01-05 15:37:08 UTC (rev 1911)
@@ -53,7 +53,13 @@
const bool iscox,
const int nullmodel = 0);
-
+/**
+ * \brief The base_reg class defines a basic regression object.
+ *
+ * It contains all elements like a design matrix \f$X\f$, the vector
+ * of regression coefficients \f$\beta\f$, that are shared by more
+ * specialised classes like linear_reg and logistic_reg.
+ */
class base_reg {
public:
/**
@@ -72,6 +78,7 @@
*
*/
mematrix<double> sebeta;
+
//Han Chen
mematrix<double> covariance;
//Oct 26, 2009
@@ -86,7 +93,12 @@
*/
double sigma2;
+ /**
+ * \brief The loglikelihood of the model
+ *
+ */
double loglik;
+
double chi2_score;
regdata reg_data;
@@ -98,6 +110,13 @@
};
+/**
+ * \brief An extension of the base_reg class specialised in linear
+ * regression.
+ *
+ * This class contains functions for estimation of the model
+ * parameters, loglikelihood, etc. using linear regression.
+ */
class linear_reg: public base_reg {
public:
linear_reg(const regdata& rdatain);
@@ -129,6 +148,13 @@
};
+/**
+ * \brief An extension of the base_reg class specialised in logistic
+ * regression.
+ *
+ * This class contains functions for estimation of the model
+ * parameters, loglikelihood, etc. using logistic regression.
+ */
class logistic_reg: public base_reg {
public:
int niter;
More information about the Genabel-commits
mailing list