Drift correction for geochemical data
Mostrar comentarios más antiguos
I'm working on a code to automate data processing. Towards the end of my code, I need to determine if isotope data has drifted throughout the course of the analysis. Data are attached.
The first column of the data – fiji(:,1) – shows the line number of the analysis (each measurement is a new line)
The fourth column of the data – fiji(:,4) – shows the geochemical value for each measurement
What I need help with is a succinct way to determine if the slope of the drift is significantly different from zero. If the slope is not different from zero, then we don't need to worry about drift. If it is different from zero, I'll look at the R^2 value to determine if I want to proceed from a drift correction (already included in the code_.
Any insight about coding up if the slope is different from zero would be very appreciated. My first instinct was to use ANOVA, but I'm not sure how to apply it to this dataset.
Thanks!!
fiji = readtable("fiji.csv");
fiji = table2array(fiji);
%Calculate drift correction
drift_d18O = fitlm(fiji(:,1), fiji(:,4));
drift_d18O_slope = drift_d18O.Coefficients{2,1};
drift_d18O_intercept = drift_d18O.Coefficients{1,1};
%%If drift slope is significantly different from zero, then check R^2 below
%%If drift not significantly different from zero, stop analysis here & skip
%%to end
if (drift_d18O.Rsquared.Adjusted > 0.7)
disp('R squared indicates there IS significant d18O drift')
else
disp('R squared indicates there IS NOT significant d18O drift')
end
%Plot the drift correction
figure(1)
scatter(fiji(:,1), fiji(:,4));
%drift functions
function d = drift_d18O_func(x, d18O_slope, d18O_intercept)
d = x.*d18O_slope+d18O_intercept;
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre ANOVA en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

