spm-python 25.1a1.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spm/__init__.py +828 -0
- spm/__wrapper__.py +343 -0
- spm/_spm/_spm.ctf +0 -0
- spm/file_array.py +529 -0
- spm/gifti.py +570 -0
- spm/meeg.py +1198 -0
- spm/nifti.py +412 -0
- spm/slover.py +597 -0
- spm/spm.py +63 -0
- spm/spm_ADEM.py +57 -0
- spm/spm_ADEM_M_set.py +53 -0
- spm/spm_ADEM_diff.py +27 -0
- spm/spm_ADEM_set.py +20 -0
- spm/spm_ADEM_update.py +25 -0
- spm/spm_ALAP.py +159 -0
- spm/spm_A_reduce.py +26 -0
- spm/spm_BIDS.py +29 -0
- spm/spm_BMS.py +43 -0
- spm/spm_BMS_F.py +28 -0
- spm/spm_BMS_F_smpl.py +21 -0
- spm/spm_BMS_bor.py +28 -0
- spm/spm_BMS_gibbs.py +29 -0
- spm/spm_Bcdf.py +56 -0
- spm/spm_Bpdf.py +56 -0
- spm/spm_Ce.py +34 -0
- spm/spm_DEM.py +100 -0
- spm/spm_DEM_F.py +22 -0
- spm/spm_DEM_M_set.py +58 -0
- spm/spm_DEM_R.py +28 -0
- spm/spm_DEM_diff.py +27 -0
- spm/spm_DEM_embed.py +23 -0
- spm/spm_DEM_eval.py +48 -0
- spm/spm_DEM_eval_diff.py +27 -0
- spm/spm_DEM_generate.py +36 -0
- spm/spm_DEM_int.py +27 -0
- spm/spm_DEM_qH.py +25 -0
- spm/spm_DEM_qP.py +20 -0
- spm/spm_DEM_qU.py +23 -0
- spm/spm_DEM_set.py +20 -0
- spm/spm_DEM_z.py +24 -0
- spm/spm_DFP.py +87 -0
- spm/spm_DFP_plot.py +19 -0
- spm/spm_DesMtx.py +213 -0
- spm/spm_DesRep.py +128 -0
- spm/spm_DisplayTimeSeries.py +67 -0
- spm/spm_Dpdf.py +32 -0
- spm/spm_ECdensity.py +18 -0
- spm/spm_FcUtil.py +136 -0
- spm/spm_Fcdf.py +72 -0
- spm/spm_Fpdf.py +65 -0
- spm/spm_GDEM.py +117 -0
- spm/spm_Gcdf.py +71 -0
- spm/spm_Gpdf.py +63 -0
- spm/spm_Icdf.py +78 -0
- spm/spm_Ipdf.py +76 -0
- spm/spm_KL_cat.py +23 -0
- spm/spm_KL_dir.py +26 -0
- spm/spm_LAP.py +99 -0
- spm/spm_LAPF.py +77 -0
- spm/spm_LAPS.py +77 -0
- spm/spm_LAP_F.py +24 -0
- spm/spm_LAP_eval.py +26 -0
- spm/spm_LAP_iS.py +21 -0
- spm/spm_LAP_pg.py +19 -0
- spm/spm_LAP_ph.py +19 -0
- spm/spm_Laplace.py +32 -0
- spm/spm_MB_col.py +16 -0
- spm/spm_MDP_MI.py +26 -0
- spm/spm_MDP_da.py +18 -0
- spm/spm_MH.py +28 -0
- spm/spm_MH_reml.py +28 -0
- spm/spm_MH_reml_likelihood.py +20 -0
- spm/spm_Markov_blanket.py +30 -0
- spm/spm_Menu.py +24 -0
- spm/spm_NESS_F.py +35 -0
- spm/spm_NESS_ds.py +35 -0
- spm/spm_NESS_gen.py +48 -0
- spm/spm_NESS_gen_lap.py +44 -0
- spm/spm_Ncdf.py +61 -0
- spm/spm_Ncdf_jdw.py +32 -0
- spm/spm_Npdf.py +52 -0
- spm/spm_P.py +41 -0
- spm/spm_PEB.py +68 -0
- spm/spm_P_Bonf.py +35 -0
- spm/spm_P_FDR.py +87 -0
- spm/spm_P_RF.py +59 -0
- spm/spm_P_clusterFDR.py +26 -0
- spm/spm_P_peakFDR.py +38 -0
- spm/spm_Pcdf.py +69 -0
- spm/spm_Pec_resels.py +21 -0
- spm/spm_Ppdf.py +63 -0
- spm/spm_Q.py +31 -0
- spm/spm_Q_perm.py +15 -0
- spm/spm_ROI.py +30 -0
- spm/spm_SpUtil.py +266 -0
- spm/spm_Tcdf.py +71 -0
- spm/spm_Tpdf.py +56 -0
- spm/spm_VBX.py +45 -0
- spm/spm_VOI.py +63 -0
- spm/spm_Volt_W.py +17 -0
- spm/spm_Volterra.py +33 -0
- spm/spm_Welcome.py +16 -0
- spm/spm_XYZreg.py +177 -0
- spm/spm_XYZreg_Ex2.py +44 -0
- spm/spm_Xcdf.py +60 -0
- spm/spm_Xpdf.py +57 -0
- spm/spm_affine_priors.py +17 -0
- spm/spm_ancova.py +35 -0
- spm/spm_api_bmc.py +25 -0
- spm/spm_ar_reml.py +30 -0
- spm/spm_argmax.py +26 -0
- spm/spm_atlas.py +27 -0
- spm/spm_authors.py +17 -0
- spm/spm_axis.py +13 -0
- spm/spm_barh.py +18 -0
- spm/spm_bayes2_logbf.py +20 -0
- spm/spm_beta_compare.py +27 -0
- spm/spm_betaln.py +24 -0
- spm/spm_bilinear.py +36 -0
- spm/spm_bilinear_condition.py +16 -0
- spm/spm_bireduce.py +46 -0
- spm/spm_bms_against_null.py +20 -0
- spm/spm_bms_anova.py +31 -0
- spm/spm_bms_anova_img.py +21 -0
- spm/spm_bms_compare_groups.py +26 -0
- spm/spm_bms_display.py +22 -0
- spm/spm_bms_display_ROI.py +20 -0
- spm/spm_bms_display_vox.py +18 -0
- spm/spm_bms_partition.py +22 -0
- spm/spm_bms_test_null.py +20 -0
- spm/spm_bms_ttest.py +31 -0
- spm/spm_browser.py +21 -0
- spm/spm_bsplinc.py +43 -0
- spm/spm_bsplins.py +49 -0
- spm/spm_bwlabel.py +30 -0
- spm/spm_cat.py +31 -0
- spm/spm_cat_struct.py +15 -0
- spm/spm_cell_swap.py +16 -0
- spm/spm_changepath.py +28 -0
- spm/spm_check_filename.py +17 -0
- spm/spm_check_installation.py +26 -0
- spm/spm_check_orientations.py +22 -0
- spm/spm_check_registration.py +22 -0
- spm/spm_check_results.py +19 -0
- spm/spm_check_version.py +75 -0
- spm/spm_circularGraph.py +23 -0
- spm/spm_clf.py +27 -0
- spm/spm_cli.py +14 -0
- spm/spm_clusters.py +25 -0
- spm/spm_colourmap.py +46 -0
- spm/spm_combinations.py +18 -0
- spm/spm_compact_svd.py +18 -0
- spm/spm_compare_families.py +54 -0
- spm/spm_cond_units.py +17 -0
- spm/spm_conman.py +247 -0
- spm/spm_contrasts.py +21 -0
- spm/spm_conv.py +25 -0
- spm/spm_conv_full.py +24 -0
- spm/spm_conv_vol.py +41 -0
- spm/spm_convmtx.py +27 -0
- spm/spm_copy.py +25 -0
- spm/spm_coreg.py +57 -0
- spm/spm_cov2corr.py +15 -0
- spm/spm_create_vol.py +16 -0
- spm/spm_cross.py +23 -0
- spm/spm_csd_fmri_gu.py +21 -0
- spm/spm_csd_fmri_mar.py +34 -0
- spm/spm_csd_fmri_mtf.py +36 -0
- spm/spm_cva.py +77 -0
- spm/spm_cva_ui.py +92 -0
- spm/spm_dartel_integrate.py +30 -0
- spm/spm_data_hdr_read.py +18 -0
- spm/spm_data_hdr_write.py +16 -0
- spm/spm_data_id.py +17 -0
- spm/spm_data_read.py +32 -0
- spm/spm_data_write.py +22 -0
- spm/spm_dcm_HMM.py +58 -0
- spm/spm_dcm_HMM_plot.py +30 -0
- spm/spm_dcm_J.py +78 -0
- spm/spm_dcm_KL.py +21 -0
- spm/spm_dcm_U.py +33 -0
- spm/spm_dcm_average.py +42 -0
- spm/spm_dcm_bdc.py +55 -0
- spm/spm_dcm_bma.py +98 -0
- spm/spm_dcm_bma_results.py +17 -0
- spm/spm_dcm_bmc.py +45 -0
- spm/spm_dcm_bmc_peb.py +80 -0
- spm/spm_dcm_bmr.py +49 -0
- spm/spm_dcm_bmr_all.py +78 -0
- spm/spm_dcm_bpa.py +53 -0
- spm/spm_dcm_check_stability.py +23 -0
- spm/spm_dcm_compare.py +17 -0
- spm/spm_dcm_connectivity_ui.py +26 -0
- spm/spm_dcm_contrasts.py +20 -0
- spm/spm_dcm_create.py +33 -0
- spm/spm_dcm_csd_Q.py +43 -0
- spm/spm_dcm_delay.py +38 -0
- spm/spm_dcm_diagnose.py +44 -0
- spm/spm_dcm_display.py +20 -0
- spm/spm_dcm_estimate.py +65 -0
- spm/spm_dcm_evidence.py +26 -0
- spm/spm_dcm_fit.py +29 -0
- spm/spm_dcm_fmri_check.py +57 -0
- spm/spm_dcm_fmri_csd.py +50 -0
- spm/spm_dcm_fmri_csd_DEM.py +50 -0
- spm/spm_dcm_fmri_csd_data.py +25 -0
- spm/spm_dcm_fmri_csd_gen.py +21 -0
- spm/spm_dcm_fmri_csd_results.py +31 -0
- spm/spm_dcm_fmri_graph_gen.py +19 -0
- spm/spm_dcm_fmri_image.py +17 -0
- spm/spm_dcm_fmri_mar.py +47 -0
- spm/spm_dcm_fmri_mode.py +23 -0
- spm/spm_dcm_fmri_mode_gen.py +23 -0
- spm/spm_dcm_fmri_nmm.py +61 -0
- spm/spm_dcm_fmri_priors.py +38 -0
- spm/spm_dcm_generate.py +32 -0
- spm/spm_dcm_graph.py +18 -0
- spm/spm_dcm_graph_functional.py +21 -0
- spm/spm_dcm_identify.py +18 -0
- spm/spm_dcm_load.py +23 -0
- spm/spm_dcm_loo.py +43 -0
- spm/spm_dcm_mdp.py +44 -0
- spm/spm_dcm_mtf.py +35 -0
- spm/spm_dcm_optimise.py +36 -0
- spm/spm_dcm_peb.py +108 -0
- spm/spm_dcm_peb_bmc.py +108 -0
- spm/spm_dcm_peb_bmc_fam.py +50 -0
- spm/spm_dcm_peb_con.py +53 -0
- spm/spm_dcm_peb_fit.py +82 -0
- spm/spm_dcm_peb_full.py +83 -0
- spm/spm_dcm_peb_review.py +20 -0
- spm/spm_dcm_peb_rnd.py +51 -0
- spm/spm_dcm_peb_rnd_search.py +51 -0
- spm/spm_dcm_peb_test.py +56 -0
- spm/spm_dcm_peb_to_gcm.py +61 -0
- spm/spm_dcm_post_hoc.py +85 -0
- spm/spm_dcm_post_hoc_old.py +79 -0
- spm/spm_dcm_ppd.py +48 -0
- spm/spm_dcm_reduce.py +15 -0
- spm/spm_dcm_review.py +29 -0
- spm/spm_dcm_search.py +44 -0
- spm/spm_dcm_sessions.py +36 -0
- spm/spm_dcm_simulate.py +42 -0
- spm/spm_dcm_sparse.py +51 -0
- spm/spm_dcm_sparse_priors.py +23 -0
- spm/spm_dcm_specify.py +107 -0
- spm/spm_dcm_specify_ui.py +40 -0
- spm/spm_dcm_ui.py +77 -0
- spm/spm_dcm_voi.py +25 -0
- spm/spm_dctmtx.py +39 -0
- spm/spm_ddiff.py +38 -0
- spm/spm_deface.py +21 -0
- spm/spm_defaults.py +33 -0
- spm/spm_deformations.py +21 -0
- spm/spm_dem2dcm.py +29 -0
- spm/spm_design_contrasts.py +29 -0
- spm/spm_design_factorial.py +23 -0
- spm/spm_design_flexible.py +23 -0
- spm/spm_design_within_subject.py +21 -0
- spm/spm_detrend.py +23 -0
- spm/spm_dftmtx.py +25 -0
- spm/spm_diag.py +17 -0
- spm/spm_diag_array.py +17 -0
- spm/spm_dicom_convert.py +46 -0
- spm/spm_dicom_essentials.py +21 -0
- spm/spm_dicom_header.py +35 -0
- spm/spm_dicom_headers.py +25 -0
- spm/spm_dicom_metadata.py +24 -0
- spm/spm_dicom_text_to_dict.py +30 -0
- spm/spm_diff.py +38 -0
- spm/spm_diff_dx.py +23 -0
- spm/spm_diffeo.py +464 -0
- spm/spm_dilate.py +40 -0
- spm/spm_dir_MI.py +24 -0
- spm/spm_dir_norm.py +19 -0
- spm/spm_dir_sort.py +21 -0
- spm/spm_dirichlet_exceedance.py +32 -0
- spm/spm_dot.py +32 -0
- spm/spm_dwtmtx.py +24 -0
- spm/spm_dx.py +57 -0
- spm/spm_dx_eig.py +57 -0
- spm/spm_ecat2nifti.py +19 -0
- spm/spm_eeg_artefact.py +50 -0
- spm/spm_eeg_artefact_events.py +27 -0
- spm/spm_eeg_artefact_eyeblink.py +28 -0
- spm/spm_eeg_artefact_flat.py +27 -0
- spm/spm_eeg_artefact_heartbeat.py +29 -0
- spm/spm_eeg_artefact_jump.py +27 -0
- spm/spm_eeg_artefact_nans.py +27 -0
- spm/spm_eeg_artefact_peak2peak.py +27 -0
- spm/spm_eeg_artefact_saccade.py +33 -0
- spm/spm_eeg_artefact_threshchan.py +27 -0
- spm/spm_eeg_artefact_zscore.py +27 -0
- spm/spm_eeg_artefact_zscorediff.py +27 -0
- spm/spm_eeg_assemble_priors.py +19 -0
- spm/spm_eeg_average.py +29 -0
- spm/spm_eeg_average_TF.py +30 -0
- spm/spm_eeg_avgfreq.py +24 -0
- spm/spm_eeg_avgtime.py +26 -0
- spm/spm_eeg_bc.py +30 -0
- spm/spm_eeg_cfc.py +30 -0
- spm/spm_eeg_collapse_timefreq.py +24 -0
- spm/spm_eeg_combineplanar.py +31 -0
- spm/spm_eeg_contrast.py +37 -0
- spm/spm_eeg_convert.py +59 -0
- spm/spm_eeg_convert2images.py +43 -0
- spm/spm_eeg_convert_ui.py +17 -0
- spm/spm_eeg_copy.py +22 -0
- spm/spm_eeg_correct_sensor_data.py +28 -0
- spm/spm_eeg_crop.py +26 -0
- spm/spm_eeg_definetrial.py +32 -0
- spm/spm_eeg_dipoles_ui.py +15 -0
- spm/spm_eeg_displayECD.py +30 -0
- spm/spm_eeg_display_tf.py +17 -0
- spm/spm_eeg_downsample.py +30 -0
- spm/spm_eeg_epochs.py +59 -0
- spm/spm_eeg_filter.py +35 -0
- spm/spm_eeg_firstlevel.py +21 -0
- spm/spm_eeg_fixpnt.py +15 -0
- spm/spm_eeg_ft2spm.py +15 -0
- spm/spm_eeg_fuse.py +25 -0
- spm/spm_eeg_grandmean.py +36 -0
- spm/spm_eeg_history.py +32 -0
- spm/spm_eeg_inv_Mesh2Voxels.py +38 -0
- spm/spm_eeg_inv_check.py +23 -0
- spm/spm_eeg_inv_checkdatareg.py +17 -0
- spm/spm_eeg_inv_checkforward.py +15 -0
- spm/spm_eeg_inv_checkmeshes.py +21 -0
- spm/spm_eeg_inv_custom_ui.py +31 -0
- spm/spm_eeg_inv_datareg.py +43 -0
- spm/spm_eeg_inv_datareg_ui.py +22 -0
- spm/spm_eeg_inv_extract.py +25 -0
- spm/spm_eeg_inv_extract_ui.py +19 -0
- spm/spm_eeg_inv_fmripriors.py +40 -0
- spm/spm_eeg_inv_forward.py +22 -0
- spm/spm_eeg_inv_forward_ui.py +23 -0
- spm/spm_eeg_inv_get_vol_sens.py +23 -0
- spm/spm_eeg_inv_group.py +38 -0
- spm/spm_eeg_inv_headcoordinates.py +24 -0
- spm/spm_eeg_inv_icp.py +41 -0
- spm/spm_eeg_inv_imag_api.py +17 -0
- spm/spm_eeg_inv_image_display.py +18 -0
- spm/spm_eeg_inv_mesh.py +23 -0
- spm/spm_eeg_inv_mesh_spherify.py +28 -0
- spm/spm_eeg_inv_mesh_ui.py +26 -0
- spm/spm_eeg_inv_prep_modes_xval.py +35 -0
- spm/spm_eeg_inv_results.py +24 -0
- spm/spm_eeg_inv_results_display.py +15 -0
- spm/spm_eeg_inv_results_ui.py +19 -0
- spm/spm_eeg_inv_rigidreg.py +22 -0
- spm/spm_eeg_inv_spatnorm.py +23 -0
- spm/spm_eeg_inv_transform_mesh.py +18 -0
- spm/spm_eeg_inv_transform_points.py +15 -0
- spm/spm_eeg_inv_vb_ecd_gui.py +49 -0
- spm/spm_eeg_inv_vbecd.py +41 -0
- spm/spm_eeg_inv_vbecd_disp.py +22 -0
- spm/spm_eeg_inv_vbecd_getLF.py +28 -0
- spm/spm_eeg_inv_vbecd_gui.py +18 -0
- spm/spm_eeg_inv_vbecd_mom.py +40 -0
- spm/spm_eeg_inv_visu3D_api.py +20 -0
- spm/spm_eeg_invert.py +132 -0
- spm/spm_eeg_invert_EBoptimise.py +31 -0
- spm/spm_eeg_invert_bma.py +20 -0
- spm/spm_eeg_invert_classic.py +73 -0
- spm/spm_eeg_invert_classic_mix.py +28 -0
- spm/spm_eeg_invert_classic_volumetric.py +78 -0
- spm/spm_eeg_invert_display.py +22 -0
- spm/spm_eeg_invert_prepro.py +35 -0
- spm/spm_eeg_invert_setuppatches.py +28 -0
- spm/spm_eeg_invert_ui.py +26 -0
- spm/spm_eeg_invertiter.py +23 -0
- spm/spm_eeg_lapmtx.py +20 -0
- spm/spm_eeg_layout3D.py +16 -0
- spm/spm_eeg_lgainmat.py +19 -0
- spm/spm_eeg_load.py +22 -0
- spm/spm_eeg_locate_channels.py +29 -0
- spm/spm_eeg_mask.py +22 -0
- spm/spm_eeg_mask2channels.py +22 -0
- spm/spm_eeg_merge.py +68 -0
- spm/spm_eeg_meshnative2mni.py +19 -0
- spm/spm_eeg_modality_ui.py +24 -0
- spm/spm_eeg_montage.py +62 -0
- spm/spm_eeg_montage_ui.py +22 -0
- spm/spm_eeg_morlet.py +36 -0
- spm/spm_eeg_planarchannelset.py +18 -0
- spm/spm_eeg_plotScalpData.py +30 -0
- spm/spm_eeg_prep.py +27 -0
- spm/spm_eeg_prep_ui.py +16 -0
- spm/spm_eeg_project3D.py +16 -0
- spm/spm_eeg_read_bsa.py +18 -0
- spm/spm_eeg_reduce.py +35 -0
- spm/spm_eeg_reduce_cva.py +26 -0
- spm/spm_eeg_reduce_imagcsd.py +27 -0
- spm/spm_eeg_reduce_pca.py +26 -0
- spm/spm_eeg_reduce_pca_adapt.py +26 -0
- spm/spm_eeg_reduce_whiten.py +26 -0
- spm/spm_eeg_regressors.py +28 -0
- spm/spm_eeg_regressors_chandata.py +25 -0
- spm/spm_eeg_regressors_movement_ctf.py +25 -0
- spm/spm_eeg_regressors_tfphase.py +25 -0
- spm/spm_eeg_regressors_tfpower.py +25 -0
- spm/spm_eeg_remove_bad_trials.py +27 -0
- spm/spm_eeg_render.py +43 -0
- spm/spm_eeg_review.py +21 -0
- spm/spm_eeg_review_callbacks.py +14 -0
- spm/spm_eeg_review_switchDisplay.py +14 -0
- spm/spm_eeg_review_uis.py +14 -0
- spm/spm_eeg_robust_averaget.py +19 -0
- spm/spm_eeg_select_event_ui.py +15 -0
- spm/spm_eeg_simulate.py +29 -0
- spm/spm_eeg_simulate_frominv.py +22 -0
- spm/spm_eeg_smoothmesh_mm.py +18 -0
- spm/spm_eeg_spatial_confounds.py +21 -0
- spm/spm_eeg_specest_hilbert.py +33 -0
- spm/spm_eeg_specest_morlet.py +34 -0
- spm/spm_eeg_specest_mtmconvol.py +36 -0
- spm/spm_eeg_specest_mtmfft.py +33 -0
- spm/spm_eeg_spmft_chan_dictionary.py +15 -0
- spm/spm_eeg_tf.py +54 -0
- spm/spm_eeg_tf_rescale.py +37 -0
- spm/spm_eeg_wrap_dipfit_vbecd.py +24 -0
- spm/spm_eeg_wrap_momfit_vbecd.py +25 -0
- spm/spm_ekf.py +35 -0
- spm/spm_en.py +21 -0
- spm/spm_epharm.py +24 -0
- spm/spm_erode.py +40 -0
- spm/spm_est_V.py +19 -0
- spm/spm_est_non_sphericity.py +40 -0
- spm/spm_est_smoothness.py +63 -0
- spm/spm_existfile.py +24 -0
- spm/spm_expm.py +23 -0
- spm/spm_extract_files.py +16 -0
- spm/spm_extrapolate_def.py +21 -0
- spm/spm_fMRI_design.py +176 -0
- spm/spm_field.py +136 -0
- spm/spm_fieldindices.py +25 -0
- spm/spm_figure.py +55 -0
- spm/spm_file.py +64 -0
- spm/spm_file_ext.py +23 -0
- spm/spm_file_merge.py +28 -0
- spm/spm_file_split.py +19 -0
- spm/spm_fileparts.py +21 -0
- spm/spm_filter.py +36 -0
- spm/spm_find_pC.py +30 -0
- spm/spm_flip_analyze_images.py +19 -0
- spm/spm_fmin.py +34 -0
- spm/spm_fmri_concatenate.py +32 -0
- spm/spm_fmri_spm_ui.py +182 -0
- spm/spm_fn_reml.py +32 -0
- spm/spm_fp.py +35 -0
- spm/spm_fp_display_density.py +21 -0
- spm/spm_fp_display_nullclines.py +20 -0
- spm/spm_fp_fmin.py +25 -0
- spm/spm_fp_fun.py +25 -0
- spm/spm_fs_fmri_csd.py +23 -0
- spm/spm_funcheck.py +18 -0
- spm/spm_funfun.py +21 -0
- spm/spm_fx_fmri.py +44 -0
- spm/spm_fx_fmri_linear.py +40 -0
- spm/spm_fx_hdm.py +37 -0
- spm/spm_fx_lz.py +18 -0
- spm/spm_fx_poly.py +20 -0
- spm/spm_gamrnd.py +29 -0
- spm/spm_gen_fmri.py +40 -0
- spm/spm_getSPM.py +192 -0
- spm/spm_get_anatomical_layout.py +90 -0
- spm/spm_get_bbox.py +23 -0
- spm/spm_get_bf.py +39 -0
- spm/spm_get_closest_affine.py +34 -0
- spm/spm_get_data.py +23 -0
- spm/spm_get_dataset.py +19 -0
- spm/spm_get_defaults.py +29 -0
- spm/spm_get_lm.py +31 -0
- spm/spm_get_matdim.py +30 -0
- spm/spm_get_ons.py +48 -0
- spm/spm_get_space.py +18 -0
- spm/spm_get_vc.py +37 -0
- spm/spm_get_volumes.py +17 -0
- spm/spm_glass.py +31 -0
- spm/spm_global.py +24 -0
- spm/spm_gn_fmin.py +26 -0
- spm/spm_graph.py +34 -0
- spm/spm_graph_ui.py +78 -0
- spm/spm_grid.py +21 -0
- spm/spm_gx_fmri.py +25 -0
- spm/spm_gx_fmri_linear.py +25 -0
- spm/spm_gx_hdm.py +24 -0
- spm/spm_gx_state_fmri.py +26 -0
- spm/spm_hanning.py +17 -0
- spm/spm_hdm_priors.py +34 -0
- spm/spm_hdm_ui.py +25 -0
- spm/spm_help.py +66 -0
- spm/spm_hilbert.py +18 -0
- spm/spm_hist.py +17 -0
- spm/spm_hist2.py +29 -0
- spm/spm_hist_smooth.py +17 -0
- spm/spm_hrf.py +42 -0
- spm/spm_image.py +58 -0
- spm/spm_imatrix.py +20 -0
- spm/spm_imcalc.py +92 -0
- spm/spm_ind2sub.py +31 -0
- spm/spm_inline2func.py +15 -0
- spm/spm_input.py +181 -0
- spm/spm_int.py +65 -0
- spm/spm_int_B.py +69 -0
- spm/spm_int_D.py +67 -0
- spm/spm_int_E.py +68 -0
- spm/spm_int_J.py +71 -0
- spm/spm_int_L.py +70 -0
- spm/spm_int_ode.py +70 -0
- spm/spm_int_sde.py +71 -0
- spm/spm_interp.py +17 -0
- spm/spm_inv.py +22 -0
- spm/spm_invBcdf.py +60 -0
- spm/spm_invFcdf.py +71 -0
- spm/spm_invGcdf.py +64 -0
- spm/spm_invIcdf.py +57 -0
- spm/spm_invNcdf.py +72 -0
- spm/spm_invPcdf.py +56 -0
- spm/spm_invTcdf.py +74 -0
- spm/spm_invXcdf.py +56 -0
- spm/spm_inv_phi.py +17 -0
- spm/spm_inv_spd.py +20 -0
- spm/spm_ipharm.py +24 -0
- spm/spm_iwft.py +19 -0
- spm/spm_jobman.py +66 -0
- spm/spm_jsonread.py +28 -0
- spm/spm_jsonwrite.py +34 -0
- spm/spm_kernels.py +44 -0
- spm/spm_kl_dirichlet.py +23 -0
- spm/spm_kl_gamma.py +20 -0
- spm/spm_kl_normal.py +22 -0
- spm/spm_kl_normald.py +24 -0
- spm/spm_kl_wishart.py +21 -0
- spm/spm_kron.py +27 -0
- spm/spm_krutil.py +57 -0
- spm/spm_large_dcm_reduce.py +27 -0
- spm/spm_length.py +23 -0
- spm/spm_lg_gamma.py +23 -0
- spm/spm_list.py +124 -0
- spm/spm_load.py +21 -0
- spm/spm_load_priors8.py +22 -0
- spm/spm_log.py +15 -0
- spm/spm_log_evidence.py +39 -0
- spm/spm_log_evidence_reduce.py +34 -0
- spm/spm_logdet.py +20 -0
- spm/spm_lorenz_k.py +20 -0
- spm/spm_lotka_volterra.py +28 -0
- spm/spm_maff8.py +30 -0
- spm/spm_make_contrasts.py +36 -0
- spm/spm_marginal.py +20 -0
- spm/spm_mask.py +31 -0
- spm/spm_match_str.py +21 -0
- spm/spm_matrix.py +54 -0
- spm/spm_max.py +33 -0
- spm/spm_mb_ui.py +135 -0
- spm/spm_meanby.py +28 -0
- spm/spm_mesh.py +17 -0
- spm/spm_mesh_adjacency.py +18 -0
- spm/spm_mesh_area.py +25 -0
- spm/spm_mesh_borders.py +19 -0
- spm/spm_mesh_bounding_volume.py +22 -0
- spm/spm_mesh_calc.py +23 -0
- spm/spm_mesh_clusters.py +20 -0
- spm/spm_mesh_contour.py +35 -0
- spm/spm_mesh_cube.py +20 -0
- spm/spm_mesh_curvature.py +18 -0
- spm/spm_mesh_detect.py +17 -0
- spm/spm_mesh_dist.py +26 -0
- spm/spm_mesh_distmtx.py +21 -0
- spm/spm_mesh_edges.py +20 -0
- spm/spm_mesh_euler.py +26 -0
- spm/spm_mesh_geodesic.py +34 -0
- spm/spm_mesh_get_lm.py +20 -0
- spm/spm_mesh_inflate.py +20 -0
- spm/spm_mesh_inside.py +41 -0
- spm/spm_mesh_isoline.py +38 -0
- spm/spm_mesh_isosurface.py +23 -0
- spm/spm_mesh_join.py +21 -0
- spm/spm_mesh_label.py +22 -0
- spm/spm_mesh_laplacian.py +23 -0
- spm/spm_mesh_mass_matrix.py +17 -0
- spm/spm_mesh_max.py +27 -0
- spm/spm_mesh_neighbours.py +21 -0
- spm/spm_mesh_normals.py +20 -0
- spm/spm_mesh_polyhedron.py +22 -0
- spm/spm_mesh_project.py +26 -0
- spm/spm_mesh_ray_intersect.py +40 -0
- spm/spm_mesh_ray_triangle.py +32 -0
- spm/spm_mesh_reduce.py +35 -0
- spm/spm_mesh_refine.py +25 -0
- spm/spm_mesh_render.py +49 -0
- spm/spm_mesh_resels.py +31 -0
- spm/spm_mesh_sdf.py +43 -0
- spm/spm_mesh_select.py +20 -0
- spm/spm_mesh_smooth.py +22 -0
- spm/spm_mesh_sphere.py +22 -0
- spm/spm_mesh_split.py +20 -0
- spm/spm_mesh_to_grid.py +20 -0
- spm/spm_mesh_transform.py +18 -0
- spm/spm_mesh_utils.py +26 -0
- spm/spm_mesh_volume.py +18 -0
- spm/spm_mesh_voxelise.py +30 -0
- spm/spm_mfx.py +88 -0
- spm/spm_minmax.py +23 -0
- spm/spm_mip.py +46 -0
- spm/spm_mip_ui.py +79 -0
- spm/spm_mkdir.py +19 -0
- spm/spm_mldivide.py +25 -0
- spm/spm_mnc2nifti.py +26 -0
- spm/spm_morlet.py +25 -0
- spm/spm_morlet_conv.py +26 -0
- spm/spm_mrdivide.py +25 -0
- spm/spm_mrf.py +54 -0
- spm/spm_mtx_cos.py +19 -0
- spm/spm_multrnd.py +20 -0
- spm/spm_mvNpdf.py +34 -0
- spm/spm_mvb.py +79 -0
- spm/spm_mvb_G.py +48 -0
- spm/spm_mvb_R2.py +18 -0
- spm/spm_mvb_U.py +29 -0
- spm/spm_mvb_bmc.py +20 -0
- spm/spm_mvb_cvk.py +26 -0
- spm/spm_mvb_cvk2.py +27 -0
- spm/spm_mvb_cvk_display.py +16 -0
- spm/spm_mvb_display.py +16 -0
- spm/spm_mvb_estimate.py +77 -0
- spm/spm_mvb_p.py +25 -0
- spm/spm_mvb_ui.py +87 -0
- spm/spm_nCr.py +70 -0
- spm/spm_ncFcdf.py +22 -0
- spm/spm_ncFpdf.py +27 -0
- spm/spm_ncTcdf.py +26 -0
- spm/spm_ncTpdf.py +27 -0
- spm/spm_ndgrid.py +21 -0
- spm/spm_ness.py +43 -0
- spm/spm_ness_GN.py +37 -0
- spm/spm_ness_J.py +15 -0
- spm/spm_ness_Lap.py +37 -0
- spm/spm_ness_N2Sp.py +18 -0
- spm/spm_ness_Sp2N.py +22 -0
- spm/spm_ness_Sp2p.py +21 -0
- spm/spm_ness_U.py +39 -0
- spm/spm_ness_cond.py +25 -0
- spm/spm_ness_flows.py +21 -0
- spm/spm_ness_hd.py +37 -0
- spm/spm_ness_m2S.py +20 -0
- spm/spm_ness_p2Sp.py +21 -0
- spm/spm_nlsi.py +99 -0
- spm/spm_nlsi_AI.py +94 -0
- spm/spm_nlsi_GN.py +106 -0
- spm/spm_nlsi_GN_H.py +69 -0
- spm/spm_nlsi_LS.py +95 -0
- spm/spm_nlsi_N.py +94 -0
- spm/spm_nlsi_Newton.py +56 -0
- spm/spm_non_sphericity.py +67 -0
- spm/spm_normrnd.py +21 -0
- spm/spm_opm_amm.py +28 -0
- spm/spm_orientations.py +57 -0
- spm/spm_orth.py +25 -0
- spm/spm_orthpoly.py +21 -0
- spm/spm_orthviews.py +161 -0
- spm/spm_padarray.py +24 -0
- spm/spm_parrec2nifti.py +21 -0
- spm/spm_pca_get_transforms.py +12 -0
- spm/spm_pca_project_velocity.py +18 -0
- spm/spm_pca_sample_brains.py +24 -0
- spm/spm_pca_sample_deformation.py +17 -0
- spm/spm_pca_transform_mesh.py +23 -0
- spm/spm_pca_transform_volume.py +20 -0
- spm/spm_pca_warps.py +26 -0
- spm/spm_peb_ppi.py +57 -0
- spm/spm_percentile.py +26 -0
- spm/spm_perm_mtx.py +20 -0
- spm/spm_permute_kron.py +18 -0
- spm/spm_pf.py +37 -0
- spm/spm_phase_shuffle.py +17 -0
- spm/spm_phi.py +17 -0
- spm/spm_phi_dot.py +16 -0
- spm/spm_pinv.py +19 -0
- spm/spm_platform.py +51 -0
- spm/spm_plot_ci.py +37 -0
- spm/spm_plot_convergence.py +22 -0
- spm/spm_polymtx.py +29 -0
- spm/spm_powell.py +28 -0
- spm/spm_preproc.py +27 -0
- spm/spm_preproc8.py +82 -0
- spm/spm_preproc_run.py +38 -0
- spm/spm_preproc_write8.py +15 -0
- spm/spm_print.py +22 -0
- spm/spm_progress_bar.py +30 -0
- spm/spm_project.py +31 -0
- spm/spm_psi.py +21 -0
- spm/spm_rand_mar.py +20 -0
- spm/spm_rand_power_law.py +24 -0
- spm/spm_read_netcdf.py +19 -0
- spm/spm_read_vols.py +25 -0
- spm/spm_realign.py +96 -0
- spm/spm_regions.py +60 -0
- spm/spm_reml.py +47 -0
- spm/spm_reml_A.py +45 -0
- spm/spm_reml_ancova.py +41 -0
- spm/spm_reml_sc.py +54 -0
- spm/spm_render.py +43 -0
- spm/spm_render_vol.py +39 -0
- spm/spm_reorder_contrasts.py +19 -0
- spm/spm_resels.py +35 -0
- spm/spm_resels_vol.py +31 -0
- spm/spm_reslice.py +69 -0
- spm/spm_results_nidm.py +33 -0
- spm/spm_results_ui.py +134 -0
- spm/spm_rmpath.py +27 -0
- spm/spm_robust_average.py +20 -0
- spm/spm_robust_glm.py +28 -0
- spm/spm_s2csd.py +20 -0
- spm/spm_sample_priors8.py +25 -0
- spm/spm_sample_vol.py +38 -0
- spm/spm_save.py +18 -0
- spm/spm_sde_dx.py +39 -0
- spm/spm_sdot.py +26 -0
- spm/spm_searchlight.py +44 -0
- spm/spm_sections.py +24 -0
- spm/spm_select.py +71 -0
- spm/spm_sepmul3d.py +27 -0
- spm/spm_shp_get_model.py +21 -0
- spm/spm_shp_get_transforms.py +32 -0
- spm/spm_shp_install.py +16 -0
- spm/spm_shp_project_velocity.py +24 -0
- spm/spm_shp_sample_brains.py +43 -0
- spm/spm_shp_sample_deformation.py +27 -0
- spm/spm_shp_transform_mesh.py +30 -0
- spm/spm_shp_transform_volume.py +26 -0
- spm/spm_shp_warps.py +27 -0
- spm/spm_sixel.py +27 -0
- spm/spm_slice_timing.py +99 -0
- spm/spm_slice_vol.py +35 -0
- spm/spm_slm.py +24 -0
- spm/spm_smohist.py +27 -0
- spm/spm_smooth.py +32 -0
- spm/spm_smoothkern.py +35 -0
- spm/spm_smoothto8bit.py +19 -0
- spm/spm_softmax.py +23 -0
- spm/spm_soreduce.py +42 -0
- spm/spm_sp.py +189 -0
- spm/spm_sp_reml.py +44 -0
- spm/spm_sparse_regression.py +33 -0
- spm/spm_speye.py +20 -0
- spm/spm_spm.py +278 -0
- spm/spm_spm_Bayes.py +75 -0
- spm/spm_spm_Bayes_CY.py +23 -0
- spm/spm_spm_Bayes_specify.py +30 -0
- spm/spm_sptop.py +30 -0
- spm/spm_spy.py +18 -0
- spm/spm_sqrtm.py +19 -0
- spm/spm_squeeze.py +15 -0
- spm/spm_ssm2s.py +24 -0
- spm/spm_standalone.py +21 -0
- spm/spm_str_manip.py +58 -0
- spm/spm_subfun.py +20 -0
- spm/spm_sum.py +17 -0
- spm/spm_summarise.py +35 -0
- spm/spm_surf.py +63 -0
- spm/spm_svd.py +22 -0
- spm/spm_swarp.py +24 -0
- spm/spm_t2z.py +63 -0
- spm/spm_tests.py +26 -0
- spm/spm_timeseries_resample.py +23 -0
- spm/spm_trace.py +17 -0
- spm/spm_transverse.py +45 -0
- spm/spm_type.py +34 -0
- spm/spm_u.py +29 -0
- spm/spm_uc.py +33 -0
- spm/spm_uc_Bonf.py +32 -0
- spm/spm_uc_FDR.py +89 -0
- spm/spm_uc_RF.py +32 -0
- spm/spm_uc_clusterFDR.py +47 -0
- spm/spm_uc_peakFDR.py +45 -0
- spm/spm_uitab.py +35 -0
- spm/spm_uncat.py +21 -0
- spm/spm_unlink.py +17 -0
- spm/spm_unvec.py +22 -0
- spm/spm_update.py +31 -0
- spm/spm_uw_apply.py +128 -0
- spm/spm_uw_estimate.py +90 -0
- spm/spm_uw_get_image_def.py +46 -0
- spm/spm_uw_show.py +20 -0
- spm/spm_vb_F.py +25 -0
- spm/spm_vb_Fn.py +27 -0
- spm/spm_vb_a.py +18 -0
- spm/spm_vb_adjacency.py +22 -0
- spm/spm_vb_alpha.py +18 -0
- spm/spm_vb_beta.py +18 -0
- spm/spm_vb_contrasts.py +23 -0
- spm/spm_vb_edgeweights.py +20 -0
- spm/spm_vb_gamma.py +18 -0
- spm/spm_vb_get_Ab.py +24 -0
- spm/spm_vb_get_Gn.py +19 -0
- spm/spm_vb_get_R.py +19 -0
- spm/spm_vb_glmar.py +85 -0
- spm/spm_vb_graphcut.py +35 -0
- spm/spm_vb_incidence.py +23 -0
- spm/spm_vb_init_block.py +18 -0
- spm/spm_vb_lambda.py +18 -0
- spm/spm_vb_logbf.py +20 -0
- spm/spm_vb_models.py +22 -0
- spm/spm_vb_neighbors.py +27 -0
- spm/spm_vb_ppm_anova.py +39 -0
- spm/spm_vb_regionF.py +34 -0
- spm/spm_vb_robust.py +26 -0
- spm/spm_vb_roi_anova.py +28 -0
- spm/spm_vb_roi_basis.py +57 -0
- spm/spm_vb_set_priors.py +41 -0
- spm/spm_vb_spatial_precision.py +22 -0
- spm/spm_vb_taylor_R.py +20 -0
- spm/spm_vb_w.py +18 -0
- spm/spm_vec.py +23 -0
- spm/spm_vecfun.py +20 -0
- spm/spm_vol.py +41 -0
- spm/spm_vol_nifti.py +19 -0
- spm/spm_voronoi.py +29 -0
- spm/spm_wft.py +19 -0
- spm/spm_write_filtered.py +34 -0
- spm/spm_write_plane.py +24 -0
- spm/spm_write_residuals.py +20 -0
- spm/spm_write_vol.py +22 -0
- spm/spm_z2p.py +26 -0
- spm/spm_zeros.py +16 -0
- spm/xmltree.py +619 -0
- spm_python-25.1a1.dev1.dist-info/AUTHORS.txt +53 -0
- spm_python-25.1a1.dev1.dist-info/LICENCE +339 -0
- spm_python-25.1a1.dev1.dist-info/METADATA +151 -0
- spm_python-25.1a1.dev1.dist-info/RECORD +834 -0
- spm_python-25.1a1.dev1.dist-info/WHEEL +5 -0
- spm_python-25.1a1.dev1.dist-info/top_level.txt +1 -0
spm/spm_Pcdf.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_Pcdf(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Cumulative Distribution Function (PDF) of Poisson distribution
|
|
7
|
+
FORMAT F = spm_Pcdf(x,l)
|
|
8
|
+
|
|
9
|
+
x - ordinates
|
|
10
|
+
l - Poisson mean parameter (lambda l>0) [Defaults to 1]
|
|
11
|
+
F - Poisson CDF
|
|
12
|
+
__________________________________________________________________________
|
|
13
|
+
|
|
14
|
+
spm_Pcdf implements the Cumulative Distribution Function of the
|
|
15
|
+
Poisson distribution.
|
|
16
|
+
|
|
17
|
+
Definition:
|
|
18
|
+
--------------------------------------------------------------------------
|
|
19
|
+
The Poisson Po(l) distribution is the distribution of the number of
|
|
20
|
+
events in unit time for a stationary Poisson process with mean
|
|
21
|
+
parameter lambda=1, or equivalently rate 1/l. If random variable X is
|
|
22
|
+
the number of such events, then X~Po(l), and the CDF F(x) is
|
|
23
|
+
Pr({X<=x}.
|
|
24
|
+
|
|
25
|
+
F(x) is defined for strictly positive l, given by: (See Evans et al., Ch31)
|
|
26
|
+
|
|
27
|
+
{ 0 for x<0
|
|
28
|
+
| _ floor(x)
|
|
29
|
+
f(rx = | > l^i * exp(-l) / i!) for x>=0
|
|
30
|
+
{ - i=0
|
|
31
|
+
|
|
32
|
+
Algorithm:
|
|
33
|
+
--------------------------------------------------------------------------
|
|
34
|
+
F(x), the CDF of the Poisson distribution, for X~Po(l), is related
|
|
35
|
+
to the incomplete gamma function, by:
|
|
36
|
+
|
|
37
|
+
F(x) = 1 - gammainc(l,x+1) (x>=0)
|
|
38
|
+
|
|
39
|
+
See Press et al., Sec6.2 for further details.
|
|
40
|
+
|
|
41
|
+
Normal approximation:
|
|
42
|
+
--------------------------------------------------------------------------
|
|
43
|
+
For large lambda the normal approximation Y~:~N(l,l) may be used.
|
|
44
|
+
With continuity correction this gives
|
|
45
|
+
F(x) ~=~ Phi((x+.5-l)/sqrt(l))
|
|
46
|
+
where Phi is the standard normal CDF, and ~=~ means "appox. =".
|
|
47
|
+
|
|
48
|
+
References:
|
|
49
|
+
--------------------------------------------------------------------------
|
|
50
|
+
Evans M, Hastings N, Peacock B (1993)
|
|
51
|
+
"Statistical Distributions"
|
|
52
|
+
2nd Ed. Wiley, New York
|
|
53
|
+
|
|
54
|
+
Abramowitz M, Stegun IA, (1964)
|
|
55
|
+
"Handbook of Mathematical Functions"
|
|
56
|
+
US Government Printing Office
|
|
57
|
+
|
|
58
|
+
Press WH, Teukolsky SA, Vetterling AT, Flannery BP (1992)
|
|
59
|
+
"Numerical Recipes in C"
|
|
60
|
+
Cambridge
|
|
61
|
+
|
|
62
|
+
__________________________________________________________________________
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_Pcdf.m )
|
|
66
|
+
|
|
67
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
68
|
+
"""
|
|
69
|
+
return Runtime.call("spm_Pcdf", *args, **kwargs)
|
spm/spm_Pec_resels.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_Pec_resels(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Return the resel count for a point-list of voxels
|
|
7
|
+
FORMAT R = spm_Pec_resels(L,W)
|
|
8
|
+
L - point list of voxels {in voxels}
|
|
9
|
+
W - smoothness of the component fields {FWHM in voxels}
|
|
10
|
+
R - vector of RESEL counts
|
|
11
|
+
___________________________________________________________________________
|
|
12
|
+
|
|
13
|
+
Reference : Worsley KJ et al 1996, Hum Brain Mapp. 4:58-73
|
|
14
|
+
___________________________________________________________________________
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_Pec_resels.m )
|
|
18
|
+
|
|
19
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
20
|
+
"""
|
|
21
|
+
return Runtime.call("spm_Pec_resels", *args, **kwargs)
|
spm/spm_Ppdf.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_Ppdf(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Probability Distribution Function (PDF) of Poisson distribution
|
|
7
|
+
FORMAT f = spm_Ppdf(x,l)
|
|
8
|
+
|
|
9
|
+
x - ordinates
|
|
10
|
+
l - Poisson mean parameter (lambda l>0) [Defaults to 1]
|
|
11
|
+
f - Poisson PDF
|
|
12
|
+
__________________________________________________________________________
|
|
13
|
+
|
|
14
|
+
spm_Ppdf implements the Probaility Distribution Function of the
|
|
15
|
+
Poisson distribution.
|
|
16
|
+
|
|
17
|
+
Definition:
|
|
18
|
+
--------------------------------------------------------------------------
|
|
19
|
+
The Poisson Po(l) distribution is the distribution of the number of
|
|
20
|
+
events in unit time for a stationary Poisson process with mean
|
|
21
|
+
parameter lambda=1, or equivalently rate 1/l. If random variable X is
|
|
22
|
+
the number of such events, then X~Po(l), and the PDF f(x) is
|
|
23
|
+
Pr({X=x}.
|
|
24
|
+
|
|
25
|
+
f(x) is defined for strictly positive l, given by: (See Evans et al., Ch31)
|
|
26
|
+
|
|
27
|
+
{ l^x * exp(-l) / x! for r=0,1,...
|
|
28
|
+
f(r) = |
|
|
29
|
+
{ 0 otherwise
|
|
30
|
+
|
|
31
|
+
Algorithm:
|
|
32
|
+
--------------------------------------------------------------------------
|
|
33
|
+
To avoid roundoff errors for large x (in x! & l^x) & l (in l^x),
|
|
34
|
+
computation is done in logs.
|
|
35
|
+
|
|
36
|
+
Normal approximation:
|
|
37
|
+
--------------------------------------------------------------------------
|
|
38
|
+
For large lambda the normal approximation Y~:~N(l,l) may be used.
|
|
39
|
+
With continuity correction this gives
|
|
40
|
+
f(x) ~=~ Phi((x+.5-l)/sqrt(l)) -Phi((x-.5-l)/sqrt(l));
|
|
41
|
+
where Phi is the standard normal CDF, and ~=~ means "appox. =".
|
|
42
|
+
|
|
43
|
+
References:
|
|
44
|
+
--------------------------------------------------------------------------
|
|
45
|
+
Evans M, Hastings N, Peacock B (1993)
|
|
46
|
+
"Statistical Distributions"
|
|
47
|
+
2nd Ed. Wiley, New York
|
|
48
|
+
|
|
49
|
+
Abramowitz M, Stegun IA, (1964)
|
|
50
|
+
"Handbook of Mathematical Functions"
|
|
51
|
+
US Government Printing Office
|
|
52
|
+
|
|
53
|
+
Press WH, Teukolsky SA, Vetterling AT, Flannery BP (1992)
|
|
54
|
+
"Numerical Recipes in C"
|
|
55
|
+
Cambridge
|
|
56
|
+
__________________________________________________________________________
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_Ppdf.m )
|
|
60
|
+
|
|
61
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
62
|
+
"""
|
|
63
|
+
return Runtime.call("spm_Ppdf", *args, **kwargs)
|
spm/spm_Q.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_Q(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Return an (n x n) (inverse) autocorrelation matrix for an AR(p) process
|
|
7
|
+
FORMAT [Q] = spm_Q(a,n,q)
|
|
8
|
+
|
|
9
|
+
a - vector of (p) AR coefficients
|
|
10
|
+
n - size of Q
|
|
11
|
+
q - switch to return inverse autocorrelation or precision [default q = 0]
|
|
12
|
+
__________________________________________________________________________
|
|
13
|
+
spm_Q uses a Yule-Walker device to compute K where:
|
|
14
|
+
|
|
15
|
+
y = K*z
|
|
16
|
+
|
|
17
|
+
such that y is an AR(p) process generated from an i.i.d innovation
|
|
18
|
+
z. This means
|
|
19
|
+
|
|
20
|
+
cov(y) = <K*z*z'*K> = K*K'
|
|
21
|
+
|
|
22
|
+
If called with q ~= 0, a first order process is assumed when evaluating
|
|
23
|
+
the precision (inverse covariance) matrix; i.e., a = a(1)
|
|
24
|
+
__________________________________________________________________________
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_Q.m )
|
|
28
|
+
|
|
29
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
30
|
+
"""
|
|
31
|
+
return Runtime.call("spm_Q", *args, **kwargs)
|
spm/spm_Q_perm.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_Q_perm(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Return a cell of permutation indices for separating matrices
|
|
7
|
+
FORMAT p = spm_Q_perm(Q)
|
|
8
|
+
__________________________________________________________________________
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_Q_perm.m )
|
|
12
|
+
|
|
13
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
14
|
+
"""
|
|
15
|
+
return Runtime.call("spm_Q_perm", *args, **kwargs)
|
spm/spm_ROI.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_ROI(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Region of Interest specification
|
|
7
|
+
FORMAT xY = spm_ROI(xY)
|
|
8
|
+
xY - VOI structure
|
|
9
|
+
xY.def - VOI definition [sphere, box, mask, cluster, all]
|
|
10
|
+
xY.rej - cell array of disabled VOI definition options
|
|
11
|
+
xY.xyz - centre of VOI {mm}
|
|
12
|
+
xY.spec - VOI definition parameters
|
|
13
|
+
xY.str - description of the VOI
|
|
14
|
+
|
|
15
|
+
FORMAT [xY, XYZmm, j] = spm_ROI(xY, XYZmm)
|
|
16
|
+
XYZmm - [3xm] locations of voxels {mm}
|
|
17
|
+
If an image filename, an spm_vol structure or a NIfTI object is
|
|
18
|
+
given instead, XYZmm will be initialised to all voxels within
|
|
19
|
+
the field of view of that image.
|
|
20
|
+
|
|
21
|
+
XYZmm - [3xn] filtered locations of voxels {mm} (m>=n) within VOI xY
|
|
22
|
+
j - [1xn] indices of input locations XYZmm within VOI xY
|
|
23
|
+
__________________________________________________________________________
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_ROI.m )
|
|
27
|
+
|
|
28
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
29
|
+
"""
|
|
30
|
+
return Runtime.call("spm_ROI", *args, **kwargs)
|
spm/spm_SpUtil.py
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_SpUtil(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Space matrix utilities
|
|
7
|
+
FORMAT varargout = spm_SpUtil(action,varargin)
|
|
8
|
+
|
|
9
|
+
_______________________________________________________________________
|
|
10
|
+
|
|
11
|
+
spm_SpUtil is a multi-function function containing various utilities
|
|
12
|
+
for Design matrix and contrast construction and manipulation. In
|
|
13
|
+
general, it accepts design matrices as plain matrices or as space
|
|
14
|
+
structures setup by spm_sp.
|
|
15
|
+
|
|
16
|
+
Many of the space utilities are computed using an SVD of the design
|
|
17
|
+
matrix. The advantage of using space structures is that the svd of
|
|
18
|
+
the design matrix is stored in the space structure, thereby saving
|
|
19
|
+
unnecessary repeated computation of the SVD. This presents a
|
|
20
|
+
considerable efficiency gain for large design matrices.
|
|
21
|
+
|
|
22
|
+
Note that when space structures are passed as arguments is is
|
|
23
|
+
assumed that their basic fields are filled in. See spm_sp for
|
|
24
|
+
details of (design) space structures and their manipulation.
|
|
25
|
+
|
|
26
|
+
Quick Reference :
|
|
27
|
+
---------------------
|
|
28
|
+
('isCon',x,c) :
|
|
29
|
+
('allCon',x,c) :
|
|
30
|
+
('ConR',x,c) :
|
|
31
|
+
('ConO',x,c) :
|
|
32
|
+
('size',x,dim) :
|
|
33
|
+
('iX0check',i0,sL) :
|
|
34
|
+
---------------------
|
|
35
|
+
('i0->c',x,i0) : Out : c
|
|
36
|
+
('c->Tsp',x,c) : Out : [X1o [X0]]
|
|
37
|
+
('+c->Tsp',x,c) : Out : [ukX1o [ukX0]]
|
|
38
|
+
('i0->x1o',x,i0) : Use ('i0->c',x,i0) and ('c->Tsp',X,c)
|
|
39
|
+
('+i0->x1o',x,i0) : Use ('i0->c',x,i0) and ('+c->Tsp',X,c)
|
|
40
|
+
('X0->c',x,X0) :~
|
|
41
|
+
('+X0->c',x,cukX0) :~
|
|
42
|
+
---------------------
|
|
43
|
+
('trRV',x[,V]) :
|
|
44
|
+
('trMV',x[,V]) :
|
|
45
|
+
('i0->edf',x,i0,V) :
|
|
46
|
+
|
|
47
|
+
---------------------
|
|
48
|
+
|
|
49
|
+
Improvement compared to the spm99 beta version :
|
|
50
|
+
|
|
51
|
+
Improvements in df computation using spm_SpUtil('trRV',x[,V]) and
|
|
52
|
+
spm_SpUtil('trMV',sX [,V]). The degrees of freedom computation requires
|
|
53
|
+
in general that the trace of RV and of RVRV be computed, where R is a
|
|
54
|
+
projector onto either a sub space of the design space or the residual
|
|
55
|
+
space, namely the space that is orthogonal to the design space. V is
|
|
56
|
+
the (estimated or assumed) variance covariance matrix and is a number
|
|
57
|
+
of scans by number of scans matrix which can be huge in some cases. We
|
|
58
|
+
have (thanks to S Rouquette and JB) speed up this computation
|
|
59
|
+
by using matlab built in functions of the frobenius norm and some theorems
|
|
60
|
+
on trace computations.
|
|
61
|
+
|
|
62
|
+
======================================================================
|
|
63
|
+
|
|
64
|
+
FORMAT i = spm_SpUtil('isCon',x,c)
|
|
65
|
+
Tests whether weight vectors specify contrasts
|
|
66
|
+
x - Design matrix X, or space structure of X
|
|
67
|
+
c - contrast matrix (I.e. matrix of contrast weights, contrasts in columns)
|
|
68
|
+
Must have column dimension matching that of X
|
|
69
|
+
[defaults to eye(size(X,2)) to test uniqueness of parameter estimates]
|
|
70
|
+
i - logical row vector indicating estimability of contrasts in c
|
|
71
|
+
|
|
72
|
+
A linear combination of the parameter estimates is a contrast if and
|
|
73
|
+
only if the weight vector is in the space spanned by the rows of X.
|
|
74
|
+
|
|
75
|
+
The algorithm works by regressing the contrast weight vectors using
|
|
76
|
+
design matrix X' (X transposed). Any contrast weight vectors will be
|
|
77
|
+
fitted exactly by this procedure, leaving zero residual. Parameter
|
|
78
|
+
tol is the tolerance applied when searching for zero residuals.
|
|
79
|
+
|
|
80
|
+
Christensen R (1996)
|
|
81
|
+
"Plane Answers to Complex Questions"
|
|
82
|
+
2nd Ed. Springer-Verlag, New York
|
|
83
|
+
|
|
84
|
+
Andrade A, Paradis AL, Rouquette S and Poline JB, NeuroImage 9, 1999
|
|
85
|
+
----------------
|
|
86
|
+
|
|
87
|
+
FORMAT i = spm_SpUtil('allCon',x,c)
|
|
88
|
+
Tests whether all weight vectors specify contrasts:
|
|
89
|
+
Same as all(spm_SpUtil('isCon',x,c)).
|
|
90
|
+
|
|
91
|
+
----------------
|
|
92
|
+
|
|
93
|
+
FORMAT r = spm_SpUtil('ConR',x,c)
|
|
94
|
+
Assess orthogonality of contrasts (wirit the data)
|
|
95
|
+
x - Design matrix X, or space structure of X
|
|
96
|
+
c - contrast matrix (I.e. matrix of contrast weights, contrasts in columns)
|
|
97
|
+
Must have column dimension matching that of X
|
|
98
|
+
defaults to eye(size(X,2)) to test independence of parameter estimates
|
|
99
|
+
r - Contrast correlation matrix, of dimension the number of contrasts.
|
|
100
|
+
|
|
101
|
+
For the general linear model Y = X*B + E, a contrast weight vector c
|
|
102
|
+
defines a contrast c*B. This is estimated by c*b, where b are the
|
|
103
|
+
least squares estimates of B given by b=pinv(X)*Y. Thus, c*b = w*Y,
|
|
104
|
+
where weight vector w is given by w=c*pinv(X); Since the data are
|
|
105
|
+
assumed independent, two contrasts are independent if the
|
|
106
|
+
corresponding weight vectors are orthogonal.
|
|
107
|
+
|
|
108
|
+
r is the matrix of normalised inner products between the weight
|
|
109
|
+
vectors corresponding to the contrasts. For iid E, r is the
|
|
110
|
+
correlation matrix of the contrasts.
|
|
111
|
+
|
|
112
|
+
The logical matrix ~r will be true for orthogonal pairs of contrasts.
|
|
113
|
+
|
|
114
|
+
----------------
|
|
115
|
+
|
|
116
|
+
FORMAT r = spm_SpUtil('ConO',x,c)
|
|
117
|
+
Assess orthogonality of contrasts (wirit the data)
|
|
118
|
+
x - Design matrix X, or space structure of X
|
|
119
|
+
c - contrast matrix (I.e. matrix of contrast weights, contrasts in columns)
|
|
120
|
+
Must have column dimension matching that of X
|
|
121
|
+
[defaults to eye(size(X,2)) to test uniqueness of parameter estimates]
|
|
122
|
+
r - Contrast orthogonality matrix, of dimension the number of contrasts.
|
|
123
|
+
|
|
124
|
+
This is the same as ~spm_SpUtil('ConR',X,c), but uses a quicker
|
|
125
|
+
algorithm by looking at the orthogonality of the subspaces of the
|
|
126
|
+
design space which are implied by the contrasts:
|
|
127
|
+
r = abs(c*X'*X*c')<tol
|
|
128
|
+
|
|
129
|
+
----------------
|
|
130
|
+
|
|
131
|
+
FORMAT c = spm_SpUtil('i0->c',x,i0)
|
|
132
|
+
Return F-contrast for specified design matrix partition
|
|
133
|
+
x - Design matrix X, or space structure of X
|
|
134
|
+
i0 - column indices of null hypothesis design matrix
|
|
135
|
+
|
|
136
|
+
This functionality returns a rank n mxp matrix of contrasts suitable
|
|
137
|
+
for an extra-sum-of-squares F-test comparing the design X, with a
|
|
138
|
+
reduced design. The design matrix for the reduced design is X0 =
|
|
139
|
+
X(:,i0), a reduction of n degrees of freedom.
|
|
140
|
+
|
|
141
|
+
The algorithm, due to J-B, and derived from Christensen, computes the
|
|
142
|
+
contrasts as an orthonormal basis set for the rows of the
|
|
143
|
+
hypothesised redundant columns of the design matrix, after
|
|
144
|
+
orthogonalisation with respect to X0. For non-unique designs, there
|
|
145
|
+
are a variety of ways to produce equivalent F-contrasts. This method
|
|
146
|
+
produces contrasts with non-zero weights only for the hypothesised
|
|
147
|
+
redundant columns.
|
|
148
|
+
|
|
149
|
+
----------------
|
|
150
|
+
|
|
151
|
+
case {'x0->c'} %-
|
|
152
|
+
FORMAT c = spm_SpUtil('X0->c',sX,X0)
|
|
153
|
+
----------------
|
|
154
|
+
|
|
155
|
+
FORMAT [X1,X0] = spm_SpUtil('c->TSp',X,c)
|
|
156
|
+
Orthogonalised partitioning of design space implied by F-contrast
|
|
157
|
+
x - Design matrix X, or space structure of X
|
|
158
|
+
c - contrast matrix (I.e. matrix of contrast weights, contrasts in columns)
|
|
159
|
+
Must have column dimension matching that of X
|
|
160
|
+
X1o - contrast space - design matrix corresponding according to contrast
|
|
161
|
+
(orthogonalised wirit X0)
|
|
162
|
+
X0 - matrix reduced according to null hypothesis
|
|
163
|
+
(of same size as X but rank deficient)
|
|
164
|
+
FORMAT [uX1,uX0] = spm_SpUtil('c->TSp+',X,c)
|
|
165
|
+
+ version to deal with the X1o and X0 partitions in the "uk basis"
|
|
166
|
+
|
|
167
|
+
( Note that unless X0 is reduced to a set of linearely independent )
|
|
168
|
+
( vectors, c will only be contained in the null space of X0. If X0 )
|
|
169
|
+
( is "reduced", then the "parent" space of c must be reduced as well )
|
|
170
|
+
( for c to be the actual null space of X0. )
|
|
171
|
+
|
|
172
|
+
This functionality returns a design matrix subpartition whose columns
|
|
173
|
+
span the hypothesised null design space of a given contrast. Note
|
|
174
|
+
that X1 is orthogonal(ised) to X0, reflecting the situation when an
|
|
175
|
+
F-contrast is tested using the extra sum-of-squares principle (when
|
|
176
|
+
the extra distance in the hypothesised null space is measured
|
|
177
|
+
orthogonal to the space of X0).
|
|
178
|
+
|
|
179
|
+
Note that the null space design matrix will probably not be a simple
|
|
180
|
+
sub-partition of the full design matrix, although the space spanned
|
|
181
|
+
will be the same.
|
|
182
|
+
|
|
183
|
+
----------------
|
|
184
|
+
|
|
185
|
+
FORMAT X1 = spm_SpUtil('i0->x1o',X,i0)
|
|
186
|
+
x - Design matrix X, or space structure of X
|
|
187
|
+
i0 - Columns of X that make up X0 - the reduced model (Ho:B1=0)
|
|
188
|
+
X1 - Hypothesised null design space, i.e. that part of X orthogonal to X0
|
|
189
|
+
This offers the same functionality as the 'c->TSp' option, but for
|
|
190
|
+
simple reduced models formed from the columns of X.
|
|
191
|
+
|
|
192
|
+
FORMAT X1 = spm_SpUtil('i0->x1o+',X,i0)
|
|
193
|
+
+ version to deal with the X1o and X0 partitions in the "uk basis"
|
|
194
|
+
|
|
195
|
+
----------------
|
|
196
|
+
|
|
197
|
+
FORMAT [trRV,trRVRV] = spm_SpUtil('trRV',x[,V])
|
|
198
|
+
trace(RV) & trace(RVRV) - used in df calculation
|
|
199
|
+
x - Design matrix X, or space structure of X
|
|
200
|
+
V - V matrix [default eye] (trRV == trRVRV if V==eye, since R idempotent)
|
|
201
|
+
trRV - trace(R*V), computed efficiently
|
|
202
|
+
trRVRV - trace(R*V*R*V), computed efficiently
|
|
203
|
+
This uses the Karl's cunning understanding of the trace:
|
|
204
|
+
(tr(A*B) = sum(sum(A'*B)).
|
|
205
|
+
If the space of X is set, then algorithm uses x.u to avoid extra computation.
|
|
206
|
+
|
|
207
|
+
----------------
|
|
208
|
+
|
|
209
|
+
FORMAT [trMV, trMVMV]] = spm_SpUtil('trMV',x[,V])
|
|
210
|
+
trace(MV) & trace(MVMV) if two output arguments.
|
|
211
|
+
x - Design matrix X, or space structure of X
|
|
212
|
+
V - V matrix [default eye] (trMV == trMVMV if V==eye, since M idempotent)
|
|
213
|
+
trMV - trace(M*V), computed efficiently
|
|
214
|
+
trMVMV - trace(M*V*M*V), computed efficiently
|
|
215
|
+
Again, this uses the Karl's cunning understanding of the trace:
|
|
216
|
+
(tr(A*B) = sum(sum(A'.*B)).
|
|
217
|
+
If the space of X is set, then algorithm uses x.u to avoid extra computation.
|
|
218
|
+
|
|
219
|
+
----------------
|
|
220
|
+
|
|
221
|
+
OBSOLETE use FcUtil('H') for spm_SpUtil('c->H',x,c)
|
|
222
|
+
Extra sum of squares matrix O for beta's from contrast
|
|
223
|
+
x - Design matrix X, or space structure of X
|
|
224
|
+
c - contrast matrix (I.e. matrix of contrast weights, contrasts in columns)
|
|
225
|
+
Must have column dimension matching that of X
|
|
226
|
+
O - Matrix such that b'*O*b = extra sum of squares for F-test of contrast c
|
|
227
|
+
|
|
228
|
+
----------------
|
|
229
|
+
|
|
230
|
+
OBSOLETE use spm_sp('=='...) for spm_SpUtil('c==X1o',x,c) {or 'cxpequi'}
|
|
231
|
+
x - Design matrix X, or space structure of X
|
|
232
|
+
c - contrast matrix (I.e. matrix of contrast weights, contrasts in columns)
|
|
233
|
+
Must have column dimension matching that of X
|
|
234
|
+
b - True is c is a spanning set for space of X
|
|
235
|
+
(I.e. if contrast and space test the same thing)
|
|
236
|
+
|
|
237
|
+
----------------
|
|
238
|
+
|
|
239
|
+
FORMAT [df1,df2] = spm_SpUtil('i0->edf',x,i0,V) {or 'edf'}
|
|
240
|
+
(effective) df1 and df2 the residual df for the projector onto the
|
|
241
|
+
null space of x' (residual forming projector) and the numerator of
|
|
242
|
+
the F-test where i0 are the columns for the null hypothesis model.
|
|
243
|
+
x - Design matrix X, or space structure of X
|
|
244
|
+
i0 - Columns of X corresponding to X0 partition X = [X1,X0] & with
|
|
245
|
+
parameters B = [B1;B0]. Ho:B1=0
|
|
246
|
+
V - V matrix
|
|
247
|
+
|
|
248
|
+
----------------
|
|
249
|
+
|
|
250
|
+
FORMAT sz = spm_SpUtil('size',x,dim)
|
|
251
|
+
FORMAT [sz1,sz2,...] = spm_SpUtil('size',x)
|
|
252
|
+
Returns size of design matrix
|
|
253
|
+
(Like MatLab's `size`, but copes with design matrices inside structures.)
|
|
254
|
+
x - Design matrix X, or structure containing design matrix in field X
|
|
255
|
+
(Structure needn't be a space structure.)
|
|
256
|
+
dim - dimension which to size
|
|
257
|
+
sz - size
|
|
258
|
+
|
|
259
|
+
_______________________________________________________________________
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_SpUtil.m )
|
|
263
|
+
|
|
264
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
265
|
+
"""
|
|
266
|
+
return Runtime.call("spm_SpUtil", *args, **kwargs)
|
spm/spm_Tcdf.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_Tcdf(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Cumulative Distribution Function (CDF) of Students t distribution
|
|
7
|
+
FORMAT p = spm_Tcdf(x,v)
|
|
8
|
+
|
|
9
|
+
x - T-variate (Student's t has range (-Inf,Inf)
|
|
10
|
+
v - degrees of freedom (v>0, non-integer d.f. accepted)
|
|
11
|
+
F - CDF of Student's t-distribution with v degrees of freedom at points x
|
|
12
|
+
__________________________________________________________________________
|
|
13
|
+
|
|
14
|
+
spm_Tcdf implements the Cumulative Distribution of the Students t-distribution.
|
|
15
|
+
|
|
16
|
+
Definition:
|
|
17
|
+
--------------------------------------------------------------------------
|
|
18
|
+
The CDF F(x) of the Student's t-distribution with v degrees of
|
|
19
|
+
freedom is the probability that a realisation of a t random variable
|
|
20
|
+
X has value less than x; F(x)=Pr{X<x} for X~G(h,c). Student's
|
|
21
|
+
t-distribution is defined for real x and positive integer v (See
|
|
22
|
+
Evans et al., Ch37).
|
|
23
|
+
|
|
24
|
+
This implementation is not restricted to whole (positive integer) df
|
|
25
|
+
v, rather it will compute for any df v>0.
|
|
26
|
+
|
|
27
|
+
Variate relationships: (Evans et al., Ch37 & 7)
|
|
28
|
+
--------------------------------------------------------------------------
|
|
29
|
+
The Student's t distribution with 1 degree of freedom is the Standard
|
|
30
|
+
Cauchy distribution, which has a simple closed form CDF.
|
|
31
|
+
|
|
32
|
+
Algorithm:
|
|
33
|
+
--------------------------------------------------------------------------
|
|
34
|
+
The CDF of the Student's t-distribution with v degrees of freedom
|
|
35
|
+
is related to the incomplete beta function by:
|
|
36
|
+
Pr(|X|<x) = betainc(v/(v+x^2),v/2,1/2)
|
|
37
|
+
so
|
|
38
|
+
{ betainc(v/(v+x^2),v/2,1/2) / 2 for x<0
|
|
39
|
+
F(x) = | 0.5 for x=0
|
|
40
|
+
{ 1 - betainc(v/(v+x^2),v/2,1/2) / 2 for x>0
|
|
41
|
+
|
|
42
|
+
See Abramowitz & Stegun, 26.5.27 & 26.7.1; Press et al., Sec6.4 for
|
|
43
|
+
definitions of the incomplete beta function. The relationship is
|
|
44
|
+
easily verified by substituting for v/(v+x^2) in the integral of the
|
|
45
|
+
incomplete beta function.
|
|
46
|
+
|
|
47
|
+
MATLAB's implementation of the incomplete beta function is used.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
References:
|
|
51
|
+
--------------------------------------------------------------------------
|
|
52
|
+
Evans M, Hastings N, Peacock B (1993)
|
|
53
|
+
"Statistical Distributions"
|
|
54
|
+
2nd Ed. Wiley, New York
|
|
55
|
+
|
|
56
|
+
Abramowitz M, Stegun IA, (1964)
|
|
57
|
+
"Handbook of Mathematical Functions"
|
|
58
|
+
US Government Printing Office
|
|
59
|
+
|
|
60
|
+
Press WH, Teukolsky SA, Vetterling AT, Flannery BP (1992)
|
|
61
|
+
"Numerical Recipes in C"
|
|
62
|
+
Cambridge
|
|
63
|
+
|
|
64
|
+
__________________________________________________________________________
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_Tcdf.m )
|
|
68
|
+
|
|
69
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
70
|
+
"""
|
|
71
|
+
return Runtime.call("spm_Tcdf", *args, **kwargs)
|
spm/spm_Tpdf.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_Tpdf(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
Probability Density Function (PDF) of Students t distribution
|
|
7
|
+
FORMAT f = spm_Tpdf(x,v)
|
|
8
|
+
|
|
9
|
+
x - t-ordinates
|
|
10
|
+
v - degrees of freedom (v>0, non-integer d.f. accepted)
|
|
11
|
+
f - PDF of t-distribution with v degrees of freedom (df) at points t
|
|
12
|
+
__________________________________________________________________________
|
|
13
|
+
|
|
14
|
+
spm_Tpdf implements the Probability Density Function of Students
|
|
15
|
+
t-distributions.
|
|
16
|
+
|
|
17
|
+
Definition:
|
|
18
|
+
--------------------------------------------------------------------------
|
|
19
|
+
The Student's t-distribution with v degrees of freedom is defined for
|
|
20
|
+
positive integer v and x in (-Inf,Inf), and has Probability Distribution
|
|
21
|
+
Function (PDF) f(x) given by: (See Evans et al., Ch37)
|
|
22
|
+
|
|
23
|
+
gamma((v+1)/2)
|
|
24
|
+
f(x) = ----------------------- * (1 + x^2/v) ^ -((v+1)/2
|
|
25
|
+
sqrt(pi*v) * gamma(v/2)
|
|
26
|
+
|
|
27
|
+
This implementation is not restricted to whole (positive integer) df
|
|
28
|
+
v, rather it will compute for any df v>0.
|
|
29
|
+
|
|
30
|
+
Algorithm:
|
|
31
|
+
--------------------------------------------------------------------------
|
|
32
|
+
Direct computation using the beta function for
|
|
33
|
+
sqrt(pi)*gamma(v/2) / gamma((v+1)/2) = beta(v/2,1/2)
|
|
34
|
+
|
|
35
|
+
References:
|
|
36
|
+
--------------------------------------------------------------------------
|
|
37
|
+
Evans M, Hastings N, Peacock B (1993)
|
|
38
|
+
"Statistical Distributions"
|
|
39
|
+
2nd Ed. Wiley, New York
|
|
40
|
+
|
|
41
|
+
Abramowitz M, Stegun IA, (1964)
|
|
42
|
+
"Handbook of Mathematical Functions"
|
|
43
|
+
US Government Printing Office
|
|
44
|
+
|
|
45
|
+
Press WH, Teukolsky SA, Vetterling AT, Flannery BP (1992)
|
|
46
|
+
"Numerical Recipes in C"
|
|
47
|
+
Cambridge
|
|
48
|
+
|
|
49
|
+
__________________________________________________________________________
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_Tpdf.m )
|
|
53
|
+
|
|
54
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
55
|
+
"""
|
|
56
|
+
return Runtime.call("spm_Tpdf", *args, **kwargs)
|
spm/spm_VBX.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from spm.__wrapper__ import Runtime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def spm_VBX(*args, **kwargs):
|
|
5
|
+
"""
|
|
6
|
+
vvariational Bayes estimate of categorical posterior over factors
|
|
7
|
+
FORMAT [Q,F] = spm_VBX(O,P,A,[METHOD])
|
|
8
|
+
|
|
9
|
+
O{g} - outcome probabilities over each of G modalities
|
|
10
|
+
P{f} - (empirical) prior over each of F factors
|
|
11
|
+
A{g} - likelihood tensor for modality g
|
|
12
|
+
|
|
13
|
+
Q{f} - variational posterior for each of F factors
|
|
14
|
+
F - (-ve) variational free energy or ELBO
|
|
15
|
+
|
|
16
|
+
This routine is a simple implementation of variational Bayes for discrete
|
|
17
|
+
state space models under a mean field approximation, in which latent
|
|
18
|
+
states are partitioned into factors (and the distribution over outcomes
|
|
19
|
+
is also assumed to be conditionally independent). It takes cell arrays of
|
|
20
|
+
outcome probabilities, prior probabilities over factors and a likelihood
|
|
21
|
+
tensor parameterising the likelihood of an outcome for any combination
|
|
22
|
+
of latent states. The optional argument METHOD [default: exact] switches
|
|
23
|
+
among number of approximate schemes:
|
|
24
|
+
|
|
25
|
+
'full' : a vanilla variational scheme that uses a coordinate descent
|
|
26
|
+
over a small number (four) iterations
|
|
27
|
+
|
|
28
|
+
'exact' : a non-iterative heuristic but numerically accurate scheme
|
|
29
|
+
that replaces the variational density over hidden factors with the
|
|
30
|
+
marginal over the exact posterior
|
|
31
|
+
|
|
32
|
+
'sparse' : as for the exact scheme but suitable for sparse tensors
|
|
33
|
+
|
|
34
|
+
'marginal': a heuristic scheme that uses the log of the marginalised
|
|
35
|
+
likelihood and log prior to estimate the lot posterior
|
|
36
|
+
|
|
37
|
+
see: spm_MDP_VB_XXX.m (NOTES)
|
|
38
|
+
__________________________________________________________________________
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
[Matlab code]( https://github.com/spm/spm/blob/main/spm_VBX.m )
|
|
42
|
+
|
|
43
|
+
Copyright (C) 2024-2024 Functional Imaging Laboratory, Department of Imaging Neuroscience, UCL
|
|
44
|
+
"""
|
|
45
|
+
return Runtime.call("spm_VBX", *args, **kwargs)
|