 Welcome to dealing with materials data. This is a course on collection analysis and interpretation of data. We are looking at module 6 and this is a second case study and this is a case study on error analysis. We have looked at this data earlier. This is cyanide interaction with hydrogen. It is a gas phase reaction and reaction rate is given with error and it is given in 10 to the power 10 centimeter cube mole inverse second inverse and the temperature is given in Kelvin. We have done this exercise. We have tried to, but we have not done the error analysis bit carefully. So, what we want to do is that okay, so we will take this reaction rate data. We want to fit it to this form because we know that it should go as some constant temperature to the power B and by some theoretical arguments we know that B is 2.45 exponential minus EA by RT. So, you can, we have done this exercise of fitting. We have taken K by T to the power B as the quantity and we have taken log on either side. So, it gives log A minus EA by RT. So, by 1 by T versus log K by T to the power B if you fit, then you can get the intercept from which you can calculate A and from the slope you can calculate EA by RT. And the paper gives these values as 3.1 plus or minus 0.3 into 10 power 5 and 9.3 plus or minus 0.2 kilojoules the A and EA. How do you get these parameters? And we have done this exercise earlier and, but we did not discuss in detail how the errors themselves got calculated. So, in this exercise we are going to do this. To do so, we have to recall that if y is log of x then the error in y is nothing but error in x by x that comes because we take dou y by dou x and sigma x. So, log x if you differentiate that it gives you 1 by x. So, if you know the error in the x quantity sigma x then sigma x by x will be the error in log of that quantity which is y. And similarly if y is exponential x the error in y will be just the error in x multiplied by the x itself. So, we are going to take this quantity and we are going to fit it for k by t to the power b and we are going to linearize by taking logarithm. And so log k by t to the power b error in k is known and we are going to assume that the temperature has negligible or no error. And in order to fit with different weights we have to use the error that is given for k and when we fitted last time we had been a bit sloppy because we just took the error value but we know that because we have done the log transformation the error should also be transformed by making it sigma x by x. So, the whatever error that was given for k that is the delta k should be divided by k and that should be the error that should be used for fitting purposes. So, we are going to do this exercise now. And then once the fit is known of course you will know log A and the standard error in log A from which we are going to get the A value and the error in A value. And because it is exponential now you have to use the other formula where you said that it is x into sigma x is the error in sigma y. And after fit of course EA is known and it is straight forward to calculate the error in EA. So, this is the exercise we are going to do and the paper that I had referred to also has the data for cyanide interaction reaction with oxygen. And I am going to leave that as an exercise for you to do and calculate the parameters as well as errors in them. So, that is what you will do but for now we will take the cyanide hydrogen data and do the exercise as we did last time. But this time we will be a little bit more careful with the way we calculate the errors. Okay, so let us do this exercise. So, first we are going to read the data and inverse T is nothing but 1 by T and log K is nothing but the K value and it is 10 power 10 remember. So, we can plot inverse T versus log K and log K by T is nothing but a logarithm of K divided by T to the power 2.45. And now the standard deviation that we have for K has to be transformed because it has to be divided by the K itself. And because this why I mean T to the power 2.45 is a constant and we are going to consider it like some alpha and so we are going to just carry that constant. And so this is the standard deviation and so the variance is squared and we are going to use 1 by standard variance as the weight for our fitting exercise. So, this is the fitting exercise and this is the summary fit. So, let us run this code. So, we have this T versus log K and it has a slight curvature because it is also dependent on T through the other formula. Now we have the estimated value for intercept and standard error and so you can calculate. So, you can this is the standard error. So, if you have the exponential of so you get 4.366148 into 10 power 5 as the intercept and to calculate the error you have to multiply by the standard error because that is this is a transformation where we are taking exponential. So, the correct answer is now 4.36 plus or minus 0.5 into 10 power 5. Similarly, you have the fit coefficient 2 and that is E A by R. So, we have to multiply by the universal gas constant and that gives you 9.9 kilojoules and to calculate error in this quantity we just have to take this value and multiply by. So, we have minus 9.9 plus or minus 0.9 kilojoules as the fitting parameter. So, all this we did by using the formula linear model. So, we fitted the log K by T versus 1 by T and of course there are other ways of fitting. So, let us try some other ways of fitting also. So, we will use the library mass and we will do robust linear model. So, we have done the robust linear model and same formula we have fitted and using the same weights. Now you can see that this is the value. So, it is 4.3 again and if you multiply this quantity by you will get so it is 4.3 plus or minus 0.2 into 10 to the power 5. So, that is what we get and in this case again you have to multiply by 8.3145 to fit dollar coefficients 2. So, it gives 9.9 and if you want to calculate the error in this quantity of course we have to multiply by the error because this is standard. So, it is just a addition right. So, it is 9.9 plus or minus 0.3 kilojoules per mole per second is the kilojoules per mole per Kelvin is the activation energy that you get from this fitting. Of course you can do one more where we are going to do the non-linear fitting. Let us do that and see how it is different from our. See in this case we are going to do the fitting by just taking k and saying that it is A t to the power 2.45 into exponential some activation energy which is scaled by the universal gas constant times temperature. And the data is y and we have to give some initial values for the A values and the E N values and the weights are of course in this case we have not done any transformation. So, we are just going to take the variance squared. So, now you can see that we have fitted and you can see in this case also it is 3.9 plus or minus 0.7 and here again you have to just multiply by 8.3145 to get the values. So, it is 9.5 and the error so it is 9.5 plus or minus 0.7 kilojoules per mole per Kelvin is the activation energy. So, the good news is that we are getting the same value of about 4.3, 3.9 as the estimate for the A the pre exponential constant and we are getting the same 9.5 kilojoules for the 9.5, 9.9 and 9.9. So, which is the activation energy we are getting. So, to summarize we have learnt about error propagation in the error analysis. So, we know how the error should go and knowing that if a transformation is log or exponentiation we know how the error should be calculated. So, when you do fitting and for fitting when you do transformation on the variables when the error is given for those variables they should also be accordingly transformed and in this case we were doing weighted fitting by giving different weights to different points which is based on the variance of that particular data measurement. So, when we do the transformation we have to keep track of the transformation on the error also. If you do that then you get the fitting and once you have fitted from the standard error that you get for the fitted parameters you can also give the error in the quantity that you are trying to estimate and again you have to use the error propagation formulae that we have learnt in terms of exponentials just adding and constant and things like that and once you do that you can give these parameters. So, when you have some experimental data and when you have done some fitting when you want to report it is always a good idea to also report the error and for doing that you can use the information that you get while fitting as the standard error and you can report it so that people have a clearer idea about the accuracy to which you are reporting your values that you have estimated. So, there is two more data sets that is available in from the same paper and we are going to share those data also in CSV format with you. So, I strongly recommend that you do similar exercise and that is a far more easier exercise because there is no t to the power 2.45 in those cases it is straightforward Arrhenius fit k which is the reaction rate is some a times exponential minus ea by RT. So, your task is to evaluate the a and the ea and you can do that by linearizing and fitting but while linearizing because you are taking a logarithm and because the error is given in k you should also calculate the error accordingly and use that to wait when you are doing the fitting. So, that is the part that you need to do and then you can get those parameters of fitting and you can compare with what is given in the paper and in this case of course what is given in the paper does not match with what we are getting but consistently the different methods are giving values which are comparable. So, I assume that what we are doing is okay but of course you are welcome to dig deeper and convince yourself that what we are doing is okay and if not you should let us know. Thank you.