 Reagration analysis tells us the relationship between one dependent variable and one or more independent variable. One of the problems with regression analysis or one of the limitations is that it focuses on linear relationships only. However, many relationships in nature and social life are non-linear in nature. And one very useful technique for dealing with that kind of relationship is the log transformation or logarithm transformation if we write the log in long form. So what does that actually do? What does log transformation do? Many papers contain statements like this. We use the log of the revenue since revenue for our firms is highly skewed. So that's very common. The researchers say that something is skewed and we take a log of something to make it more normal. That has a couple of issues, that kind of statement. But let's first take a look at what log transformation does to address skewness. So these are the data from the largest 500 Finnish companies in 2005, the revenues for those companies. So we have one very large company here. Then some companies here and most are here around a few hundred million euros of revenue. So we have a couple of billion euro companies and most companies are in the hundreds of millions range. So this distribution is highly skewed. It means that there is this long tail here. So we have most observations are clustered here. And then we have some that go to this long tail here. These kind of skewed distributions are sometimes problematic. But we have to understand that for example regression analysis makes no assumptions about how observed variables are distributed. It makes some assumptions but the distribution of observed variables is not one of those. If we take a logarithm of these every revenue here, we get the distribution that looks like that. So we get something that doesn't have as long tail as before. So now the observations are more closely clustered around the mean. There is still some tail here but not as severe. So these units here are now logarithms. I'm using the base 10 here for ease of exposition but normally we use the natural logarithm. It doesn't really make a difference for your analysis. So this is the 100 million threshold. This is the 1 billion threshold. Then we have 10 billion and then 100 billion threshold here. So we changed the scale of the variable by taking a logarithm. The logarithm transformation actually does. It changes the shape of the distribution. So this is highly skewed. This is still skewed but less so. So in some cases it actually reduces the skewness of data. But that's not the reason why we actually use it. So we don't need our data to be normal. But instead sometimes thinking in terms of relative units makes a lot more sense than thinking in terms of absolute units. Absolute units here means that the difference between 0 and 1 billion is the same as 1 billion and 2 billion. So let's think for a while. Does it make sense to say that when company grows to 0 to 1 billion, it's the same kind of transformation for the company than when it grows from 1 billion to 2 billion? No, that doesn't make any sense. Also companies generally don't say that we grew this and this many euros. Instead we grew 10% or 15% compared to the previous year's revenue. So quite often we like to compare things in relative terms. You get your salary increases based on labor union negotiations. They are hardly ever fixed euro amounts. They are 1%, 2%, something related to your current salary level. So they are relative units. So here the relative units means that the difference between 1 billion and 1 billion is relatively the same than the difference between 1 billion and 10 billion. So each space between these two ticks doesn't refer to a unit increase. Instead it refers to a 10-fold increase. So things increase relative to the previous level. So let's take a look at what it means to run a regression analysis with log transformation. And why would we want to do that? Transforming the variable was to be less skewed is not the right reason to use log transformation. And if you want to reduce QNC of course can do log transformation. But you have to understand that there are other more important reasons to use log transformation. And it also influences how you interpret the results. So this is the example data set from the press release data set. This is our occupations from the Canada census of 1970 something. And we have prestige score of an occupation and then the average income of an occupation. We are interested in learning how much income depends on prestige. We can see that there is a linear effect here. Prestage goes from 20 to 80. And first income increases and then it starts to increase in a non-linear fashion. So if we were to draw a line or a curve it would first go flat and then it would curve up a bit. So the line here is not the best description of the data. We can see here that these observations are below the regression line. And these are above the regression line. So instead of fitting a line, fitting some kind of curve that bends up would be better. Something like that. So instead of saying that these are characterized by a line, we say that these observations are characterized by this blue curve here. And that is what the log transformation does for us. And that's the important reason why we use it. So instead of saying that our income increases as a constant function of prestige, we say that income increases as a relative function to the current level of income as a function of prestige. Let's take a log transformation of income and run a regression analysis. So here's my regression analysis. This is the income done with R using this data. We can see that one unit increase in prestige leads to 176 Canadian dollars more per year. And then when we have log of income, then log of income increases by 0.03 for every additional unit of prestige. So the problem with this, we know that the log is first has a slightly higher R-square and also slightly higher adjusted R-square than the income. So based on that metric, we can make an informal judgment that this could be a better model. It's not certain that higher R-square means that it's a better model, but it could be. How we judge models will come up later videos. So how do we interpret? What does this 0.03 increase in the log of revenue, log of income mean? For most people, the metric of log of income doesn't have any meaning. Someone tells me that the logarithm of your income will increase by 0.01. I know what it means because I've done this. I've read my statistics books, most people don't. So how do we interpret? There are two ways of interpreting the log transformation results. One is the general way of interpreting any non-linear effects and that is plotting. So you can do here the regression results for the log transfer model. What we do here is that we calculate the fitted values of the logarithm of income based on prestige. So this is simply taking the formula, adding intercept 0.746 plus 0.02 times 20. So that provides us the fitted income. And the hat here denotes that this is a fitted value from the regression analysis. Then we take exponentials of these incomes. So when you take a logarithm of a number, you get another number. When you apply exponential to that other number, you get back your original number. So we say that the exponential is the inverse function of logarithm. And logarithm is the inverse function of exponential because we can apply one to get back the original number that was used as an input for the other. So exponential transformation allows us to undo the log transformation and we get these predicted incomes for each prestige level. Then we plot the data. So we plot these exponentiated logs, predicted logs of income here. And as a function of prestige, we get this curve. So whenever you don't know how to interpret a particular regression estimate that has been calculated based on some transformation, one very good way of doing that is to plot the effect. You can also plot the linear model effects only and then you can compare which one looks more reasonable. So if you see the blue curve, the log transformed results look a lot more reasonable explanation for the data than the red line. So that is one way, the general way that you can interpret any non-linear effects. And this kind of plot where you draw a line, it's called a marginal prediction plot. We will cover these later on the course. Another way of interpreting regression analysis results after log transformation is to interpret them directly. So log transformation is a special case of transformations because it has a natural interpretation. These interpretations are given by Woolridge's book here. So when we take log of the dependent variable, then each of these regression coefficients here only for prestige, they change their meaning. So the meaning of this unit increase of prestige is actually translated to relative increase. So beta 1 of prestige here doesn't tell us what is the unit increase of prestige, what's that effect on income. Instead it tells what is the effect of one unit increase of prestige on the relative income. So if your prestige, if the regression coefficient of prestige is 0.025 like it's here, then it means that one unit increase in prestige leads to a 2.5% increase in salary compared to a current salary level. So these are, it's an exponential growth model, that's why we use the exponential function. So every time your prestige for occupation increases by 1, then your salary goes up to 2.5% compared to the previous level. Calculating how much for example 10 units would mean, could be a bit difficult because you have to take, there are 2% and then apply that 10 times to 2.5%, so it's 1.025 to the power of 10 and then you will get the effect of 10 unit increase of prestige. In practice your statistical software will do the marginal effects calculation for you. So doing a plot like that would simplify the interpretation because you can see directly what is the effect of moving from prestige 140 to prestige 60 by checking the line. Also the software will give you the numbers behind these plots. So that's how you calculate marginal effects. The actual calculation is covered in a different video.