Removing outliers using standard deviation
    8 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Angelavtc
 el 17 de Feb. de 2021
  
    
    
    
    
    Comentada: Angelavtc
 el 19 de Feb. de 2021
            Hello everyone, 
I have a timetable of 8764*3. The first column corresponds to the date, the second to the hour (which goes from 1 to 24 in double format) and the third is a price. My objective is that, for each hour, I remove the prices that are above (Mean of that hour + 3*SD of the prices of that hour) and any price below (Mean of that hour - 3*SD of the prices of that hour). I know I could use the code: 
rmoutliers(A,'mean');
However, this filter would take into account all the hours of the sample. Could someone kindly help me to apply it for each hour? 
I attach here the data so you can have a clear view of what I have. 
Thank you!
0 comentarios
Respuesta aceptada
  Ive J
      
 el 18 de Feb. de 2021
        groupfilter does the trick
cleanTable = groupfilter(yourTable, 'Hour', @(x)~isoutlier(x, 'mean'), 'Price');
3 comentarios
  Ive J
      
 el 19 de Feb. de 2021
				Yes, outTab (complement of cleanTable) would contain outliers per each hour:
outTab = groupfilter(yourTable, 'Hour', @(x)isoutlier(x, 'mean'), 'Price');
Más respuestas (0)
Ver también
Categorías
				Más información sobre Financial Toolbox en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!