Med2top: Difference between revisions
Jump to navigation
Jump to search
imported>Jeremy (Importing text file) |
imported>Scott |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
===Purpose=== | ===Purpose=== | ||
Fits a constant to top/(bottom) of data. | Fits a constant to top/(bottom) of data. | ||
===Synopsis=== | ===Synopsis=== | ||
:[yf,residual,options] = med2top(y,options) | :[yf,residual,options] = med2top(y,options) | ||
===Description=== | ===Description=== | ||
MED2TOP is similar to LSQ2TOP with a 0 order polynomial, it can be considered an asymmetric estimate of the mean. | MED2TOP is similar to LSQ2TOP with a 0 order polynomial, it can be considered an asymmetric estimate of the mean. | ||
For fitting to the bottom: | For fitting to the bottom: | ||
>> tsq = residual/res; % (res) is an input | |||
<pre>>> tsq = residual/res; % (res) is an input | |||
>> tsqst = ttestp(1-options.tsqlim,5000,2); % T-test limit from table | >> tsqst = ttestp(1-options.tsqlim,5000,2); % T-test limit from table | ||
>> ii = find(tsq>-tsqst); % finds samples below the line | |||
>> ii = find(tsq>-tsqst); % finds samples below the line</pre> | |||
The ii samples are kept for the next estimate of (yf): | The ii samples are kept for the next estimate of (yf): | ||
>> yf = median(y(ii)); | |||
<pre>>> yf = median(y(ii));</pre> | |||
* y = trace to be filtered, Mx1 vector. | |||
====Inputs==== | |||
* yf = scalar, estimate of filtered data. | |||
* residual = y - yf. | * '''y''' = trace to be filtered, Mx1 vector. | ||
* options = input options echoed back, the field initwt may have been modified. | |||
====Outputs==== | |||
* '''yf''' = scalar, estimate of filtered data. | |||
* '''residual''' = y - yf. | |||
* '''options''' = input options echoed back, the field initwt may have been modified. | |||
===Options === | ===Options === | ||
*'' ''options'' '' = a structure array with the following fields. | |||
* display: [ {'off'} | 'on'] Governs screen display to command line. | *'''''''' ''options'' '' = a structure array with the following fields. | ||
* trbflag: [ {'top'} | 'bottom' | 'middle'] flag that tells algorithm to fit to the top, bottom, or middle of the data cloud. | |||
* tsqlim: [ 0.99 ] limit that govers whether a data point is outside the fit residual defined by input (res). | * '''display''': [ {'off'} | 'on'] Governs screen display to command line. | ||
* initwt: [ ] empty or Mx1 vector of initial weights (0<=w<=1). | * '''trbflag''': [ {'top'} | 'bottom' | 'middle'] flag that tells algorithm to fit to the top, bottom, or middle of the data cloud. | ||
* '''tsqlim''': [ 0.99 ] limit that govers whether a data point is outside the fit residual defined by input (res). | |||
* '''initwt''': [ ] empty or Mx1 vector of initial weights (0<=w<=1). | |||
===See Also=== | ===See Also=== | ||
[[baseline]], [[baslinew]], [[fastnnls]], [[lsq2top]] | [[baseline]], [[baslinew]], [[fastnnls]], [[lsq2top]] |
Latest revision as of 10:31, 10 June 2014
Purpose
Fits a constant to top/(bottom) of data.
Synopsis
- [yf,residual,options] = med2top(y,options)
Description
MED2TOP is similar to LSQ2TOP with a 0 order polynomial, it can be considered an asymmetric estimate of the mean.
For fitting to the bottom:
>> tsq = residual/res; % (res) is an input >> tsqst = ttestp(1-options.tsqlim,5000,2); % T-test limit from table >> ii = find(tsq>-tsqst); % finds samples below the line
The ii samples are kept for the next estimate of (yf):
>> yf = median(y(ii));
Inputs
- y = trace to be filtered, Mx1 vector.
Outputs
- yf = scalar, estimate of filtered data.
- residual = y - yf.
- options = input options echoed back, the field initwt may have been modified.
Options
- ''' options = a structure array with the following fields.
- display: [ {'off'} | 'on'] Governs screen display to command line.
- trbflag: [ {'top'} | 'bottom' | 'middle'] flag that tells algorithm to fit to the top, bottom, or middle of the data cloud.
- tsqlim: [ 0.99 ] limit that govers whether a data point is outside the fit residual defined by input (res).
- initwt: [ ] empty or Mx1 vector of initial weights (0<=w<=1).