Home > marsbar > @mardo_99 > estimate.m

estimate

PURPOSE ^

estimate method - estimates GLM for SPM99 model

SYNOPSIS ^

function [marsD] = estimate(marsD, marsY, params)

DESCRIPTION ^

 estimate method - estimates GLM for SPM99 model

 marsD           - SPM design object
 marsY           - MarsBaR data object, or 2D matrix
 param           - struct containing options
                    (not currently used)

 e.g.
 % Estimate model on design D and data Y
 E = estimate(D, Y);

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [marsD] = estimate(marsD, marsY, params)
0002 % estimate method - estimates GLM for SPM99 model
0003 %
0004 % marsD           - SPM design object
0005 % marsY           - MarsBaR data object, or 2D matrix
0006 % param           - struct containing options
0007 %                    (not currently used)
0008 %
0009 % e.g.
0010 % % Estimate model on design D and data Y
0011 % E = estimate(D, Y);
0012 %
0013 % $Id$
0014 
0015 if nargin < 2
0016   error('Need data to estimate');
0017 end
0018 if nargin < 3
0019   params = [];
0020 end
0021 
0022 % ensure we have a data object
0023 marsY = marsy(marsY);
0024 
0025 % check design is complete
0026 if ~can_mars_estimate(marsD)
0027   error('This design needs more information before it can be estimated');
0028 end
0029 
0030 % Check data and design dimensions
0031 if n_time_points(marsY) ~= n_time_points(marsD)
0032   error('The data and design must have the same number of rows');
0033 end
0034 
0035 % get SPM design structure
0036 SPM = des_struct(marsD);
0037   
0038 % do estimation
0039 SPM       = pr_estimate(SPM, marsY);
0040 SPM.marsY = marsY;
0041 
0042 % We must set SPMid to contain SPM99 string in order for the mardo_99 to
0043 % recognize this as an SPM99 design
0044 SPM.SPMid  = sprintf('SPM99: MarsBaR estimation. mardo_99 version %s', ...
0045              marsD.cvs_version);
0046 
0047 % return modified structure
0048 marsD = des_struct(marsD, SPM);
0049 

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019