git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/preprocessCore@27568 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,10 +1,88 @@ |
1 |
+/*! \file avg.h |
|
2 |
+ \brief Functions for column wise summarizing a matrix by using the mean |
|
3 |
+ |
|
4 |
+*/ |
|
5 |
+ |
|
1 | 6 |
#ifndef AVG_H |
2 | 7 |
#define AVG_H |
3 | 8 |
|
9 |
+/*! \brief Compute the mean and SE of the mean for subset of rows |
|
10 |
+ * |
|
11 |
+ * Given a data matrix of probe intensities compute averageexpression measure and SE of this estimate |
|
12 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the arithmetic mean |
|
13 |
+ * is computed for each column. The sample standard error is also computed. |
|
14 |
+ * |
|
15 |
+ * |
|
16 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
17 |
+ * @param rows the number of rows in the matrix |
|
18 |
+ * @param cols the number of columns in the matrix |
|
19 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
20 |
+ * @param results pre-allocated space to store output averages. Should be of length cols |
|
21 |
+ * @param nprobes the number of elements in cur_rows |
|
22 |
+ * @param resultsSE pre-allocated space to store SE of averages. Should be of length cols |
|
23 |
+ * |
|
24 |
+ * |
|
25 |
+ */ |
|
26 |
+ |
|
4 | 27 |
void ColAverage(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE); |
28 |
+ |
|
29 |
+/*! \brief compute the mean for specified subset of rows |
|
30 |
+ * |
|
31 |
+ * Given a data matrix of probe intensities compute average expression measure and SE of this estimate |
|
32 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the arithmetic mean |
|
33 |
+ * is computed for each column. The sample standard error is also computed. |
|
34 |
+ * |
|
35 |
+ * |
|
36 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
37 |
+ * @param rows the number of rows in the matrix |
|
38 |
+ * @param cols the number of columns in the matrix |
|
39 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
40 |
+ * @param results pre-allocated space to store output averages. Should be of length cols |
|
41 |
+ * @param nprobes the number of elements in cur_rows |
|
42 |
+ * |
|
43 |
+ * |
|
44 |
+ * |
|
45 |
+ */ |
|
46 |
+ |
|
5 | 47 |
void ColAverage_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes); |
6 | 48 |
|
49 |
+/*! \brief Compute the mean and SE of the mean |
|
50 |
+ * |
|
51 |
+ * Given a data matrix of probe intensities compute average log2 expression measure and SE of this estimate |
|
52 |
+ * on a column by column basis. Specifically, each element is log2 transformed, then the arithmetic mean |
|
53 |
+ * is computed for each column. The sample standard error is also computed. This function guarantees that |
|
54 |
+ * no additional memory is temporarily allocated to copy the input data matrix. However, this means that |
|
55 |
+ * on output the input matrix may be changed. |
|
56 |
+ * |
|
57 |
+ * |
|
58 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
59 |
+ * @param rows the number of rows in the matrix |
|
60 |
+ * @param cols the number of columns in the matrix |
|
61 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
62 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
63 |
+ * |
|
64 |
+ * |
|
65 |
+ */ |
|
66 |
+ |
|
7 | 67 |
void colaverage_no_copy(double *data, int rows, int cols, double *results, double *resultsSE); |
68 |
+ |
|
69 |
+/*! \brief Compute the mean and SE of the mean |
|
70 |
+ * |
|
71 |
+ * Given a data matrix of probe intensities compute average log2 expression measure and SE of this estimate |
|
72 |
+ * on a column by column basis. Specifically, each element is log2 transformed, then the arithmetic mean |
|
73 |
+ * is computed for each column. The sample standard error is also computed. On output the data matrix will |
|
74 |
+ * be unchanged. |
|
75 |
+ * |
|
76 |
+ * |
|
77 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
78 |
+ * @param rows the number of rows in the matrix |
|
79 |
+ * @param cols the number of columns in the matrix |
|
80 |
+ * @param results pre-allocated space to store output averages. Should be of length cols |
|
81 |
+ * @param resultsSE pre-allocated space to store SE of averages. Should be of length cols |
|
82 |
+ * |
|
83 |
+ * |
|
84 |
+ */ |
|
85 |
+ |
|
8 | 86 |
void colaverage(double *data, int rows, int cols, double *results, double *resultsSE); |
9 | 87 |
|
10 | 88 |
#endif |
... | ... |
@@ -1,10 +1,90 @@ |
1 |
+/*! \file avg_log.h |
|
2 |
+ \brief Functions for column wise summarizing a matrix by \f$log2\f$ transforming the data and then averaging |
|
3 |
+ |
|
4 |
+ |
|
5 |
+*/ |
|
6 |
+ |
|
7 |
+ |
|
1 | 8 |
#ifndef AVG_LOG_H |
2 | 9 |
#define AVG_LOG_H |
3 | 10 |
|
11 |
+/*! \brief log2 transform and then compute the mean and SE of the mean for subset of rows |
|
12 |
+ * |
|
13 |
+ * Given a data matrix of probe intensities compute average log2 expression measure and SE of this estimate |
|
14 |
+ * on a column by column basis using only a specified subset of rows. Specifically, each element is log2 transformed, then the arithmetic mean |
|
15 |
+ * is computed for each column. The sample standard error is also computed. |
|
16 |
+ * |
|
17 |
+ * |
|
18 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
19 |
+ * @param rows the number of rows in the matrix |
|
20 |
+ * @param cols the number of columns in the matrix |
|
21 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
22 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
23 |
+ * @param nprobes the number of |
|
24 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
25 |
+ * |
|
26 |
+ * |
|
27 |
+ */ |
|
28 |
+ |
|
4 | 29 |
void AverageLog(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE); |
30 |
+ |
|
31 |
+/*! \brief log2 transform and then compute the mean for subset of rows |
|
32 |
+ * |
|
33 |
+ * Given a data matrix of probe intensities compute average log2 expression measure and SE of this estimate |
|
34 |
+ * on a column by column basis using only a specified subset of rows. Specifically, each element is log2 transformed, then the arithmetic mean |
|
35 |
+ * is computed for each column. The sample standard error is also computed. |
|
36 |
+ * |
|
37 |
+ * |
|
38 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
39 |
+ * @param rows the number of rows in the matrix |
|
40 |
+ * @param cols the number of columns in the matrix |
|
41 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
42 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
43 |
+ * @param nprobes the number of |
|
44 |
+ * |
|
45 |
+ * |
|
46 |
+ * |
|
47 |
+ */ |
|
48 |
+ |
|
5 | 49 |
void AverageLog_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes); |
6 | 50 |
|
51 |
+/*! \brief log2 transform and then compute the mean and SE of the mean |
|
52 |
+ * |
|
53 |
+ * Given a data matrix of probe intensities compute average log2 expression measure and SE of this estimate |
|
54 |
+ * on a column by column basis. Specifically, each element is log2 transformed, then the arithmetic mean |
|
55 |
+ * is computed for each column. The sample standard error is also computed. This function guarantees that |
|
56 |
+ * no additional memory is temporarily allocated to copy the input data matrix. However, this means that |
|
57 |
+ * on output the input matrix will be changed. |
|
58 |
+ * |
|
59 |
+ * |
|
60 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
61 |
+ * @param rows the number of rows in the matrix |
|
62 |
+ * @param cols the number of columns in the matrix |
|
63 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
64 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
65 |
+ * |
|
66 |
+ * |
|
67 |
+ */ |
|
68 |
+ |
|
7 | 69 |
void averagelog_no_copy(double *data, int rows, int cols, double *results, double *resultsSE); |
70 |
+ |
|
71 |
+/*! \brief log2 transform and then compute the mean and SE of the mean |
|
72 |
+ * |
|
73 |
+ * Given a data matrix of probe intensities compute average log2 expression measure and SE of this estimate |
|
74 |
+ * on a column by column basis. Specifically, each element is log2 transformed, then the arithmetic mean |
|
75 |
+ * is computed for each column. The sample standard error is also computed. On output the data matrix will |
|
76 |
+ * be unchanged. |
|
77 |
+ * |
|
78 |
+ * |
|
79 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
80 |
+ * @param rows the number of rows in the matrix |
|
81 |
+ * @param cols the number of columns in the matrix |
|
82 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
83 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
84 |
+ * |
|
85 |
+ * |
|
86 |
+ */ |
|
87 |
+ |
|
8 | 88 |
void averagelog(double *data, int rows, int cols, double *results, double *resultsSE); |
9 | 89 |
|
10 | 90 |
#endif |
... | ... |
@@ -1,12 +1,111 @@ |
1 |
+/*! \file biweight.h |
|
2 |
+ \brief Functions for column wise summarizing a matrix by \f$log2\f$ transforming the data and then using a 1-step Tukey Biweight |
|
3 |
+ |
|
4 |
+ |
|
5 |
+*/ |
|
6 |
+ |
|
1 | 7 |
#ifndef BIWEIGHT_H |
2 | 8 |
#define BIWEIGHT_H 1 |
3 | 9 |
|
10 |
+/*! \brief log2 transform the data and then use a 1-step Tukey Biweight to summarize each column |
|
11 |
+ * |
|
12 |
+ * Given a data matrix of probe intensities compute average expression measure then log2 it and SE of this estimate |
|
13 |
+ * on a column by column basis |
|
14 |
+ * |
|
15 |
+ * |
|
16 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
17 |
+ * @param rows the number of rows in the matrix |
|
18 |
+ * @param cols the number of columns in the matrix |
|
19 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
20 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
21 |
+ * |
|
22 |
+ * |
|
23 |
+ */ |
|
24 |
+ |
|
4 | 25 |
void tukeybiweight(double *data, int rows, int cols, double *results, double *resultsSE); |
26 |
+ |
|
27 |
+/*! \brief Use a 1-step Tukey Biweight to summarize each column |
|
28 |
+ * |
|
29 |
+ * Given a data matrix of probe intensities compute average expression measure then log2 it and SE of this estimate |
|
30 |
+ * on a column by column basis |
|
31 |
+ * |
|
32 |
+ * |
|
33 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
34 |
+ * @param rows the number of rows in the matrix |
|
35 |
+ * @param cols the number of columns in the matrix |
|
36 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
37 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
38 |
+ * |
|
39 |
+ * |
|
40 |
+ */ |
|
41 |
+ |
|
5 | 42 |
void tukeybiweight_no_log(double *data, int rows, int cols, double *results, double *resultsSE); |
43 |
+ |
|
44 |
+/*! \brief Use a 1-step Tukey Biweight to summarize each column |
|
45 |
+ * |
|
46 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
47 |
+ * corresponding to a single probeset, compute log2 transformed 1-step Tukey Biweight expression measure. |
|
48 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates |
|
49 |
+ * |
|
50 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
51 |
+ * @param rows the number of rows in the matrix |
|
52 |
+ * @param cols the number of columns in the matrix |
|
53 |
+ * @param cur_rows a vector containing row indices to use |
|
54 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
55 |
+ * @param nprobes number of probes in current set |
|
56 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
57 |
+ * |
|
58 |
+ * |
|
59 |
+ */ |
|
60 |
+ |
|
6 | 61 |
void TukeyBiweight(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE); |
62 |
+ |
|
63 |
+/*! \brief Use a 1-step Tukey Biweight to summarize each column |
|
64 |
+ * |
|
65 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
66 |
+ * corresponding to a single probeset, log2 transform each data item and then compute 1-step Tukey Biweight expression measure. |
|
67 |
+ * Note that data is a probes by chips matrix. |
|
68 |
+ * |
|
69 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
70 |
+ * @param rows the number of rows in the matrix |
|
71 |
+ * @param cols the number of columns in the matrix |
|
72 |
+ * @param cur_rows a vector containing row indices to use |
|
73 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
74 |
+ * @param nprobes number of probes in current set |
|
75 |
+ * |
|
76 |
+ * |
|
77 |
+ */ |
|
78 |
+ |
|
7 | 79 |
void TukeyBiweight_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes); |
80 |
+ |
|
81 |
+/*! \brief Use a 1-step Tukey Biweight to summarize each column |
|
82 |
+ * |
|
83 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
84 |
+ * corresponding to a single probeset, compute 1-step Tukey Biweight expression measure. |
|
85 |
+ * Note that data is a probes by chips matrix. |
|
86 |
+ * |
|
87 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
88 |
+ * @param rows the number of rows in the matrix |
|
89 |
+ * @param cols the number of columns in the matrix |
|
90 |
+ * @param cur_rows a vector containing row indices to use |
|
91 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
92 |
+ * @param nprobes number of probes in current set |
|
93 |
+ * |
|
94 |
+ */ |
|
95 |
+ |
|
8 | 96 |
void TukeyBiweight_no_log_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes); |
9 | 97 |
|
98 |
+/*! \brief compute a 1-step Tukey Biweight |
|
99 |
+ * |
|
100 |
+ * |
|
101 |
+ * implements one step Tukey Biweight as documented in the Affymetrix |
|
102 |
+ * Statistical Algorithms Description Document. |
|
103 |
+ * |
|
104 |
+ * @param x vector of data |
|
105 |
+ * @param length length of vector of data |
|
106 |
+ * |
|
107 |
+ */ |
|
108 |
+ |
|
10 | 109 |
double Tukey_Biweight(double *x, int length); |
11 | 110 |
|
12 | 111 |
#endif |
... | ... |
@@ -1,7 +1,28 @@ |
1 |
+/*! \file lm.h |
|
2 |
+ \brief Functions for weighted least squares regression |
|
3 |
+ |
|
4 |
+*/ |
|
5 |
+ |
|
1 | 6 |
#ifndef LM_H |
2 | 7 |
#define LM_H |
3 | 8 |
|
4 | 9 |
|
10 |
+/*! \brief Weighted least squares regression |
|
11 |
+ * |
|
12 |
+ * This function computes weighted linear regression estimates using QR decomposition |
|
13 |
+ * |
|
14 |
+ * |
|
15 |
+ * @param x - Design matrix: dimension rows*cols |
|
16 |
+ * @param y - dependent variable: length rows |
|
17 |
+ * @param w - weights for each observation: length rows |
|
18 |
+ * @param rows - dimension of input |
|
19 |
+ * @param cols - dimension of input |
|
20 |
+ * @param tol - machine tolerance used in qr decomp |
|
21 |
+ * @param out_beta - place to output beta estimates: length cols |
|
22 |
+ * @param out_resids - place to output residuals: length rows |
|
23 |
+ * |
|
24 |
+ ************************************************************************/ |
|
25 |
+ |
|
5 | 26 |
|
6 | 27 |
void lm_wfit(double *x, double *y, double *w, int rows, int cols, double tol, double *out_beta, double *out_resids); |
7 | 28 |
|
... | ... |
@@ -1,8 +1,65 @@ |
1 |
+/*! \file log_avg.h |
|
2 |
+ \brief Functions for column wise summarizing a matrix by averaging and then \f$log2\f$ transforming the computed mean |
|
3 |
+ |
|
4 |
+ |
|
5 |
+*/ |
|
6 |
+ |
|
1 | 7 |
#ifndef LOG_AVG_H |
2 |
-#define LOG_AVG_H 1 |
|
8 |
+#define LOG_AVG_H |
|
9 |
+ |
|
10 |
+/*! \brief compute the mean then log2 transform and also SE of the log2 mean |
|
11 |
+ * |
|
12 |
+ * Given a data matrix of probe intensities compute average expression measure then log2 it and SE of this estimate |
|
13 |
+ * on a column by column basis |
|
14 |
+ * |
|
15 |
+ * |
|
16 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
17 |
+ * @param rows the number of rows in the matrix |
|
18 |
+ * @param cols the number of columns in the matrix |
|
19 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
20 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
21 |
+ * |
|
22 |
+ * |
|
23 |
+ */ |
|
3 | 24 |
|
4 | 25 |
void logaverage(double *data, int rows, int cols, double *results, double *resultsSE); |
26 |
+ |
|
27 |
+/*! \brief compute the average and then log2 transform it. |
|
28 |
+ * |
|
29 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
30 |
+ * corresponding to a single probeset, compute log2 average expression measure. |
|
31 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates |
|
32 |
+ * |
|
33 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
34 |
+ * @param rows the number of rows in the matrix |
|
35 |
+ * @param cols the number of columns in the matrix |
|
36 |
+ * @param cur_rows a vector containing row indices to use |
|
37 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
38 |
+ * @param nprobes number of probes in current set |
|
39 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
40 |
+ * |
|
41 |
+ * |
|
42 |
+ */ |
|
43 |
+ |
|
5 | 44 |
void LogAverage(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE); |
45 |
+ |
|
46 |
+ |
|
47 |
+/*! \brief compute the average and then log2 transform it. |
|
48 |
+ * |
|
49 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
50 |
+ * corresponding to a single probeset, compute log2 average expression measure. |
|
51 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates |
|
52 |
+ * |
|
53 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
54 |
+ * @param rows the number of rows in the matrix |
|
55 |
+ * @param cols the number of columns in the matrix |
|
56 |
+ * @param cur_rows a vector containing row indices to use |
|
57 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
58 |
+ * @param nprobes number of probes in current set |
|
59 |
+ * |
|
60 |
+ * |
|
61 |
+ */ |
|
62 |
+ |
|
6 | 63 |
void LogAverage_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes); |
7 | 64 |
|
8 | 65 |
#endif |
... | ... |
@@ -1,12 +1,88 @@ |
1 |
+/*! \file log_median.h |
|
2 |
+ \brief Functions for column wise summarizing a matrix by computing the median and then \f$\log_2\f$ transforming |
|
3 |
+ |
|
4 |
+*/ |
|
5 |
+ |
|
6 |
+ |
|
7 |
+ |
|
1 | 8 |
#ifndef LOG_MEDIAN_H |
2 | 9 |
#define LOG_MEDIAN_H 1 |
3 | 10 |
|
4 |
- |
|
11 |
+/*! \brief compute the median for subset of rows and the \f$\log_2\f$ transform it |
|
12 |
+ * |
|
13 |
+ * Given a data matrix of probe intensities compute median and then \f$\log_2\f$ transform it. Also compute SE of this estimate |
|
14 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the median of each column is computed |
|
15 |
+ * the it is \f$\log_2\f$ transformed. The sample standard error is also computed. |
|
16 |
+ * |
|
17 |
+ * |
|
18 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
19 |
+ * @param rows the number of rows in the matrix |
|
20 |
+ * @param cols the number of columns in the matrix |
|
21 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
22 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
23 |
+ * @param nprobes the number of |
|
24 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
25 |
+ * |
|
26 |
+ * |
|
27 |
+ */ |
|
5 | 28 |
|
6 | 29 |
void LogMedian(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE); |
30 |
+ |
|
31 |
+/*! \brief compute the median for subset of rows and the \f$\log_2\f$ transform it |
|
32 |
+ * |
|
33 |
+ * Given a data matrix of probe intensities compute median and then \f$\log_2\f$ transform it. Computed on a column by column basis using only a specified subset of rows. |
|
34 |
+ * Specifically, the median of each column is computed |
|
35 |
+ * the it is \f$\log_2\f$ transformed. |
|
36 |
+ * |
|
37 |
+ * |
|
38 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
39 |
+ * @param rows the number of rows in the matrix |
|
40 |
+ * @param cols the number of columns in the matrix |
|
41 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
42 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
43 |
+ * @param nprobes the number of rows in cur_rows |
|
44 |
+ * |
|
45 |
+ * |
|
46 |
+ */ |
|
47 |
+ |
|
7 | 48 |
void LogMedian_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes); |
8 | 49 |
|
50 |
+/*! \brief compute the median for each column and then \f$\log_2\f$ transform it |
|
51 |
+ * |
|
52 |
+ * Given a data matrix of probe intensities compute median and then \f$\log_2\f$ transform it. Also produce the SE of this estimate |
|
53 |
+ * on a column by column basis. Specifically, the median is computed for each column and then \f$\log_2\f$ transformed. |
|
54 |
+ * The sample standard error is also computed. On output the data matrix will |
|
55 |
+ * be unchanged. |
|
56 |
+ * |
|
57 |
+ * |
|
58 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
59 |
+ * @param rows the number of rows in the matrix |
|
60 |
+ * @param cols the number of columns in the matrix |
|
61 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
62 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
63 |
+ * |
|
64 |
+ * |
|
65 |
+ */ |
|
66 |
+ |
|
9 | 67 |
void logmedian(double *data, int rows, int cols, double *results, double *resultsSE); |
68 |
+ |
|
69 |
+/*! \brief compute the median for each column and then \f$\log_2\f$ transform it |
|
70 |
+ * |
|
71 |
+ * Given a data matrix of probe intensities compute median and then \f$\log_2\f$ transform it. Also produce the SE of this estimate |
|
72 |
+ * on a column by column basis. Specifically, the median is computed for each column and then \f$\log_2\f$ transformed. |
|
73 |
+ * The sample standard error is also computed. On output the data matrix will |
|
74 |
+ * be changed. |
|
75 |
+ * |
|
76 |
+ * |
|
77 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
78 |
+ * @param rows the number of rows in the matrix |
|
79 |
+ * @param cols the number of columns in the matrix |
|
80 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
81 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
82 |
+ * |
|
83 |
+ * |
|
84 |
+ */ |
|
85 |
+ |
|
10 | 86 |
void logmedian_no_copy(double *data, int rows, int cols, double *results, double *resultsSE); |
11 | 87 |
|
12 | 88 |
#endif |
... | ... |
@@ -1,12 +1,87 @@ |
1 |
+/*! \file median.h |
|
2 |
+ \brief Functions for column wise summarizing a matrix by using the median |
|
3 |
+ |
|
4 |
+*/ |
|
5 |
+ |
|
1 | 6 |
#ifndef MEDIAN_H |
2 | 7 |
#define MEDIAN_H 1 |
3 | 8 |
|
4 |
- |
|
9 |
+/*! \brief Compute the median and SE of the median for subset of rows |
|
10 |
+ * |
|
11 |
+ * Given a data matrix of probe intensities compute median and SE of this estimate |
|
12 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the arithmetic mean |
|
13 |
+ * is computed for each column. The sample standard error is also computed. |
|
14 |
+ * |
|
15 |
+ * |
|
16 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
17 |
+ * @param rows the number of rows in the matrix |
|
18 |
+ * @param cols the number of columns in the matrix |
|
19 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
20 |
+ * @param results pre-allocated space to store output medians. Should be of length cols |
|
21 |
+ * @param nprobes the number of elements in cur_rows |
|
22 |
+ * @param resultsSE pre-allocated space to store SE of medians. Should be of length cols |
|
23 |
+ * |
|
24 |
+ * |
|
25 |
+ */ |
|
5 | 26 |
|
6 | 27 |
void ColMedian(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE); |
28 |
+ |
|
29 |
+/*! \brief compute the median for specified subset of rows |
|
30 |
+ * |
|
31 |
+ * Given a data matrix of probe intensities compute median expression measure |
|
32 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the median |
|
33 |
+ * is computed for each column. |
|
34 |
+ * |
|
35 |
+ * |
|
36 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
37 |
+ * @param rows the number of rows in the matrix |
|
38 |
+ * @param cols the number of columns in the matrix |
|
39 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
40 |
+ * @param results pre-allocated space to store output medians. Should be of length cols |
|
41 |
+ * @param nprobes the number of elements in cur_rows |
|
42 |
+ * |
|
43 |
+ * |
|
44 |
+ * |
|
45 |
+ */ |
|
46 |
+ |
|
7 | 47 |
void ColMedian_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes); |
8 | 48 |
|
49 |
+/*! \brief Compute the median and SE of the median |
|
50 |
+ * |
|
51 |
+ * Given a data matrix of probe intensities compute median measure and SE of this estimate |
|
52 |
+ * on a column by column basis. Specifically, each element is log2 transformed, then the arithmetic mean |
|
53 |
+ * is computed for each column. The sample standard error is also computed. This function guarantees that |
|
54 |
+ * no additional memory is temporarily allocated to copy the input data matrix. However, this means that |
|
55 |
+ * on output the input matrix will be unchanged. |
|
56 |
+ * |
|
57 |
+ * |
|
58 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
59 |
+ * @param rows the number of rows in the matrix |
|
60 |
+ * @param cols the number of columns in the matrix |
|
61 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
62 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
63 |
+ * |
|
64 |
+ * |
|
65 |
+ */ |
|
66 |
+ |
|
9 | 67 |
void colmedian(double *data, int rows, int cols, double *results, double *resultsSE); |
68 |
+ |
|
69 |
+/*! \brief Compute the median and SE of the median |
|
70 |
+ * |
|
71 |
+ * Given a data matrix of probe intensities compute median measure and SE of this estimate |
|
72 |
+ * on a column by column basis. The sample standard error is also computed. On output the data matrix will |
|
73 |
+ * be changed. |
|
74 |
+ * |
|
75 |
+ * |
|
76 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
77 |
+ * @param rows the number of rows in the matrix |
|
78 |
+ * @param cols the number of columns in the matrix |
|
79 |
+ * @param results pre-allocated space to store output averages. Should be of length cols |
|
80 |
+ * @param resultsSE pre-allocated space to store SE of averages. Should be of length cols |
|
81 |
+ * |
|
82 |
+ * |
|
83 |
+ */ |
|
84 |
+ |
|
10 | 85 |
void colmedian_no_copy(double *data, int rows, int cols, double *results, double *resultsSE); |
11 | 86 |
|
12 | 87 |
|
... | ... |
@@ -1,12 +1,83 @@ |
1 |
+/*! \file median_log.h |
|
2 |
+ \brief Functions for column wise summarizing a matrix by computing the median of \f$\log_2\f$ transformed data |
|
3 |
+*/ |
|
4 |
+ |
|
1 | 5 |
#ifndef MEDIAN_LOG_H |
2 | 6 |
#define MEDIAN_LOG_H 1 |
3 | 7 |
|
4 |
- |
|
8 |
+/*! \brief \f$\log_2\f$ transform the data and compute the median |
|
9 |
+ * |
|
10 |
+ * Given a data matrix of probe intensities \f$\log_2\f$ transform it and then compute the median. Also compute SE of this estimate |
|
11 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the median of each column is based on |
|
12 |
+ * \f$\log_2\f$ transformed data. The sample standard error is also computed. |
|
13 |
+ * |
|
14 |
+ * |
|
15 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
16 |
+ * @param rows the number of rows in the matrix |
|
17 |
+ * @param cols the number of columns in the matrix |
|
18 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
19 |
+ * @param results pre-allocated space to store output log2 medians. Should be of length cols |
|
20 |
+ * @param nprobes the number of rows in cur_rows |
|
21 |
+ * @param resultsSE pre-allocated space to store SE of log2 medians. Should be of length cols |
|
22 |
+ * |
|
23 |
+ * |
|
24 |
+ */ |
|
5 | 25 |
|
6 | 26 |
void MedianLog(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE); |
27 |
+ |
|
28 |
+/*! \brief \f$\log_2\f$ transform the data and compute the median |
|
29 |
+ * |
|
30 |
+ * Given a data matrix of probe intensities \f$\log_2\f$ transform it and then compute the median on a column by column basis using only a specified subset of rows. |
|
31 |
+ * Specifically, the median of each column is based on \f$\log_2\f$ transformed data. |
|
32 |
+ * |
|
33 |
+ * |
|
34 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
35 |
+ * @param rows the number of rows in the matrix |
|
36 |
+ * @param cols the number of columns in the matrix |
|
37 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
38 |
+ * @param results pre-allocated space to store output log2 medians. Should be of length cols |
|
39 |
+ * @param nprobes the number of rows in cur_rows |
|
40 |
+ * |
|
41 |
+ */ |
|
42 |
+ |
|
7 | 43 |
void MedianLog_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes); |
8 | 44 |
|
45 |
+/*! \brief compute the median for each column of \f$\log_2\f$ transformed data. |
|
46 |
+ * |
|
47 |
+ * Given a data matrix of probe intensities \f$\log_2\f$ transform it then compute median of each column. Also produce the SE of this estimate |
|
48 |
+ * on a column by column basis. Specifically, the median is computed for each column and then \f$\log_2\f$ transformed. |
|
49 |
+ * The sample standard error is also computed. On output the data matrix will |
|
50 |
+ * be unchanged. |
|
51 |
+ * |
|
52 |
+ * |
|
53 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
54 |
+ * @param rows the number of rows in the matrix |
|
55 |
+ * @param cols the number of columns in the matrix |
|
56 |
+ * @param results pre-allocated space to store output log2 medians. Should be of length cols |
|
57 |
+ * @param resultsSE pre-allocated space to store SE of log2 medians. Should be of length cols |
|
58 |
+ * |
|
59 |
+ * |
|
60 |
+ */ |
|
61 |
+ |
|
9 | 62 |
void medianlog(double *data, int rows, int cols, double *results, double *resultsSE); |
63 |
+ |
|
64 |
+/*! \brief compute the median for each column of \f$\log_2\f$ transformed data. |
|
65 |
+ * |
|
66 |
+ * Given a data matrix of probe intensities \f$\log_2\f$ transform it then compute median of each column. Also produce the SE of this estimate |
|
67 |
+ * on a column by column basis. Specifically, the median is computed for each column and then \f$\log_2\f$ transformed. |
|
68 |
+ * The sample standard error is also computed. On output the data matrix will |
|
69 |
+ * be changed. |
|
70 |
+ * |
|
71 |
+ * |
|
72 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
73 |
+ * @param rows the number of rows in the matrix |
|
74 |
+ * @param cols the number of columns in the matrix |
|
75 |
+ * @param results pre-allocated space to store output log2 medians. Should be of length cols |
|
76 |
+ * @param resultsSE pre-allocated space to store SE of log2 medians. Should be of length cols |
|
77 |
+ * |
|
78 |
+ * |
|
79 |
+ */ |
|
80 |
+ |
|
10 | 81 |
void medianlog_no_copy(double *data, int rows, int cols, double *results, double *resultsSE); |
11 | 82 |
|
12 | 83 |
|
... | ... |
@@ -1,12 +1,140 @@ |
1 |
+/*! \file medianpolish.h |
|
2 |
+ \brief Functions for column wise summarizing a matrix by using the median polish algorithm |
|
3 |
+ |
|
4 |
+ |
|
5 |
+*/ |
|
6 |
+ |
|
1 | 7 |
#ifndef MEDIANPOLISH_H |
2 | 8 |
#define MEDIANPOLISH_H 1 |
3 | 9 |
|
10 |
+/*! \brief Compute medianpolish |
|
11 |
+ * |
|
12 |
+ * |
|
13 |
+ * Given a data matrix, compute median polish parameter estimates |
|
14 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. |
|
15 |
+ * The input data matrix contains the fitted residuals on output. |
|
16 |
+ * |
|
17 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
18 |
+ * @param rows the number of rows in the matrix |
|
19 |
+ * @param cols the number of columns in the matrix |
|
20 |
+ * @param r pre-allocated space to store estimated row effects. Should be of length rows. Assumed on input that this is zero-ed out. |
|
21 |
+ * @param c pre-allocated space to store estimated column effects. Should be of length cols. Assumed on input that this is zero-ed out. |
|
22 |
+ * @param t pre-allocated space to store "intercept" effect. Should be of length 1. |
|
23 |
+ * |
|
24 |
+ */ |
|
25 |
+ |
|
4 | 26 |
void median_polish_fit_no_copy(double *data, int rows, int cols, double *r, double *c, double *t); |
27 |
+ |
|
28 |
+/*! \brief Compute medianpolish |
|
29 |
+ * |
|
30 |
+ * |
|
31 |
+ * Given a data matrix of probe intensities, compute median polish expression measure. |
|
32 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. |
|
33 |
+ * The input data matrix contains the fitted residuals on output. |
|
34 |
+ * |
|
35 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
36 |
+ * @param rows the number of rows in the matrix |
|
37 |
+ * @param cols the number of columns in the matrix |
|
38 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
39 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols. Note that this is just NA values |
|
40 |
+ * |
|
41 |
+ */ |
|
42 |
+ |
|
5 | 43 |
void median_polish_no_copy(double *data, int rows, int cols, double *results, double *resultsSE); |
44 |
+ |
|
45 |
+/*! \brief Compute medianpolish |
|
46 |
+ * |
|
47 |
+ * |
|
48 |
+ * Given a data matrix of probe intensities, compute median polish expression measure. |
|
49 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. This function |
|
50 |
+ * \f$\log_2\f$ transforms its input before apply the median polish. The input data matrix |
|
51 |
+ * contains the fitted residuals on output. |
|
52 |
+ * |
|
53 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
54 |
+ * @param rows the number of rows in the matrix |
|
55 |
+ * @param cols the number of columns in the matrix |
|
56 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
57 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols. Note that this is just NA values |
|
58 |
+ * |
|
59 |
+ */ |
|
60 |
+ |
|
6 | 61 |
void median_polish_log2_no_copy(double *data, int rows, int cols, double *results, double *resultsSE); |
62 |
+ |
|
63 |
+/*! \brief Compute medianpolish |
|
64 |
+ * |
|
65 |
+ * |
|
66 |
+ * Given a data matrix of probe intensities, compute median polish expression measure. |
|
67 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. This function |
|
68 |
+ * \f$\log_2\f$ transforms its input before apply the median polish. |
|
69 |
+ * |
|
70 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
71 |
+ * @param rows the number of rows in the matrix |
|
72 |
+ * @param cols the number of columns in the matrix |
|
73 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
74 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols. Note that this is just NA values |
|
75 |
+ * @param residuals pre-allocated space to store the redsiuals. Should be of length rows*cols |
|
76 |
+ * |
|
77 |
+ */ |
|
78 |
+ |
|
7 | 79 |
void median_polish_log2(double *data, int rows, int cols, double *results, double *resultsSE, double *residuals); |
80 |
+ |
|
81 |
+/*! \brief Compute medianpolish |
|
82 |
+ * |
|
83 |
+ * |
|
84 |
+ * Given a data matrix of probe intensities, compute median polish expression measure. |
|
85 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. |
|
86 |
+ * |
|
87 |
+ * |
|
88 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
89 |
+ * @param rows the number of rows in the matrix |
|
90 |
+ * @param cols the number of columns in the matrix |
|
91 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
92 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols. Note that this is just NA values |
|
93 |
+ * @param residuals pre-allocated space to store the redsiuals. Should be of length rows*cols |
|
94 |
+ * |
|
95 |
+ */ |
|
96 |
+ |
|
8 | 97 |
void median_polish(double *data, int rows, int cols, double *results, double *resultsSE, double *residuals); |
98 |
+ |
|
99 |
+/*! \brief Compute medianpolish |
|
100 |
+ * |
|
101 |
+ * |
|
102 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
103 |
+ * corresponding to a single probeset, compute median polish expression measure. |
|
104 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. This function |
|
105 |
+ * \f$\log_2\f$ transforms its inpue before apply the median polish. |
|
106 |
+ * |
|
107 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
108 |
+ * @param rows the number of rows in the matrix |
|
109 |
+ * @param cols the number of columns in the matrix |
|
110 |
+ * @param cur_rows a vector containing row indices to use |
|
111 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
112 |
+ * @param nprobes number of probes in current set |
|
113 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols. Note that this is just NA values |
|
114 |
+ * |
|
115 |
+ * |
|
116 |
+ */ |
|
117 |
+ |
|
9 | 118 |
void MedianPolish(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE); |
119 |
+ |
|
120 |
+/*! \brief Compute medianpolish |
|
121 |
+ * |
|
122 |
+ * |
|
123 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
124 |
+ * corresponding to a single probeset, compute median polish expression measure. |
|
125 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates |
|
126 |
+ * |
|
127 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
128 |
+ * @param rows the number of rows in the matrix |
|
129 |
+ * @param cols the number of columns in the matrix |
|
130 |
+ * @param cur_rows a vector containing row indices to use |
|
131 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
132 |
+ * @param nprobes number of probes in current set |
|
133 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols. Note that this is just NA values |
|
134 |
+ * |
|
135 |
+ * |
|
136 |
+ */ |
|
137 |
+ |
|
10 | 138 |
void MedianPolish_no_log(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE); |
11 | 139 |
|
12 | 140 |
|
... | ... |
@@ -1,7 +1,23 @@ |
1 | 1 |
#include <Rinternals.h> |
2 | 2 |
#include <R_ext/Rdynload.h> |
3 | 3 |
|
4 |
- |
|
4 |
+/*! \brief log2 transform and then compute the mean and SE of the mean |
|
5 |
+ * |
|
6 |
+ * Given a data matrix of probe intensities compute average log2 expression measure and SE of this estimate |
|
7 |
+ * on a column by column basis. Specifically, each element is log2 transformed, then the arithmetic mean |
|
8 |
+ * is computed for each column. The sample standard error is also computed. This function guarantees that |
|
9 |
+ * no additional memory is temporarily allocated to copy the input data matrix. However, this means that |
|
10 |
+ * on output the input matrix will be changed. |
|
11 |
+ * |
|
12 |
+ * |
|
13 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
14 |
+ * @param rows the number of rows in the matrix |
|
15 |
+ * @param cols the number of columns in the matrix |
|
16 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
17 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
18 |
+ * |
|
19 |
+ * |
|
20 |
+ */ |
|
5 | 21 |
|
6 | 22 |
void averagelog_no_copy(double *data, int rows, int cols, double *results, double *resultsSE){ |
7 | 23 |
|
... | ... |
@@ -14,8 +30,6 @@ void averagelog_no_copy(double *data, int rows, int cols, double *results, doubl |
14 | 30 |
return; |
15 | 31 |
} |
16 | 32 |
|
17 |
- |
|
18 |
- |
|
19 | 33 |
/*! \brief log2 transform and then compute the mean and SE of the mean |
20 | 34 |
* |
21 | 35 |
* Given a data matrix of probe intensities compute average log2 expression measure and SE of this estimate |
... | ... |
@@ -43,7 +57,6 @@ void averagelog(double *data, int rows, int cols, double *results, double *resul |
43 | 57 |
return; |
44 | 58 |
} |
45 | 59 |
|
46 |
- |
|
47 | 60 |
/*! \brief log2 transform and then compute the mean and SE of the mean |
48 | 61 |
* |
49 | 62 |
* Given a data matrix of probe intensities, and a list of rows in the matrix |
... | ... |
@@ -72,7 +85,6 @@ void AverageLog(double *data, int rows, int cols, int *cur_rows, double *results |
72 | 85 |
return; |
73 | 86 |
} |
74 | 87 |
|
75 |
- |
|
76 | 88 |
/*! \brief log2 transform and then compute the mean |
77 | 89 |
* |
78 | 90 |
* Given a data matrix of probe intensities, and a list of rows in the matrix |
... | ... |
@@ -89,7 +101,6 @@ void AverageLog(double *data, int rows, int cols, int *cur_rows, double *results |
89 | 101 |
* |
90 | 102 |
*/ |
91 | 103 |
|
92 |
- |
|
93 | 104 |
void AverageLog_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes){ |
94 | 105 |
|
95 | 106 |
|
... | ... |
@@ -101,9 +112,6 @@ void AverageLog_noSE(double *data, int rows, int cols, int *cur_rows, double *re |
101 | 112 |
return; |
102 | 113 |
} |
103 | 114 |
|
104 |
- |
|
105 |
- |
|
106 |
- |
|
107 | 115 |
/*! \brief compute the mean then log2 transform and also SE of the log2 mean |
108 | 116 |
* |
109 | 117 |
* Given a data matrix of probe intensities compute average expression measure then log2 it and SE of this estimate |
... | ... |
@@ -129,8 +137,6 @@ void logaverage(double *data, int rows, int cols, double *results, double *resul |
129 | 137 |
return; |
130 | 138 |
} |
131 | 139 |
|
132 |
- |
|
133 |
- |
|
134 | 140 |
/*! \brief compute the average and then log2 transform it. |
135 | 141 |
* |
136 | 142 |
* Given a data matrix of probe intensities, and a list of rows in the matrix |
... | ... |
@@ -159,7 +165,21 @@ void LogAverage(double *data, int rows, int cols, int *cur_rows, double *results |
159 | 165 |
return; |
160 | 166 |
} |
161 | 167 |
|
162 |
- |
|
168 |
+/*! \brief compute the average and then log2 transform it. |
|
169 |
+ * |
|
170 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
171 |
+ * corresponding to a single probeset, compute log2 average expression measure. |
|
172 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates |
|
173 |
+ * |
|
174 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
175 |
+ * @param rows the number of rows in the matrix |
|
176 |
+ * @param cols the number of columns in the matrix |
|
177 |
+ * @param cur_rows a vector containing row indices to use |
|
178 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
179 |
+ * @param nprobes number of probes in current set |
|
180 |
+ * |
|
181 |
+ * |
|
182 |
+ */ |
|
163 | 183 |
|
164 | 184 |
void LogAverage_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes){ |
165 | 185 |
|
... | ... |
@@ -172,7 +192,20 @@ void LogAverage_noSE(double *data, int rows, int cols, int *cur_rows, double *re |
172 | 192 |
return; |
173 | 193 |
} |
174 | 194 |
|
175 |
- |
|
195 |
+/*! \brief log2 transform the data and then use a 1-step Tukey Biweight to summarize each column |
|
196 |
+ * |
|
197 |
+ * Given a data matrix of probe intensities compute average expression measure then log2 it and SE of this estimate |
|
198 |
+ * on a column by column basis |
|
199 |
+ * |
|
200 |
+ * |
|
201 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
202 |
+ * @param rows the number of rows in the matrix |
|
203 |
+ * @param cols the number of columns in the matrix |
|
204 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
205 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
206 |
+ * |
|
207 |
+ * |
|
208 |
+ */ |
|
176 | 209 |
|
177 | 210 |
void tukeybiweight(double *data, int rows, int cols, double *results, double *resultsSE){ |
178 | 211 |
|
... | ... |
@@ -184,6 +217,21 @@ void tukeybiweight(double *data, int rows, int cols, double *results, double *re |
184 | 217 |
return; |
185 | 218 |
} |
186 | 219 |
|
220 |
+/*! \brief Use a 1-step Tukey Biweight to summarize each column |
|
221 |
+ * |
|
222 |
+ * Given a data matrix of probe intensities compute average expression measure then log2 it and SE of this estimate |
|
223 |
+ * on a column by column basis |
|
224 |
+ * |
|
225 |
+ * |
|
226 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
227 |
+ * @param rows the number of rows in the matrix |
|
228 |
+ * @param cols the number of columns in the matrix |
|
229 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
230 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
231 |
+ * |
|
232 |
+ * |
|
233 |
+ */ |
|
234 |
+ |
|
187 | 235 |
void tukeybiweight_no_log(double *data, int rows, int cols, double *results, double *resultsSE){ |
188 | 236 |
|
189 | 237 |
static void(*fun)(double *, int, int, double *, double *) = NULL; |
... | ... |
@@ -194,10 +242,22 @@ void tukeybiweight_no_log(double *data, int rows, int cols, double *results, dou |
194 | 242 |
return; |
195 | 243 |
} |
196 | 244 |
|
197 |
- |
|
198 |
- |
|
199 |
- |
|
200 |
- |
|
245 |
+/*! \brief Use a 1-step Tukey Biweight to summarize each column |
|
246 |
+ * |
|
247 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
248 |
+ * corresponding to a single probeset, compute log2 transformed 1-step Tukey Biweight expression measure. |
|
249 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates |
|
250 |
+ * |
|
251 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
252 |
+ * @param rows the number of rows in the matrix |
|
253 |
+ * @param cols the number of columns in the matrix |
|
254 |
+ * @param cur_rows a vector containing row indices to use |
|
255 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
256 |
+ * @param nprobes number of probes in current set |
|
257 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
258 |
+ * |
|
259 |
+ * |
|
260 |
+ */ |
|
201 | 261 |
|
202 | 262 |
void TukeyBiweight(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE){ |
203 | 263 |
|
... | ... |
@@ -210,6 +270,22 @@ void TukeyBiweight(double *data, int rows, int cols, int *cur_rows, double *resu |
210 | 270 |
return; |
211 | 271 |
} |
212 | 272 |
|
273 |
+/*! \brief Use a 1-step Tukey Biweight to summarize each column |
|
274 |
+ * |
|
275 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
276 |
+ * corresponding to a single probeset, log2 transform each data item and then compute 1-step Tukey Biweight expression measure. |
|
277 |
+ * Note that data is a probes by chips matrix. |
|
278 |
+ * |
|
279 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
280 |
+ * @param rows the number of rows in the matrix |
|
281 |
+ * @param cols the number of columns in the matrix |
|
282 |
+ * @param cur_rows a vector containing row indices to use |
|
283 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
284 |
+ * @param nprobes number of probes in current set |
|
285 |
+ * |
|
286 |
+ * |
|
287 |
+ */ |
|
288 |
+ |
|
213 | 289 |
void TukeyBiweight_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes){ |
214 | 290 |
|
215 | 291 |
|
... | ... |
@@ -221,6 +297,20 @@ void TukeyBiweight_noSE(double *data, int rows, int cols, int *cur_rows, double |
221 | 297 |
return; |
222 | 298 |
} |
223 | 299 |
|
300 |
+/*! \brief Use a 1-step Tukey Biweight to summarize each column |
|
301 |
+ * |
|
302 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
303 |
+ * corresponding to a single probeset, compute 1-step Tukey Biweight expression measure. |
|
304 |
+ * Note that data is a probes by chips matrix. |
|
305 |
+ * |
|
306 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
307 |
+ * @param rows the number of rows in the matrix |
|
308 |
+ * @param cols the number of columns in the matrix |
|
309 |
+ * @param cur_rows a vector containing row indices to use |
|
310 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
311 |
+ * @param nprobes number of probes in current set |
|
312 |
+ * |
|
313 |
+ */ |
|
224 | 314 |
|
225 | 315 |
void TukeyBiweight_no_log_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes){ |
226 | 316 |
|
... | ... |
@@ -234,8 +324,16 @@ void TukeyBiweight_no_log_noSE(double *data, int rows, int cols, int *cur_rows, |
234 | 324 |
} |
235 | 325 |
|
236 | 326 |
|
237 |
- |
|
238 |
- |
|
327 |
+/*! \brief compute a 1-step Tukey Biweight |
|
328 |
+ * |
|
329 |
+ * |
|
330 |
+ * implements one step Tukey Biweight as documented in the Affymetrix |
|
331 |
+ * Statistical Algorithms Description Document. |
|
332 |
+ * |
|
333 |
+ * @param x vector of data |
|
334 |
+ * @param length length of vector of data |
|
335 |
+ * |
|
336 |
+ */ |
|
239 | 337 |
|
240 | 338 |
double Tukey_Biweight(double *x, int length){ |
241 | 339 |
|
... | ... |
@@ -264,6 +362,21 @@ void lm_wfit(double *x, double *y, double *w, int rows, int cols, double tol, do |
264 | 362 |
|
265 | 363 |
|
266 | 364 |
|
365 |
+/*! \brief Compute medianpolish |
|
366 |
+ * |
|
367 |
+ * |
|
368 |
+ * Given a data matrix, compute median polish parameter estimates |
|
369 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. |
|
370 |
+ * The input data matrix contains the fitted residuals on output. |
|
371 |
+ * |
|
372 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
373 |
+ * @param rows the number of rows in the matrix |
|
374 |
+ * @param cols the number of columns in the matrix |
|
375 |
+ * @param r pre-allocated space to store estimated row effects. Should be of length rows. Assumed on input that this is zero-ed out. |
|
376 |
+ * @param c pre-allocated space to store estimated column effects. Should be of length cols. Assumed on input that this is zero-ed out. |
|
377 |
+ * @param t pre-allocated space to store "intercept" effect. Should be of length 1. |
|
378 |
+ * |
|
379 |
+ */ |
|
267 | 380 |
|
268 | 381 |
void median_polish_fit_no_copy(double *data, int rows, int cols, double *r, double *c, double *t){ |
269 | 382 |
|
... | ... |
@@ -278,6 +391,21 @@ void median_polish_fit_no_copy(double *data, int rows, int cols, double *r, doub |
278 | 391 |
|
279 | 392 |
} |
280 | 393 |
|
394 |
+/*! \brief Compute medianpolish |
|
395 |
+ * |
|
396 |
+ * |
|
397 |
+ * Given a data matrix of probe intensities, compute median polish expression measure. |
|
398 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. |
|
399 |
+ * The input data matrix contains the fitted residuals on output. |
|
400 |
+ * |
|
401 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
402 |
+ * @param rows the number of rows in the matrix |
|
403 |
+ * @param cols the number of columns in the matrix |
|
404 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
405 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols. Note that this is just NA values |
|
406 |
+ * |
|
407 |
+ */ |
|
408 |
+ |
|
281 | 409 |
void median_polish_no_copy(double *data, int rows, int cols, double *results, double *resultsSE){ |
282 | 410 |
|
283 | 411 |
static void(*fun)(double *, int, int, double *, double *) = NULL; |
... | ... |
@@ -289,6 +417,22 @@ void median_polish_no_copy(double *data, int rows, int cols, double *results, do |
289 | 417 |
|
290 | 418 |
} |
291 | 419 |
|
420 |
+/*! \brief Compute medianpolish |
|
421 |
+ * |
|
422 |
+ * |
|
423 |
+ * Given a data matrix of probe intensities, compute median polish expression measure. |
|
424 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. This function |
|
425 |
+ * \f$\log_2\f$ transforms its input before apply the median polish. The input data matrix |
|
426 |
+ * contains the fitted residuals on output. |
|
427 |
+ * |
|
428 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
429 |
+ * @param rows the number of rows in the matrix |
|
430 |
+ * @param cols the number of columns in the matrix |
|
431 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
432 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols. Note that this is just NA values |
|
433 |
+ * |
|
434 |
+ */ |
|
435 |
+ |
|
292 | 436 |
void median_polish_log2_no_copy(double *data, int rows, int cols, double *results, double *resultsSE){ |
293 | 437 |
|
294 | 438 |
static void(*fun)(double *, int, int, double *, double *) = NULL; |
... | ... |
@@ -300,6 +444,21 @@ void median_polish_log2_no_copy(double *data, int rows, int cols, double *result |
300 | 444 |
|
301 | 445 |
} |
302 | 446 |
|
447 |
+/*! \brief Compute medianpolish |
|
448 |
+ * |
|
449 |
+ * |
|
450 |
+ * Given a data matrix of probe intensities, compute median polish expression measure. |
|
451 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. This function |
|
452 |
+ * \f$\log_2\f$ transforms its input before apply the median polish. |
|
453 |
+ * |
|
454 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
455 |
+ * @param rows the number of rows in the matrix |
|
456 |
+ * @param cols the number of columns in the matrix |
|
457 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
458 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols. Note that this is just NA values |
|
459 |
+ * @param residuals pre-allocated space to store the redsiuals. Should be of length rows*cols |
|
460 |
+ * |
|
461 |
+ */ |
|
303 | 462 |
|
304 | 463 |
void median_polish_log2(double *data, int rows, int cols, double *results, double *resultsSE, double *residuals){ |
305 | 464 |
|
... | ... |
@@ -313,6 +472,22 @@ void median_polish_log2(double *data, int rows, int cols, double *results, doubl |
313 | 472 |
|
314 | 473 |
} |
315 | 474 |
|
475 |
+/*! \brief Compute medianpolish |
|
476 |
+ * |
|
477 |
+ * |
|
478 |
+ * Given a data matrix of probe intensities, compute median polish expression measure. |
|
479 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. |
|
480 |
+ * |
|
481 |
+ * |
|
482 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
483 |
+ * @param rows the number of rows in the matrix |
|
484 |
+ * @param cols the number of columns in the matrix |
|
485 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
486 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols. Note that this is just NA values |
|
487 |
+ * @param residuals pre-allocated space to store the redsiuals. Should be of length rows*cols |
|
488 |
+ * |
|
489 |
+ */ |
|
490 |
+ |
|
316 | 491 |
void median_polish(double *data, int rows, int cols, double *results, double *resultsSE, double *residuals){ |
317 | 492 |
|
318 | 493 |
static void(*fun)(double *, int, int, double *, double *, double *) = NULL; |
... | ... |
@@ -324,13 +499,13 @@ void median_polish(double *data, int rows, int cols, double *results, double *re |
324 | 499 |
return; |
325 | 500 |
} |
326 | 501 |
|
327 |
- |
|
328 | 502 |
/*! \brief Compute medianpolish |
329 | 503 |
* |
330 | 504 |
* |
331 | 505 |
* Given a data matrix of probe intensities, and a list of rows in the matrix |
332 | 506 |
* corresponding to a single probeset, compute median polish expression measure. |
333 |
- * Note that data is a probes by chips matrix. Also compute SE estimates |
|
507 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates. This function |
|
508 |
+ * \f$\log_2\f$ transforms its inpue before apply the median polish. |
|
334 | 509 |
* |
335 | 510 |
* @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
336 | 511 |
* @param rows the number of rows in the matrix |
... | ... |
@@ -343,6 +518,7 @@ void median_polish(double *data, int rows, int cols, double *results, double *re |
343 | 518 |
* |
344 | 519 |
*/ |
345 | 520 |
|
521 |
+ |
|
346 | 522 |
void MedianPolish(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE){ |
347 | 523 |
|
348 | 524 |
|
... | ... |
@@ -356,6 +532,23 @@ void MedianPolish(double *data, int rows, int cols, int *cur_rows, double *resul |
356 | 532 |
|
357 | 533 |
} |
358 | 534 |
|
535 |
+/*! \brief Compute medianpolish |
|
536 |
+ * |
|
537 |
+ * |
|
538 |
+ * Given a data matrix of probe intensities, and a list of rows in the matrix |
|
539 |
+ * corresponding to a single probeset, compute median polish expression measure. |
|
540 |
+ * Note that data is a probes by chips matrix. Also compute SE estimates |
|
541 |
+ * |
|
542 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
543 |
+ * @param rows the number of rows in the matrix |
|
544 |
+ * @param cols the number of columns in the matrix |
|
545 |
+ * @param cur_rows a vector containing row indices to use |
|
546 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
547 |
+ * @param nprobes number of probes in current set |
|
548 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols. Note that this is just NA values |
|
549 |
+ * |
|
550 |
+ * |
|
551 |
+ */ |
|
359 | 552 |
|
360 | 553 |
void MedianPolish_no_log(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE){ |
361 | 554 |
|
... | ... |
@@ -477,9 +670,23 @@ void rlm_compute_se_anova(double *Y, int y_rows,int y_cols, double *beta, double |
477 | 670 |
|
478 | 671 |
} |
479 | 672 |
|
480 |
- |
|
481 |
- |
|
482 |
- |
|
673 |
+/*! \brief \f$\log_2\f$ transform the data and compute the median |
|
674 |
+ * |
|
675 |
+ * Given a data matrix of probe intensities \f$\log_2\f$ transform it and then compute the median. Also compute SE of this estimate |
|
676 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the median of each column is based on |
|
677 |
+ * \f$\log_2\f$ transformed data. The sample standard error is also computed. |
|
678 |
+ * |
|
679 |
+ * |
|
680 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
681 |
+ * @param rows the number of rows in the matrix |
|
682 |
+ * @param cols the number of columns in the matrix |
|
683 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
684 |
+ * @param results pre-allocated space to store output log2 medians. Should be of length cols |
|
685 |
+ * @param nprobes the number of rows in cur_rows |
|
686 |
+ * @param resultsSE pre-allocated space to store SE of log2 medians. Should be of length cols |
|
687 |
+ * |
|
688 |
+ * |
|
689 |
+ */ |
|
483 | 690 |
|
484 | 691 |
void MedianLog(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE){ |
485 | 692 |
|
... | ... |
@@ -492,6 +699,20 @@ void MedianLog(double *data, int rows, int cols, int *cur_rows, double *results, |
492 | 699 |
|
493 | 700 |
} |
494 | 701 |
|
702 |
+/*! \brief \f$\log_2\f$ transform the data and compute the median |
|
703 |
+ * |
|
704 |
+ * Given a data matrix of probe intensities \f$\log_2\f$ transform it and then compute the median on a column by column basis using only a specified subset of rows. |
|
705 |
+ * Specifically, the median of each column is based on \f$\log_2\f$ transformed data. |
|
706 |
+ * |
|
707 |
+ * |
|
708 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
709 |
+ * @param rows the number of rows in the matrix |
|
710 |
+ * @param cols the number of columns in the matrix |
|
711 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
712 |
+ * @param results pre-allocated space to store output log2 medians. Should be of length cols |
|
713 |
+ * @param nprobes the number of rows in cur_rows |
|
714 |
+ * |
|
715 |
+ */ |
|
495 | 716 |
|
496 | 717 |
void MedianLog_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes){ |
497 | 718 |
|
... | ... |
@@ -504,6 +725,23 @@ void MedianLog_noSE(double *data, int rows, int cols, int *cur_rows, double *res |
504 | 725 |
|
505 | 726 |
} |
506 | 727 |
|
728 |
+/*! \brief compute the median for each column of \f$\log_2\f$ transformed data. |
|
729 |
+ * |
|
730 |
+ * Given a data matrix of probe intensities \f$\log_2\f$ transform it then compute median of each column. Also produce the SE of this estimate |
|
731 |
+ * on a column by column basis. Specifically, the median is computed for each column and then \f$\log_2\f$ transformed. |
|
732 |
+ * The sample standard error is also computed. On output the data matrix will |
|
733 |
+ * be unchanged. |
|
734 |
+ * |
|
735 |
+ * |
|
736 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
737 |
+ * @param rows the number of rows in the matrix |
|
738 |
+ * @param cols the number of columns in the matrix |
|
739 |
+ * @param results pre-allocated space to store output log2 medians. Should be of length cols |
|
740 |
+ * @param resultsSE pre-allocated space to store SE of log2 medians. Should be of length cols |
|
741 |
+ * |
|
742 |
+ * |
|
743 |
+ */ |
|
744 |
+ |
|
507 | 745 |
|
508 | 746 |
|
509 | 747 |
void medianlog(double *data, int rows, int cols, double *results, double *resultsSE){ |
... | ... |
@@ -517,6 +755,22 @@ void medianlog(double *data, int rows, int cols, double *results, double *result |
517 | 755 |
|
518 | 756 |
} |
519 | 757 |
|
758 |
+/*! \brief compute the median for each column of \f$\log_2\f$ transformed data. |
|
759 |
+ * |
|
760 |
+ * Given a data matrix of probe intensities \f$\log_2\f$ transform it then compute median of each column. Also produce the SE of this estimate |
|
761 |
+ * on a column by column basis. Specifically, the median is computed for each column and then \f$\log_2\f$ transformed. |
|
762 |
+ * The sample standard error is also computed. On output the data matrix will |
|
763 |
+ * be changed. |
|
764 |
+ * |
|
765 |
+ * |
|
766 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
767 |
+ * @param rows the number of rows in the matrix |
|
768 |
+ * @param cols the number of columns in the matrix |
|
769 |
+ * @param results pre-allocated space to store output log2 medians. Should be of length cols |
|
770 |
+ * @param resultsSE pre-allocated space to store SE of log2 medians. Should be of length cols |
|
771 |
+ * |
|
772 |
+ * |
|
773 |
+ */ |
|
520 | 774 |
|
521 | 775 |
void medianlog_no_copy(double *data, int rows, int cols, double *results, double *resultsSE){ |
522 | 776 |
|
... | ... |
@@ -529,7 +783,23 @@ void medianlog_no_copy(double *data, int rows, int cols, double *results, double |
529 | 783 |
|
530 | 784 |
} |
531 | 785 |
|
532 |
- |
|
786 |
+/*! \brief compute the median for subset of rows and the \f$\log_2\f$ transform it |
|
787 |
+ * |
|
788 |
+ * Given a data matrix of probe intensities compute median and then \f$\log_2\f$ transform it. Also compute SE of this estimate |
|
789 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the median of each column is computed |
|
790 |
+ * the it is \f$\log_2\f$ transformed. The sample standard error is also computed. |
|
791 |
+ * |
|
792 |
+ * |
|
793 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
794 |
+ * @param rows the number of rows in the matrix |
|
795 |
+ * @param cols the number of columns in the matrix |
|
796 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
797 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
798 |
+ * @param nprobes the number of rows in cur_rows |
|
799 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
800 |
+ * |
|
801 |
+ * |
|
802 |
+ */ |
|
533 | 803 |
|
534 | 804 |
void LogMedian(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE){ |
535 | 805 |
|
... | ... |
@@ -542,6 +812,24 @@ void LogMedian(double *data, int rows, int cols, int *cur_rows, double *results, |
542 | 812 |
|
543 | 813 |
} |
544 | 814 |
|
815 |
+/*! \brief compute the median for subset of rows and the \f$\log_2\f$ transform it |
|
816 |
+ * |
|
817 |
+ * Given a data matrix of probe intensities compute median and then \f$\log_2\f$ transform it. Computed on a column by column basis using only a specified subset of rows. |
|
818 |
+ * Specifically, the median of each column is computed |
|
819 |
+ * the it is \f$\log_2\f$ transformed. |
|
820 |
+ * |
|
821 |
+ * |
|
822 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
823 |
+ * @param rows the number of rows in the matrix |
|
824 |
+ * @param cols the number of columns in the matrix |
|
825 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
826 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
827 |
+ * @param nprobes the number of rows in cur_rows |
|
828 |
+ * |
|
829 |
+ * |
|
830 |
+ */ |
|
831 |
+ |
|
832 |
+ |
|
545 | 833 |
void LogMedian_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE){ |
546 | 834 |
|
547 | 835 |
static void(*fun)(double *, int, int, int *, double *, int, double *) = NULL; |
... | ... |
@@ -553,6 +841,22 @@ void LogMedian_noSE(double *data, int rows, int cols, int *cur_rows, double *res |
553 | 841 |
|
554 | 842 |
} |
555 | 843 |
|
844 |
+/*! \brief compute the median for each column and then \f$\log_2\f$ transform it |
|
845 |
+ * |
|
846 |
+ * Given a data matrix of probe intensities compute median and then \f$\log_2\f$ transform it. Also produce the SE of this estimate |
|
847 |
+ * on a column by column basis. Specifically, the median is computed for each column and then \f$\log_2\f$ transformed. |
|
848 |
+ * The sample standard error is also computed. On output the data matrix will |
|
849 |
+ * be unchanged. |
|
850 |
+ * |
|
851 |
+ * |
|
852 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
853 |
+ * @param rows the number of rows in the matrix |
|
854 |
+ * @param cols the number of columns in the matrix |
|
855 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
856 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
857 |
+ * |
|
858 |
+ * |
|
859 |
+ */ |
|
556 | 860 |
|
557 | 861 |
void logmedian(double *data, int rows, int cols, double *results, double *resultsSE){ |
558 | 862 |
|
... | ... |
@@ -565,6 +869,22 @@ void logmedian(double *data, int rows, int cols, double *results, double *result |
565 | 869 |
|
566 | 870 |
} |
567 | 871 |
|
872 |
+/*! \brief compute the median for each column and then \f$\log_2\f$ transform it |
|
873 |
+ * |
|
874 |
+ * Given a data matrix of probe intensities compute median and then \f$\log_2\f$ transform it. Also produce the SE of this estimate |
|
875 |
+ * on a column by column basis. Specifically, the median is computed for each column and then \f$\log_2\f$ transformed. |
|
876 |
+ * The sample standard error is also computed. On output the data matrix will |
|
877 |
+ * be changed. |
|
878 |
+ * |
|
879 |
+ * |
|
880 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
881 |
+ * @param rows the number of rows in the matrix |
|
882 |
+ * @param cols the number of columns in the matrix |
|
883 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
884 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
885 |
+ * |
|
886 |
+ * |
|
887 |
+ */ |
|
568 | 888 |
|
569 | 889 |
void logmedian_no_copy(double *data, int rows, int cols, double *results, double *resultsSE){ |
570 | 890 |
|
... | ... |
@@ -578,10 +898,23 @@ void logmedian_no_copy(double *data, int rows, int cols, double *results, double |
578 | 898 |
} |
579 | 899 |
|
580 | 900 |
|
581 |
- |
|
582 |
- |
|
583 |
- |
|
584 |
- |
|
901 |
+/*! \brief Compute the mean and SE of the mean |
|
902 |
+ * |
|
903 |
+ * Given a data matrix of probe intensities compute average log2 expression measure and SE of this estimate |
|
904 |
+ * on a column by column basis. Specifically, each element is log2 transformed, then the arithmetic mean |
|
905 |
+ * is computed for each column. The sample standard error is also computed. This function guarantees that |
|
906 |
+ * no additional memory is temporarily allocated to copy the input data matrix. However, this means that |
|
907 |
+ * on output the input matrix may be changed. |
|
908 |
+ * |
|
909 |
+ * |
|
910 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
911 |
+ * @param rows the number of rows in the matrix |
|
912 |
+ * @param cols the number of columns in the matrix |
|
913 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
914 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
915 |
+ * |
|
916 |
+ * |
|
917 |
+ */ |
|
585 | 918 |
|
586 | 919 |
void colaverage_no_copy(double *data, int rows, int cols, double *results, double *resultsSE){ |
587 | 920 |
|
... | ... |
@@ -594,6 +927,24 @@ void colaverage_no_copy(double *data, int rows, int cols, double *results, doubl |
594 | 927 |
return; |
595 | 928 |
} |
596 | 929 |
|
930 |
+/*! \brief Compute the mean and SE of the mean |
|
931 |
+ * |
|
932 |
+ * Given a data matrix of probe intensities compute average log2 expression measure and SE of this estimate |
|
933 |
+ * on a column by column basis. Specifically, each element is log2 transformed, then the arithmetic mean |
|
934 |
+ * is computed for each column. The sample standard error is also computed. This function guarantees that |
|
935 |
+ * no additional memory is temporarily allocated to copy the input data matrix. However, this means that |
|
936 |
+ * on output the input matrix may be changed. |
|
937 |
+ * |
|
938 |
+ * |
|
939 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
940 |
+ * @param rows the number of rows in the matrix |
|
941 |
+ * @param cols the number of columns in the matrix |
|
942 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
943 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
944 |
+ * |
|
945 |
+ * |
|
946 |
+ */ |
|
947 |
+ |
|
597 | 948 |
void colaverage(double *data, int rows, int cols, double *results, double *resultsSE){ |
598 | 949 |
|
599 | 950 |
static void(*fun)(double*, int, int, double *, double *) = NULL; |
... | ... |
@@ -606,6 +957,23 @@ void colaverage(double *data, int rows, int cols, double *results, double *resul |
606 | 957 |
} |
607 | 958 |
|
608 | 959 |
|
960 |
+/*! \brief Compute the mean and SE of the mean for subset of rows |
|
961 |
+ * |
|
962 |
+ * Given a data matrix of probe intensities compute averageexpression measure and SE of this estimate |
|
963 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the arithmetic mean |
|
964 |
+ * is computed for each column. The sample standard error is also computed. |
|
965 |
+ * |
|
966 |
+ * |
|
967 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
968 |
+ * @param rows the number of rows in the matrix |
|
969 |
+ * @param cols the number of columns in the matrix |
|
970 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
971 |
+ * @param results pre-allocated space to store output averages. Should be of length cols |
|
972 |
+ * @param nprobes the number of elements in cur_rows |
|
973 |
+ * @param resultsSE pre-allocated space to store SE of averages. Should be of length cols |
|
974 |
+ * |
|
975 |
+ * |
|
976 |
+ */ |
|
609 | 977 |
|
610 | 978 |
void ColAverage(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE){ |
611 | 979 |
|
... | ... |
@@ -618,6 +986,24 @@ void ColAverage(double *data, int rows, int cols, int *cur_rows, double *results |
618 | 986 |
return; |
619 | 987 |
} |
620 | 988 |
|
989 |
+/*! \brief compute the mean for specified subset of rows |
|
990 |
+ * |
|
991 |
+ * Given a data matrix of probe intensities compute average expression measure and SE of this estimate |
|
992 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the arithmetic mean |
|
993 |
+ * is computed for each column. The sample standard error is also computed. |
|
994 |
+ * |
|
995 |
+ * |
|
996 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
997 |
+ * @param rows the number of rows in the matrix |
|
998 |
+ * @param cols the number of columns in the matrix |
|
999 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
1000 |
+ * @param results pre-allocated space to store output averages. Should be of length cols |
|
1001 |
+ * @param nprobes the number of elements in cur_rows |
|
1002 |
+ * |
|
1003 |
+ * |
|
1004 |
+ * |
|
1005 |
+ */ |
|
1006 |
+ |
|
621 | 1007 |
void ColAverage_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes){ |
622 | 1008 |
|
623 | 1009 |
static void(*fun)(double*, int, int, int*, double *, int) = NULL; |
... | ... |
@@ -629,8 +1015,21 @@ void ColAverage_noSE(double *data, int rows, int cols, int *cur_rows, double *re |
629 | 1015 |
return; |
630 | 1016 |
} |
631 | 1017 |
|
632 |
- |
|
633 |
- |
|
1018 |
+/*! \brief Compute the median and SE of the median |
|
1019 |
+ * |
|
1020 |
+ * Given a data matrix of probe intensities compute median measure and SE of this estimate |
|
1021 |
+ * on a column by column basis. The sample standard error is also computed. On output the data matrix will |
|
1022 |
+ * be changed. |
|
1023 |
+ * |
|
1024 |
+ * |
|
1025 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
1026 |
+ * @param rows the number of rows in the matrix |
|
1027 |
+ * @param cols the number of columns in the matrix |
|
1028 |
+ * @param results pre-allocated space to store output averages. Should be of length cols |
|
1029 |
+ * @param resultsSE pre-allocated space to store SE of averages. Should be of length cols |
|
1030 |
+ * |
|
1031 |
+ * |
|
1032 |
+ */ |
|
634 | 1033 |
|
635 | 1034 |
void colmedian_no_copy(double *data, int rows, int cols, double *results, double *resultsSE){ |
636 | 1035 |
|
... | ... |
@@ -643,6 +1042,24 @@ void colmedian_no_copy(double *data, int rows, int cols, double *results, double |
643 | 1042 |
return; |
644 | 1043 |
} |
645 | 1044 |
|
1045 |
+/*! \brief Compute the median and SE of the median |
|
1046 |
+ * |
|
1047 |
+ * Given a data matrix of probe intensities compute median measure and SE of this estimate |
|
1048 |
+ * on a column by column basis. Specifically, each element is log2 transformed, then the arithmetic mean |
|
1049 |
+ * is computed for each column. The sample standard error is also computed. This function guarantees that |
|
1050 |
+ * no additional memory is temporarily allocated to copy the input data matrix. However, this means that |
|
1051 |
+ * on output the input matrix will be unchanged. |
|
1052 |
+ * |
|
1053 |
+ * |
|
1054 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
1055 |
+ * @param rows the number of rows in the matrix |
|
1056 |
+ * @param cols the number of columns in the matrix |
|
1057 |
+ * @param results pre-allocated space to store output log2 averages. Should be of length cols |
|
1058 |
+ * @param resultsSE pre-allocated space to store SE of log2 averages. Should be of length cols |
|
1059 |
+ * |
|
1060 |
+ * |
|
1061 |
+ */ |
|
1062 |
+ |
|
646 | 1063 |
void colmedian(double *data, int rows, int cols, double *results, double *resultsSE){ |
647 | 1064 |
|
648 | 1065 |
static void(*fun)(double*, int, int, double *, double *) = NULL; |
... | ... |
@@ -655,6 +1072,23 @@ void colmedian(double *data, int rows, int cols, double *results, double *result |
655 | 1072 |
} |
656 | 1073 |
|
657 | 1074 |
|
1075 |
+/*! \brief Compute the median and SE of the median for subset of rows |
|
1076 |
+ * |
|
1077 |
+ * Given a data matrix of probe intensities compute median and SE of this estimate |
|
1078 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the arithmetic mean |
|
1079 |
+ * is computed for each column. The sample standard error is also computed. |
|
1080 |
+ * |
|
1081 |
+ * |
|
1082 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
1083 |
+ * @param rows the number of rows in the matrix |
|
1084 |
+ * @param cols the number of columns in the matrix |
|
1085 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
1086 |
+ * @param results pre-allocated space to store output medians. Should be of length cols |
|
1087 |
+ * @param nprobes the number of elements in cur_rows |
|
1088 |
+ * @param resultsSE pre-allocated space to store SE of medians. Should be of length cols |
|
1089 |
+ * |
|
1090 |
+ * |
|
1091 |
+ */ |
|
658 | 1092 |
|
659 | 1093 |
void ColMedian(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes, double *resultsSE){ |
660 | 1094 |
|
... | ... |
@@ -667,6 +1101,24 @@ void ColMedian(double *data, int rows, int cols, int *cur_rows, double *results, |
667 | 1101 |
return; |
668 | 1102 |
} |
669 | 1103 |
|
1104 |
+/*! \brief compute the median for specified subset of rows |
|
1105 |
+ * |
|
1106 |
+ * Given a data matrix of probe intensities compute median expression measure |
|
1107 |
+ * on a column by column basis using only a specified subset of rows. Specifically, the median |
|
1108 |
+ * is computed for each column. |
|
1109 |
+ * |
|
1110 |
+ * |
|
1111 |
+ * @param data a matrix containing data stored column-wise stored in rows*cols length of memory |
|
1112 |
+ * @param rows the number of rows in the matrix |
|
1113 |
+ * @param cols the number of columns in the matrix |
|
1114 |
+ * @param cur_rows indices specifying which rows in the matrix to use |
|
1115 |
+ * @param results pre-allocated space to store output medians. Should be of length cols |
|
1116 |
+ * @param nprobes the number of elements in cur_rows |
|
1117 |
+ * |
|
1118 |
+ * |
|
1119 |
+ * |
|
1120 |
+ */ |
|
1121 |
+ |
|
670 | 1122 |
void ColMedian_noSE(double *data, int rows, int cols, int *cur_rows, double *results, int nprobes){ |
671 | 1123 |
|
672 | 1124 |
static void(*fun)(double*, int, int, int*, double *, int) = NULL; |
... | ... |
@@ -1,17 +1,92 @@ |
1 |
+/*! \file rlm.h |
|
2 |
+ \brief Functions for fitting robust linear models |
|
3 |
+ |
|
4 |
+*/ |
|
5 |
+ |
|
6 |
+ |
|
1 | 7 |
#ifndef RLM_H |
2 | 8 |
#define RLM_H 1 |
3 | 9 |
|
10 |
+/*! \brief robust linear regression fit using iteratively reweighted least squares |
|
11 |
+ * |
|
12 |
+ * |
|
13 |
+ * @param x Design matrix: dimension rows*cols |
|
14 |
+ * @param y dependent variable: length rows |
|
15 |
+ * @param rows dimension of input |
|
16 |
+ * @param cols dimension of input |
|
17 |
+ * @param out_beta place to output beta estimates: length cols |
|
18 |
+ * @param out_resids place to output residuals: length rows |
|
19 |
+ * @param out_weights place to output weights: length rows |
|
20 |
+ * @param PsiFn a function used to determine weights based on standardized residuals |
|
21 |
+ * @param psi_k a tuning parameter for the PsiFn |
|
22 |
+ * @param max_iter maximum number of iterations (if don't converge before) |
|
23 |
+ * @param initialized do we have initial estimates of beta |
|
24 |
+ * |
|
25 |
+ */ |
|
26 |
+ |
|
4 | 27 |
void rlm_fit(double *x, double *y, int rows, int cols, double *out_beta, double *out_resids, double *out_weights, double (* PsiFn)(double, double, int), double psi_k, int max_iter,int initialized); |
28 |
+/*! \brief robust linear regression fit using iteratively reweighted least squares |
|
29 |
+ * |
|
30 |
+ * |
|
31 |
+ * @param x Design matrix: dimension rows*cols |
|
32 |
+ * @param y dependent variable: length rows |
|
33 |
+ * @param w weights for each observation: length rows |
|
34 |
+ * @param rows dimension of input |
|
35 |
+ * @param cols dimension of input |
|
36 |
+ * @param out_beta place to output beta estimates: length cols |
|
37 |
+ * @param out_resids place to output residuals: length rows |
|
38 |
+ * @param out_weights place to output weights: length rows |
|
39 |
+ * @param PsiFn a function used to determine weights based on standardized residuals |
|
40 |
+ * @param psi_k a tuning parameter for the PsiFn |
|
41 |
+ * @param max_iter maximum number of iterations (if don't converge before) |
|
42 |
+ * @param initialized do we have initial estimates of beta |
|
43 |
+ * |
|
44 |
+ */ |
|
5 | 45 |
|
6 | 46 |
void rlm_wfit(double *x, double *y, double *w, int rows, int cols, double *out_beta, double *out_resids, double *out_weights, double (* PsiFn)(double, double, int), double psi_k, int max_iter,int initialized); |
7 | 47 |
|
8 | 48 |
|
9 | 49 |
|
10 | 50 |
double med_abs(double *x, int length); |
11 |
-double irls_delta(double *old, double *new, int length); |
|
51 |
+/* double irls_delta(double *old, double *new, int length); */ |
|
52 |
+ |
|
53 |
+/*! \brief robust linear regression fit row-colum model |
|
54 |
+ * |
|
55 |
+ * Fits the model y = cols + rows + errors with constraint sum rows = 0 |
|
56 |
+ * |
|
57 |
+ * @param y dependent variable: length y_rows*y_cols |
|
58 |
+ * @param y_rows dimension of input |
|
59 |
+ * @param y_cols dimension of input |
|
60 |
+ * @param out_beta place to output beta estimates: length (y_rows + y_cols -1) |
|
61 |
+ * @param out_resids place to output residuals: length y_rows*y_cols |
|
62 |
+ * @param out_weights place to output weights: length y_rows*y_cols |
|
63 |
+ * @param PsiFn a function used to determine weights based on standardized residuals |
|
64 |
+ * @param psi_k a tuning parameter for the PsiFn |
|
65 |
+ * @param max_iter maximum number of iterations (if don't converge before) |
|
66 |
+ * @param initialized do we have initial estimates of beta |
|
67 |
+ * |
|
68 |
+ */ |
|
12 | 69 |
|
13 | 70 |
void rlm_fit_anova(double *y, int y_rows, int y_cols,double *out_beta, double *out_resids, double *out_weights,double (* PsiFn)(double, double, int), double psi_k,int max_iter, int initialized); |
14 | 71 |
|
72 |
+/*! \brief robust linear regression fit row-colum model |
|
73 |
+ * |
|
74 |
+ * Fits the model y = cols + rows + errors with constraint sum rows = 0 |
|
75 |
+ * |
|
76 |
+ * @param y dependent variable: length y_rows*y_cols |
|
77 |
+ * @param y_rows dimension of input |
|
78 |
+ * @param y_cols dimension of input |
|
79 |
+ * @param w weights for each observation: length y_rows*y_cols |
|
80 |
+ * @param out_beta place to output beta estimates: length (y_rows + y_cols -1) |
|
81 |
+ * @param out_resids place to output residuals: length y_rows*y_cols |
|
82 |
+ * @param out_weights place to output weights: length y_rows*y_cols |
|
83 |
+ * @param PsiFn a function used to determine weights based on standardized residuals |
|
84 |
+ * @param psi_k a tuning parameter for the PsiFn |
|
85 |
+ * @param max_iter maximum number of iterations (if don't converge before) |
|
86 |
+ * @param initialized do we have initial estimates of beta |
|
87 |
+ * |
|
88 |
+ */ |
|
89 |
+ |
|
15 | 90 |
void rlm_wfit_anova(double *y, int y_rows, int y_cols, double *w, double *out_beta, double *out_resids, double *out_weights,double (* PsiFn)(double, double, int), double psi_k,int max_iter, int initialized); |
16 | 91 |
|
17 | 92 |
#endif |
... | ... |
@@ -1,8 +1,52 @@ |
1 |
+/*! \file rlm_se.h |
|
2 |
+ \brief Functions for computing SE for fitted robust linear models |
|
3 |
+ |
|
4 |
+*/ |
|
5 |
+ |
|
1 | 6 |
#ifndef RLM_SE_H |
2 | 7 |
#define RLM_SE_H 1 |
3 | 8 |
|
9 |
+/*! \brief Estimate SE for robust linear regression fit using iteratively reweighted least squares |
|
10 |
+ * |
|
11 |
+ * |
|
12 |
+ * @param X Design matrix: dimension n*p |
|
13 |
+ * @param Y dependent variable: length n |
|
14 |
+ * @param n dimension of input |
|
15 |
+ * @param p dimension of input |
|
16 |
+ * @param beta fitted parameter estimates: length p |
|
17 |
+ * @param resids estimated residuals: length n |
|
18 |
+ * @param weights estimated weights: length n |
|
19 |
+ * @param se_estimates on output contains standard error estimates : length p |
|
20 |
+ * @param varcov a place to store estimated variance covariance matrix: dimension p*p (or set to NULL) |
|
21 |
+ * @param residSE estimated residual standard error |
|
22 |
+ * @param method should be integer 1,2,3 or 4 (4 is the default). |
|
23 |
+ * @param PsiFn a function used to determine weights based on standardized residuals |
|
24 |
+ * @param psi_k a tuning parameter for the PsiFn |
|
25 |
+ * |
|
26 |
+ */ |
|
27 |
+ |
|
4 | 28 |
|
5 | 29 |
void rlm_compute_se(double *X,double *Y, int n, int p, double *beta, double *resids,double *weights,double *se_estimates,double *varcov, double *residSE, int method,double (* PsiFn)(double, double, int), double psi_k); |
30 |
+ |
|
31 |
+/*! \brief Estimate SE for robust linear regression fit using iteratively reweighted least squares |
|
32 |
+ * |
|
33 |
+ * Specialized to the model y = cols + rows + error model |
|
34 |
+ * |
|
35 |
+ * @param Y dependent variable: length y_rows*y_cols |
|
36 |
+ * @param y_rows dimension of input |
|
37 |
+ * @param y_cols dimension of input |
|
38 |
+ * @param beta fitted parameter estimates: length y_rows + y_cols -1 |
|
39 |
+ * @param resids estimated residuals: length y_rows*y_cols |
|
40 |
+ * @param weights estimated weights: length y_rows*y_cols |
|
41 |
+ * @param se_estimates on output contains standard error estimates : y_rows + y_cols -1 |
|
42 |
+ * @param varcov a place to store estimated variance covariance matrix: dimension (y_rows + y_cols -1)*(y_rows + y_cols -1) (or set to NULL) |
|
43 |
+ * @param residSE estimated residual standard error |
|
44 |
+ * @param method should be integer 1,2,3 or 4 (4 is the default). |
|
45 |
+ * @param PsiFn a function used to determine weights based on standardized residuals |
|
46 |
+ * @param psi_k a tuning parameter for the PsiFn |
|
47 |
+ * |
|
48 |
+ */ |
|
49 |
+ |
|
6 | 50 |
void rlm_compute_se_anova(double *Y, int y_rows,int y_cols, double *beta, double *resids,double *weights,double *se_estimates, double *varcov, double *residSE, int method,double (* PsiFn)(double, double, int), double psi_k); |
7 | 51 |
|
8 | 52 |
#endif |