You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: hewma_from_raw_timeseries.m
    path of file: ./repos/CanlabCore/CanlabCore/hewma_utility
    
    the code of the file until where you have to start completion: function STATS = hewma_from_raw_timeseries(raw_data, varargin)
% :Usage:
% ::
%
%     STATS = hewma_from_raw_timeseries(raw_data, varargin)
%
% :Inputs:
%
%   **obj:**
%        imraw_data, a N subjects x T time points matrix of data

    
function STATS = hewma_from_raw_timeseries(raw_data, varargin)
% :Usage:
% ::
%
%     STATS = hewma_from_raw_timeseries(raw_data, varargin)
%
% :Inputs:
%
%   **obj:**
%        imraw_data, a N subjects x T time points matrix of data
%
% :Optional Inputs:
%
%   For all optional inputs, enter a keyword followed by an input value/argument
%   (this is a standard Matlab format for entering optional arguments)
%   e.g., 'lam', .3 to enter a lambda value of .3
%
%   Here are the optional inputs and their defaults:
%
%   **lam = .2;**
%        ewma smoothing param
%
%   **L = 2;**
%        ewma control limit
%
%   **noisemodel = 'AR(2)';**
%        noise structure type
%
%   **base_timepts = 60;**
%        baseline time points to use
%
%   **doplot = 1;**
%        plot toggle (1/0)
%
%   **dodetrend