|
Doxygen Source Code Documentation
SumsOfSquares.m File Reference
Go to the source code of this file.
|
Functions |
| SS (Error) |
get its residual SS and d f | ssw (1:nterms) |
end if | dfboth (k0)~ |
| ssw (k) |
| sswo (k) |
| ssterm (dfterm==0)=0 |
| C (A) |
| BC (A) ssterm(3) |
| SSC (A) |
| SSBC (A) |
| CD (ABC) |
| ssterm (4) |
| SSD (A) |
| DF (D(A)) |
| SSBD (A) |
| DF (BD(A)) |
| SSCD (A) |
| DF (CD(A)) |
| SSBCD (A) |
| DF (BCD(A)) |
| DF (D(AB)) |
| DF (CD(AB)) |
id | terms: (A) |
| DE (ABC) |
| ABDE (ACDE) |
only terms | ssterm (5) |
| SSE (A) |
| DF (E(A)) |
| SSBE (A) |
| DF (BE(A)) |
| SSCE (A) |
| DF (CE(A)) |
| SSDE (A) |
| DF (DE(A)) |
| SSBCE (A) |
| DF (BCE(A)) |
| SSBDE (A) |
| DF (BDE(A)) |
| SSCDE (A) |
| DF (CDE(A)) |
| SSBCDE (A) |
| DF (BCDE(A)) |
Throw out those four which
do not exist for | intensity (6)] |
| tnames (6)] |
6 | dfe () |
| tnames (8:11) |
| tnames (14)] |
| tnames (8) |
| tnames (10:11)] |
denominator | dfterm (4) |
denominator | dfterm (10) |
| tnames (10:17) |
| tnames (19) |
| tnames (22:26) |
| tnames (30)] |
Only calculate it when denominator
is greater than | fstat (t) |
assign this so that output
argument LC would not be empty
else | if (NF==1) |
| if (tmp > 0) |
LC | t1 (i).t |
end end end Get t values for
contrast | tests (B) |
ABC | for (i=1:1:Contr.ord2.tot) |
ABC LC | t2 (i).t=0 = LC.t2(i).value/sqrt(tmp) |
initializtion in case it is
assigned later on due to denominator
of switch Contr ord2 | cnt (i).idx1 case 1 |
A | BXC: (dsgn==3|dsgn==4 msdenom) |
MSBC else | fprintf ('\nSomething is wrong in the contrast coding!\n') |
| fprintf (2,'Halted:Ctrl+c to exit') |
end end end | if (Contr.ord2.tot > 0) |
end end end | dmat (:, num_col0+num_col1+1:num_col1+num_col0+num_col2) is the matrix for 2nd order contrasts if(Contr.ord3.tot > 0) |
end end end LC | t3 (i).t=0 = Contr.ord3.cnt(i).vec * y0 |
initializtion in case it is
assigned later on due to denominator
of switch Contr ord3 switch
Contr ord3 | if (Contr.ord3.cnt(i).idx3==3) |
end end end end | If (NF==3) if(NF |
Less likely each term of this
contrast | LC2 (i).value = LC2(i).value + Contr2.cnt(i).coef(j) * dmat(:, Contr2.cnt(i).code(j).pos)' * y0 |
initializtion in case it is
assigned later on due to denominator
of | if (dsgn==3) |
MSABD not exist | for (dsgn==3|dsgn==4|dsgn==5) end case 3 |
end end end Get t values for
contrast tests within each | factor (B) |
| elseif (dsgn==3) what |
end end LC | t4 (i).t=0 = LC.t4(i).value/sqrt(tmp) |
MSABCE end switch Contr ord4 | if (Contr.ord4.cnt(i).idx4==5) |
Variables |
| function [err, fstat, intensity_new, dfterm_new, dfdenom, tnames_new, LC] |
which are defined as the sqare
root of MS terms | dfterm |
which are defined as the sqare
root of MS terms Bethesda
MD Define the function name
for easy referencing | FuncName = 'ss.m' |
Debug Flag | DBG = 1 |
initailize return variables | err = 1 |
| dfboth = dfbothSS |
| y0 = y |
y gets mutated down below
Keep the original y so that
the contrasts can be done
later at the end Fit the full
model and compute the residual
sum of squares | mu = mean(y) |
| y = y - mu |
two passes to improve accuracy | mu2 = mean(y) |
| sst = sum(y.^2) |
| SSTO [ssx, y] = dofit(y, Qd) |
y | __pad3__ |
ssx | __pad4__ |
for full model we already
know the results for | j |
Look in unsorted arrays to
see if we have already fit
this model if j nterms | k0 = k+nterms |
else | thismod = modw(k, :) |
end Fit this | model [ssx0, dfx0] = QRfit(X, y, C) |
| ssx0 = dofit(y, s(j).Qdt) |
Use these results for each
term that requires them | mod0 = repmat(thismod, nterms, 1) |
| k = find(all(modw == mod0, 2)) |
end clear mod0 Compute the
sum of squares attributed
to each term | ssterm = ssw - sswo |
make this | exact |
make this | fstat = repmat(0, size(ssterm)) |
only ss | term |
| case |
terms | __pad5__ |
| B |
| C |
| AB |
| AC |
| BC |
end switch dsgn switch dsgn
Order of the | terms |
| D |
| AD |
| BD |
| ABD |
| ACD |
| BCD |
and | ABCD |
| CD |
| ABC |
| E |
| AE |
| BE |
| CE |
| ABE |
| ACE |
| ADE |
| BCE |
| BDE |
| CDE |
| ABCE |
| BCDE |
end switch dsgn end switch
NF Compute the mean square
for each term | msterm = ssterm ./ max(1, dfterm') |
| mse = sse * (dfe>0) / max(1, dfe) |
| intensity = sqrt(msterm) |
Intensity for each term Equated
computed and expected mean | squares |
Intensity for each term Equated
computed and expected mean
then solve for variance component
estimates switch NF | dfterm_new = dfterm |
| tnames_new = tnames |
| msterm_new = msterm |
| intensity_new = intensity |
| msdenom = repmat(mse, size(msterm)) |
| dfdenom = repmat(dfe, size(msterm)) |
terms | __pad6__ |
terms | __pad7__ |
Throw out those four which
do not exist for | nesting |
terms | __pad8__ |
denominator | MS |
denominator | dfe |
denominator DF end end Close
swtich NF Compute an F statistic
for each term | t = (msdenom>0) |
| LC = 0 |
assign this so that output
argument LC would not be empty
else Get t values for contrast
tests within each factor(1st order)%dmat(initializtion
in case it is assigned later
on due to denominator of LC | t1 (i).value = Contr.ord1.cnt(i).vec * y0 |
intensity for this st order
contrast | tmp = msdenom(Contr.ord1.cnt(i).idx1)*Contr.ord1.cnt(i).scalar |
initializtion in case it is
assigned later on due to denominator
of switch Contr ord2 switch
Contr ord2 | what = msdenom(4) |
| pause |
Less likely to | occur |
| scalar = scalar + Contr2.cnt(i).coef(j) * Contr2.cnt(i).coef(j) |
| return |
Function Documentation
A BXC: |
( |
dsgn |
= =3|dsgn==4 msdenom |
) |
[virtual] |
|
initializtion in case it is assigned later on due to denominator of switch Contr ord2 cnt |
( |
i |
|
) |
|
|
denominator dfterm |
( |
10 |
|
) |
|
|
|
Referenced by adjust_endpts(), assign_afni_floats(), attach_sub_brick(), basis_write_iresp(), basis_write_sresp(), calculate_acontrasts(), calculate_adifferences(), calculate_ameans(), calculate_bcontrasts(), calculate_bdifferences(), calculate_bmeans(), check_for_valid_inputs(), DepthCueSlice(), display_coords(), mask_all_shorts_to_float(), mask_shorts_to_float(), mri_to_mri_scl(), process_as_floats(), process_subbrick(), qh_voronoi_center(), r_set_afni_s_from_dset(), rfft(), thd_mask_from_brick(), v2s_adjust_endpts(), write_3dtime(), write_bucket_data(), and write_ts_array(). |
MSABD not exist for |
( |
dsgn |
= = 3 | dsgn == 4 | dsgn == 5 |
) |
|
|
fprintf |
( |
2 |
, |
|
|
'Halted:Ctrl+c to exit' |
|
|
) |
|
|
Only calculate it when denominator is greater than fstat |
( |
t |
|
) |
|
|
MSABCE end switch Contr ord4 if |
( |
Contr.ord4.cnt(i). |
idx4 = = 5 |
) |
|
|
initializtion in case it is assigned later on due to denominator of if |
( |
dsgn |
= = 3 |
) |
|
|
initializtion in case it is assigned later on due to denominator of switch Contr ord3 switch Contr ord3 if |
( |
Contr.ord3.cnt(i). |
idx3 = = 3 |
) |
|
|
Throw out those four which do not exist for intensity |
( |
6 |
|
) |
|
|
Less likely each term of this contrast LC2 |
( |
i |
|
) |
= LC2(i).value + Contr2.cnt(i).coef(j) * dmat(:, Contr2.cnt(i).code(j).pos)' * y0 |
|
ssterm |
( |
dfterm |
= =0 |
) |
[pure virtual] |
|
LC t2 |
( |
i |
|
) |
= LC.t2(i).value/sqrt(tmp) [pure virtual] |
|
|
Referenced by add_quats(), alnrel(), basis_block_hrf4(), basis_block_hrf5(), bgrat(), bisect_(), calc_glt_matrix(), cx_scramble(), dln1px(), fft128(), fft256(), fft512(), fft64(), fft_3dec(), fft_4dec(), get_quadratic_trend(), idct_col(), idct_row(), InvertSym3(), maxtype(), median_float4(), PERMTEST_compute(), putpower(), qzvec_(), stas4(), SUMA_Find_IminImax(), SUMA_FindVoxelsInSurface(), SUMA_FindVoxelsInSurface_SLOW(), SUMA_isinbox(), SUMA_isinsphere(), SUMA_isSelfIntersect(), SUMA_StretchToFitLeCerveau(), THD_cubic_detrend(), tridib_(), tsturm_(), and UTL_SqueezeBlanks(). |
LC t3 |
( |
i |
|
) |
= Contr.ord3.cnt(i).vec * y0 [pure virtual] |
|
LC t4 |
( |
i |
|
) |
= LC.t4(i).value/sqrt(tmp) [pure virtual] |
|
id terms: |
( |
A |
|
) |
[virtual] |
|
Variable Documentation
Throw out those four which do not exist for ACD |
|
denominator MS dfdenom = repmat(dfe, size(msterm)) |
|
fstat = repmat(0, size(ssterm)) |
|
|
Initial value: SumsOFSquares(y, NF, FL, ntot, nterms, Qd, s, sindices, dfbothSS, modw, modwo, tnames, dfterm, dfe, dsgn, N_Brik, Contr)
%
% [err,] = ss.m ()
%
%Purpose:
%
%
%
%Input Parameters:
%
% y: values from all factor combinations at one voxel in vector format
% ntot: total number of files = length of vector y
% tername: term names such as
% termlist:
% dmat: design matrix in the converted regression model
% cmat: constraints matrix
%
%Output Parameters:
% err : 0 No Problem
% : 1 Problems
% fstat: a vector of F values for those terms at a voxel
% intensity_new: intensity for those terms at a voxel
Definition at line 1 of file SumsOfSquares.m. |
Only preserve those valid for nesting Semicolon for coloumn catenation msdenom = repmat(mse, size(msterm)) |
|
mse = sse * (dfe>0) / max(1, dfe) |
|
end switch dsgn end switch NF Compute the mean square for each term msterm = ssterm ./ max(1, dfterm') |
|
two passes to improve accuracy mu2 = mean(y) |
|
denominator DF end end Close swtich NF Compute an F statistic for each term t = (msdenom>0) |
|
|
Referenced by add_quats(), basis_block_hrf4(), basym(), bisect_(), calc_glt_matrix(), ComputeD0(), cx_scramble(), fft128(), fft256(), fft512(), fft64(), fft_3dec(), fft_4dec(), get_linear_trend(), get_quadratic_trend(), gratio(), idct_col(), idct_row(), Inline(), maxtype(), median_float4(), putcall(), putpower(), qzvec_(), rcomp(), shear_xzyx(), stas4(), SUMA_FindVoxelsInSurface(), SUMA_FindVoxelsInSurface_SLOW(), SUMA_isinbox(), SUMA_isinsphere(), SUMA_isSelfIntersect(), THD_cubic_detrend(), tridib_(), tsturm_(), UTL_SqueezeBlanks(), VPCompAC00G(), VPCompAC11B(), VPCompAC1NB(), VPCompAC1NS(), VPCompAC1PB(), VPCompAC31B(), VPCompAC32B(), VPCompAC3NB(), VPCompAC3NS(), VPCompAC3PB(), VPCompAR00G(), VPCompAR11B(), VPCompAR1NB(), VPCompAR1NS(), VPCompAR1PB(), VPCompAR31B(), VPCompAR32B(), VPCompAR3NB(), VPCompAR3NS(), VPCompAR3PB(), VPRenderAffine(), and vpShadeTable(). |
THIS CAN BE DELETED FOR MY CASE since it is not used from this point y = y - mu |
|
|
Definition at line 49 of file SumsOfSquares.m.
Referenced by bratio(), brcmp1(), brcomp(), ClassifyRawVolume(), ComputeOctreeMask(), dbesy0_(), drawBox(), ExtractClassifiedVolume(), ExtractRawVolume(), mri_drawline(), plx_TXT(), pointclip(), POWER_main(), ppmd_circle(), ppmd_line(), ppmd_polyspline(), ppmd_spline3(), ShadeRawVolume(), SUMA_DrawWindowLine(), VPClassifyBlock(), vpExtract(), and VPShadeBlock(). |
|