gboolean
analysis_tool_principal_components_engine (data_analysis_output_t *dao, gpointer specs,
				   analysis_tool_engine_t selector, gpointer result)
{
	analysis_tools_data_generic_t *info = specs;

	switch (selector) {
	case TOOL_ENGINE_UPDATE_DESCRIPTOR:
		return (dao_command_descriptor 
			(dao, _("Principal Components Analysis (%s)"), result)
			== NULL);
	case TOOL_ENGINE_UPDATE_DAO:
		prepare_input_range (&info->input, info->group_by);
		dao_adjust (dao, 1 + g_slist_length (info->input),
			    12 + 3 * g_slist_length (info->input));
		return FALSE;
	case TOOL_ENGINE_CLEAN_UP:
		return analysis_tool_generic_clean (specs);
	case TOOL_ENGINE_LAST_VALIDITY_CHECK:
		return FALSE;
	case TOOL_ENGINE_PREPARE_OUTPUT_RANGE:
		dao_prepare_output (NULL, dao, _("Principal Components Analysis"));
		return FALSE;
	case TOOL_ENGINE_FORMAT_OUTPUT_RANGE:
		return dao_format_output (dao, _("Principal Components Analysis"));
	case TOOL_ENGINE_PERFORM_CALC:
	default:
		return analysis_tool_principal_components_engine_run (dao, specs);
	}
	return TRUE;  /* We shouldn't get here */
}
示例#2
0
gboolean
analysis_tool_normality_engine (G_GNUC_UNUSED GOCmdContext *gcc, data_analysis_output_t *dao, gpointer specs,
				   analysis_tool_engine_t selector, gpointer result)
{
	analysis_tools_data_normality_t *info = specs;

	switch (selector) {
	case TOOL_ENGINE_UPDATE_DESCRIPTOR:
		return (dao_command_descriptor (dao, _("Normality Test (%s)"), result)
			== NULL);
	case TOOL_ENGINE_UPDATE_DAO:
		prepare_input_range (&info->base.input, info->base.group_by);
		dao_adjust (dao, 1 + g_slist_length (info->base.input), 6);
		return FALSE;
	case TOOL_ENGINE_CLEAN_UP:
		return analysis_tool_generic_clean (specs);
	case TOOL_ENGINE_LAST_VALIDITY_CHECK:
		return FALSE;
	case TOOL_ENGINE_PREPARE_OUTPUT_RANGE:
		dao_prepare_output (NULL, dao, _("Normality Test"));
		return FALSE;
	case TOOL_ENGINE_FORMAT_OUTPUT_RANGE:
		return dao_format_output (dao, _("Normality Test"));
	case TOOL_ENGINE_PERFORM_CALC:
	default:
		return analysis_tool_normality_engine_run (dao, specs);
	}
	return TRUE;  /* We shouldn't get here */
}
示例#3
0
gboolean
analysis_tool_advanced_filter_engine (G_GNUC_UNUSED GOCmdContext *gcc, data_analysis_output_t *dao, gpointer specs,
				   analysis_tool_engine_t selector, gpointer result)
{
	analysis_tools_data_advanced_filter_t *info = specs;
	switch (selector) {
	case TOOL_ENGINE_UPDATE_DESCRIPTOR:
		return (dao_command_descriptor (dao, _("Advanced Filter (%s)"), result)
			== NULL);
	case TOOL_ENGINE_UPDATE_DAO: {
		int rows, cols;
		rows = info->base.range_1->v_range.cell.b.row
			- info->base.range_1->v_range.cell.a.row + 1;
		cols = info->base.range_1->v_range.cell.b.col
			- info->base.range_1->v_range.cell.a.col + 1;
		if (cols < 2)
			cols = 2;
		dao_adjust (dao, cols, 3 + rows);
		return FALSE;
	}
	case TOOL_ENGINE_CLEAN_UP:
		return analysis_tool_generic_b_clean (specs);
	case TOOL_ENGINE_LAST_VALIDITY_CHECK:
		return FALSE;
	case TOOL_ENGINE_PREPARE_OUTPUT_RANGE:
		dao_prepare_output (NULL, dao, _("Advanced Filter"));
		return FALSE;
	case TOOL_ENGINE_FORMAT_OUTPUT_RANGE:
		return dao_format_output (dao, _("Advanced Filter"));
	case TOOL_ENGINE_PERFORM_CALC:
	default:
		return analysis_tool_advanced_filter_engine_run (dao, info);
	}
	return TRUE;  /* We shouldn't get here */
}
gboolean
analysis_tool_wilcoxon_mann_whitney_engine
        (G_GNUC_UNUSED GOCmdContext *gcc,
	 data_analysis_output_t *dao, gpointer specs,
	 analysis_tool_engine_t selector, gpointer result)
{
	switch (selector) {
	case TOOL_ENGINE_UPDATE_DESCRIPTOR:
		return (dao_command_descriptor
			(dao, _("Wilcoxon-Mann-Whitney Test (%s)"), result)
			== NULL);
	case TOOL_ENGINE_UPDATE_DAO:
		dao_adjust (dao, 4, 9);
		return FALSE;
	case TOOL_ENGINE_CLEAN_UP:
		return analysis_tool_generic_b_clean (specs);
	case TOOL_ENGINE_LAST_VALIDITY_CHECK:
		return FALSE;
	case TOOL_ENGINE_PREPARE_OUTPUT_RANGE:
		dao_prepare_output (NULL, dao, _("Wilcoxon-Mann-Whitney Test"));
		return FALSE;
	case TOOL_ENGINE_FORMAT_OUTPUT_RANGE:
		return dao_format_output (dao, _("Wilcoxon-Mann-Whitney Test"));
	case TOOL_ENGINE_PERFORM_CALC:
	default:
		return analysis_tool_wilcoxon_mann_whitney_engine_run (dao, specs);
	}
	return TRUE;  /* We shouldn't get here */
}
示例#5
0
gboolean
analysis_tool_frequency_engine (G_GNUC_UNUSED GOCmdContext *gcc, data_analysis_output_t *dao, gpointer specs,
			      analysis_tool_engine_t selector, gpointer result)
{
	analysis_tools_data_frequency_t *info = specs;

	switch (selector) {
	case TOOL_ENGINE_UPDATE_DESCRIPTOR:
		return (dao_command_descriptor (dao, _("Frequency Table (%s)"), result)
			== NULL);
	case TOOL_ENGINE_UPDATE_DAO:
	{
		int i;

		prepare_input_range (&info->base.input, info->base.group_by);

		i = 2 + ((info->predetermined) ? calc_length (info->bin) : info->n);

		dao_adjust (dao, g_slist_length (info->base.input) + 1, i);

		return FALSE;
	}
	case TOOL_ENGINE_CLEAN_UP:
		return analysis_tool_generic_clean (specs);
	case TOOL_ENGINE_LAST_VALIDITY_CHECK:
		return FALSE;
	case TOOL_ENGINE_PREPARE_OUTPUT_RANGE:
		dao_prepare_output (NULL, dao, _("Frequency Table"));
		return FALSE;
	case TOOL_ENGINE_FORMAT_OUTPUT_RANGE:
		return dao_format_output (dao, _("Frequency Table"));
	case TOOL_ENGINE_PERFORM_CALC:
	default:
		return analysis_tool_frequency_engine_run (dao, specs);
	}
	return TRUE;
}
示例#6
0
gboolean
analysis_tool_chi_squared_engine (G_GNUC_UNUSED GOCmdContext *gcc, data_analysis_output_t *dao, gpointer specs,
                                  analysis_tool_engine_t selector, gpointer result)
{
    analysis_tools_data_chi_squared_t *info = specs;

    switch (selector) {
    case TOOL_ENGINE_UPDATE_DESCRIPTOR:
        return (dao_command_descriptor
                (dao,
                 info->independence ?
                 _("Test of Independence (%s)")
                 : _("Test of Homogeneity (%s)"), result)
                == NULL);
    case TOOL_ENGINE_UPDATE_DAO:
        dao_adjust (dao, 2, 5);
        return FALSE;
    case TOOL_ENGINE_CLEAN_UP:
        return analysis_tool_chi_squared_clean (specs);
    case TOOL_ENGINE_LAST_VALIDITY_CHECK:
        return FALSE;
    case TOOL_ENGINE_PREPARE_OUTPUT_RANGE:
        dao_prepare_output (NULL, dao, info->independence ?
                            _("Test of Independence")
                            : _("Test of Homogeneity"));
        return FALSE;
    case TOOL_ENGINE_FORMAT_OUTPUT_RANGE:
        return dao_format_output (dao,  info->independence ?
                                  _("Test of Independence")
                                  : _("Test of Homogeneity"));
    case TOOL_ENGINE_PERFORM_CALC:
    default:
        return analysis_tool_chi_squared_engine_run (dao, specs);
    }
    return TRUE;
}
示例#7
0
gboolean
tool_random_engine (data_analysis_output_t *dao, gpointer specs,
		    analysis_tool_engine_t selector, gpointer result)
{
	tools_data_random_t *info = specs;

	switch (selector) {
	case TOOL_ENGINE_UPDATE_DESCRIPTOR:
		return (dao_command_descriptor (dao, _("Random Numbers (%s)"),
						result) == NULL);
	case TOOL_ENGINE_UPDATE_DAO:
		dao_adjust (dao, info->n_vars, info->count);
		return FALSE;
	case TOOL_ENGINE_CLEAN_UP:
		if (info->distribution == DiscreteDistribution &&
		    info->param.discrete.range != NULL) {
			value_release (info->param.discrete.range);
			info->param.discrete.range = NULL;
		}
		return FALSE;
	case TOOL_ENGINE_LAST_VALIDITY_CHECK:
		if (info->distribution == DiscreteDistribution)
			return tool_random_engine_run_discrete_last_check
				(dao, specs, &info->param.discrete, result);
		return FALSE;
	case TOOL_ENGINE_PREPARE_OUTPUT_RANGE:
		dao_prepare_output (NULL, dao, _("Random Numbers"));
		return FALSE;
	case TOOL_ENGINE_FORMAT_OUTPUT_RANGE:
		return dao_format_output (dao, _("Random Numbers"));
	case TOOL_ENGINE_PERFORM_CALC:
	default:
		switch (info->distribution) {
		case DiscreteDistribution:
			return tool_random_engine_run_discrete
				(dao, specs, &info->param.discrete, result);
		case NormalDistribution:
			return tool_random_engine_run_normal
			        (dao, specs, &info->param.normal);
		case BernoulliDistribution:
			return tool_random_engine_run_bernoulli
				(dao, specs, &info->param.bernoulli);
		case BetaDistribution:
			return tool_random_engine_run_beta
				(dao, specs, &info->param.beta);
		case UniformDistribution:
			return tool_random_engine_run_uniform
			        (dao, specs, &info->param.uniform);
		case UniformIntDistribution:
			return tool_random_engine_run_uniform_int
			        (dao, specs, &info->param.uniform);
		case PoissonDistribution:
			return tool_random_engine_run_poisson
			        (dao, specs, &info->param.poisson);
		case ExponentialDistribution:
			return tool_random_engine_run_exponential
				(dao, specs, &info->param.exponential);
		case ExponentialPowerDistribution:
			return tool_random_engine_run_exppow
				(dao, specs, &info->param.exppow);
		case CauchyDistribution:
			return tool_random_engine_run_cauchy
				(dao, specs, &info->param.cauchy);
		case ChisqDistribution:
			return tool_random_engine_run_chisq
				(dao, specs, &info->param.chisq);
		case ParetoDistribution:
			return tool_random_engine_run_pareto
				(dao, specs, &info->param.pareto);
		case LognormalDistribution:
			return tool_random_engine_run_lognormal
				(dao, specs, &info->param.lognormal);
		case RayleighDistribution:
			return tool_random_engine_run_rayleigh
				(dao, specs, &info->param.rayleigh);
		case RayleighTailDistribution:
			return tool_random_engine_run_rayleigh_tail
				(dao, specs, &info->param.rayleigh_tail);
		case LevyDistribution:
			return tool_random_engine_run_levy
				(dao, specs, &info->param.levy);
		case FdistDistribution:
			return tool_random_engine_run_fdist
				(dao, specs, &info->param.fdist);
		case TdistDistribution:
			return tool_random_engine_run_tdist
				(dao, specs, &info->param.tdist);
		case GammaDistribution:
			return tool_random_engine_run_gamma
				(dao, specs, &info->param.gamma);
		case GeometricDistribution:
			return tool_random_engine_run_geometric
				(dao, specs, &info->param.geometric);
		case WeibullDistribution:
			return tool_random_engine_run_weibull
				(dao, specs, &info->param.weibull);
		case LaplaceDistribution:
			return tool_random_engine_run_laplace
				(dao, specs, &info->param.laplace);
		case GaussianTailDistribution:
			return tool_random_engine_run_gaussian_tail
				(dao, specs, &info->param.gaussian_tail);
		case LandauDistribution:
			return tool_random_engine_run_landau
				(dao, specs);
		case LogarithmicDistribution:
			return tool_random_engine_run_logarithmic
				(dao, specs, &info->param.logarithmic);
		case LogisticDistribution:
			return tool_random_engine_run_logistic
				(dao, specs, &info->param.logistic);
		case Gumbel1Distribution:
			return tool_random_engine_run_gumbel1
				(dao, specs, &info->param.gumbel);
		case Gumbel2Distribution:
			return tool_random_engine_run_gumbel2
				(dao, specs, &info->param.gumbel);
		case BinomialDistribution:
			return tool_random_engine_run_binomial
			        (dao, specs, &info->param.binomial);
		case NegativeBinomialDistribution:
			return tool_random_engine_run_negbinom
			        (dao, specs, &info->param.negbinom);
		}
	}
	return TRUE;  /* We shouldn't get here */
}