From 56b84be1fe5976fc3005273131f63f1d552820b1 Mon Sep 17 00:00:00 2001 From: chapuisk Date: Thu, 16 Dec 2021 18:37:11 +0100 Subject: [PATCH] Add tTest to regression model --- .../models/Statistics/Regression.gaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ummisco.gaml.extensions.stats/models/Statistics/Regression.gaml b/ummisco.gaml.extensions.stats/models/Statistics/Regression.gaml index 03c0488660..0eb5f13774 100644 --- a/ummisco.gaml.extensions.stats/models/Statistics/Regression.gaml +++ b/ummisco.gaml.extensions.stats/models/Statistics/Regression.gaml @@ -27,9 +27,9 @@ global { matrix instances <- 0.0 as_matrix {3,length(dummy)}; loop i from: 0 to: length(dummy) -1 { dummy ag <- dummy[i]; - instances[1,i] <- ag.location.x; - instances[2,i] <- ag.location.y; - instances[0,i] <- ag.location.z; + instances[0,i] <- ag.location.x; + instances[1,i] <- ag.location.y; + instances[2,i] <- ag.location.z; } //Compute the function of regression location_fct <- build(instances); @@ -38,6 +38,13 @@ global { //Predict the value using the function resulting before val <- predict(location_fct, [x_val, y_val]); write "value : " + val; + + //T test + list actuals <- dummy collect (each.location.z); + list predictions; + ask dummy { predictions <+ predict(location_fct, [location.x,location.y]); } + float p_value <- tTest(actuals,predictions); + write "p value : " + p_value; } }