How do I remove outliers?


Author
Message
YoshikoArima
YoshikoArima
New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)
Group: Forum Members
Posts: 4, Visits: 5
Hi, I would like to run a block to remove outlier before the finish block to get the average value when outliers are removed. Below is what I have in mind as an outlier block, but when I run it, the list.RTremove.mean is zero. Could you please tell me what I am doing wrong?

<block outlier>
/ onblockend = [
 var i=0;
 var RTmin= list.RT.mean - 3 * list.RT.standarddeviation ;
 var RTmax = list.RT.mean + 3 * list.RT.standarddeviation;
 var num = list.RT.poolsize;

 while (i <= num ) {
     var currentvalue = list.RT.item(i); 
     if (values.currentvalue >= values.RTmin && values.currentvalue <= values.RTmax)      
     { list.RTremove.appenditem(values.currentvalue) ;    
     };    
        i++;
    };        
]

</block>


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 103K
YoshikoArima - 8/10/2023
Hi, I would like to run a block to remove outlier before the finish block to get the average value when outliers are removed. Below is what I have in mind as an outlier block, but when I run it, the list.RTremove.mean is zero. Could you please tell me what I am doing wrong?

<block outlier>
/ onblockend = [
 var i=0;
 var RTmin= list.RT.mean - 3 * list.RT.standarddeviation ;
 var RTmax = list.RT.mean + 3 * list.RT.standarddeviation;
 var num = list.RT.poolsize;

 while (i <= num ) {
     var currentvalue = list.RT.item(i); 
     if (values.currentvalue >= values.RTmin && values.currentvalue <= values.RTmax)      
     { list.RTremove.appenditem(values.currentvalue) ;    
     };    
        i++;
    };        
]

</block>


Three issues at a glaince.

 - You intialize i with value 0. Lists in Inquisit 6 start with index 1 (not 0), so in the first iteration of the loop, when i is still 0

var currentvalue = list.RT.item(i);


will not retrieve anything.

- There's no ++ operator in Inquisit 6, so

 i++


will not increment i. The above should be

i += 1


- The below makes little sense:

var currentvalue = list.RT.item(i); 
if (values.currentvalue >= values.RTmin && values.currentvalue <= values.RTmax)
{ list.RTremove.appenditem(values.currentvalue) ;
};


A var is a temporary variable (local scope). You define a var called currentvalue.
A value is a different thing. <values> are global variables, and values.currentvalue is an entirely different entity than the local var called currentvalue you defined.

For anything more, you will need to provide actually runnable code, i.e. include the relevant lists and test vectors.

YoshikoArima
YoshikoArima
New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)
Group: Forum Members
Posts: 4, Visits: 5
Dave - 8/10/2023
YoshikoArima - 8/10/2023
Hi, I would like to run a block to remove outlier before the finish block to get the average value when outliers are removed. Below is what I have in mind as an outlier block, but when I run it, the list.RTremove.mean is zero. Could you please tell me what I am doing wrong?

<block outlier>
/ onblockend = [
 var i=0;
 var RTmin= list.RT.mean - 3 * list.RT.standarddeviation ;
 var RTmax = list.RT.mean + 3 * list.RT.standarddeviation;
 var num = list.RT.poolsize;

 while (i <= num ) {
     var currentvalue = list.RT.item(i); 
     if (values.currentvalue >= values.RTmin && values.currentvalue <= values.RTmax)      
     { list.RTremove.appenditem(values.currentvalue) ;    
     };    
        i++;
    };        
]

</block>


Three issues at a glaince.

 - You intialize i with value 0. Lists in Inquisit 6 start with index 1 (not 0), so in the first iteration of the loop, when i is still 0

var currentvalue = list.RT.item(i);


will not retrieve anything.

- There's no ++ operator in Inquisit 6, so

 i++


will not increment i. The above should be

i += 1


- The below makes little sense:

var currentvalue = list.RT.item(i); 
if (values.currentvalue >= values.RTmin && values.currentvalue <= values.RTmax)
{ list.RTremove.appenditem(values.currentvalue) ;
};


A var is a temporary variable (local scope). You define a var called currentvalue.
A value is a different thing. <values> are global variables, and values.currentvalue is an entirely different entity than the local var called currentvalue you defined.

For anything more, you will need to provide actually runnable code, i.e. include the relevant lists and test vectors.

Thank you very much !!! I will try them

YoshikoArima
YoshikoArima
New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)New Member (42 reputation)
Group: Forum Members
Posts: 4, Visits: 5
Dave - 8/10/2023
YoshikoArima - 8/10/2023
Hi, I would like to run a block to remove outlier before the finish block to get the average value when outliers are removed. Below is what I have in mind as an outlier block, but when I run it, the list.RTremove.mean is zero. Could you please tell me what I am doing wrong?

<block outlier>
/ onblockend = [
 var i=0;
 var RTmin= list.RT.mean - 3 * list.RT.standarddeviation ;
 var RTmax = list.RT.mean + 3 * list.RT.standarddeviation;
 var num = list.RT.poolsize;

 while (i <= num ) {
     var currentvalue = list.RT.item(i); 
     if (values.currentvalue >= values.RTmin && values.currentvalue <= values.RTmax)      
     { list.RTremove.appenditem(values.currentvalue) ;    
     };    
        i++;
    };        
]

</block>


Three issues at a glaince.

 - You intialize i with value 0. Lists in Inquisit 6 start with index 1 (not 0), so in the first iteration of the loop, when i is still 0

var currentvalue = list.RT.item(i);


will not retrieve anything.

- There's no ++ operator in Inquisit 6, so

 i++


will not increment i. The above should be

i += 1


- The below makes little sense:

var currentvalue = list.RT.item(i); 
if (values.currentvalue >= values.RTmin && values.currentvalue <= values.RTmax)
{ list.RTremove.appenditem(values.currentvalue) ;
};


A var is a temporary variable (local scope). You define a var called currentvalue.
A value is a different thing. <values> are global variables, and values.currentvalue is an entirely different entity than the local var called currentvalue you defined.

For anything more, you will need to provide actually runnable code, i.e. include the relevant lists and test vectors.

Thank you !!   Is there an easier way to remove outliers and take the average?
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 103K
YoshikoArima - 8/10/2023

Thank you !!   Is there an easier way to remove outliers and take the average?

No.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search