X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fchisquare.c;h=1b77230642c6fca4ac6362bb872404615e92d4be;hb=96b31e17b2c336995db448531ab7f86f57319b5f;hp=337203f18deff6112f11ec91efb23f1e4b79b35a;hpb=9f087e7aa4cdff1d5d46d5e188c0017a9d2d0029;p=pspp diff --git a/src/language/stats/chisquare.c b/src/language/stats/chisquare.c index 337203f18d..1b77230642 100644 --- a/src/language/stats/chisquare.c +++ b/src/language/stats/chisquare.c @@ -344,7 +344,8 @@ chisquare_execute (const struct dataset *ds, struct hsh_table *freq_hash = NULL; struct casereader *reader = casereader_create_filter_missing (casereader_clone (input), - &ost->vars[v], 1, exclude, NULL); + &ost->vars[v], 1, exclude, + NULL, NULL); struct tab_table *freq_table = create_variable_frequency_table(dict, reader, cst, v, &freq_hash); @@ -362,12 +363,17 @@ chisquare_execute (const struct dataset *ds, xsq[v] = 0.0; for ( i = 0 ; i < n_cells ; ++i ) { + struct string str; double exp; const union value *observed_value = ff[i]->value; + ds_init_empty (&str); + var_append_value_name (ost->vars[v], observed_value, &str); + /* The key */ - tab_text (freq_table, 0, i + 1, TAB_LEFT, - var_get_value_name (ost->vars[v], observed_value)); + tab_text (freq_table, 0, i + 1, TAB_LEFT, ds_cstr (&str)); + ds_destroy (&str); + /* The observed N */ tab_float (freq_table, 1, i + 1, TAB_NONE, @@ -409,7 +415,8 @@ chisquare_execute (const struct dataset *ds, double total_obs = 0.0; struct casereader *reader = casereader_create_filter_missing (casereader_clone (input), - &ost->vars[v], 1, exclude, NULL); + &ost->vars[v], 1, exclude, + NULL, NULL); struct hsh_table *freq_hash = create_freq_hash_with_range (dict, reader, ost->vars[v], cst->lo, cst->hi); @@ -428,13 +435,17 @@ chisquare_execute (const struct dataset *ds, xsq[v] = 0.0; for ( i = 0 ; i < hsh_count (freq_hash) ; ++i ) { + struct string str; double exp; const union value *observed_value = ff[i]->value; + ds_init_empty (&str); + var_append_value_name (ost->vars[v], observed_value, &str); /* The key */ tab_text (freq_table, v * 4 + 1, i + 2 , TAB_LEFT, - var_get_value_name (ost->vars[v], observed_value)); + ds_cstr (&str)); + ds_destroy (&str); /* The observed N */ tab_float (freq_table, v * 4 + 2, i + 2 , TAB_NONE,