Wednesday, March 18, 2020

Degrees of Freedom for Independence in Two-Way Table

Degrees of Freedom for Independence in Two-Way Table The number of degrees of freedom for independence of two categorical variables is given by a simple formula:   (r - 1)(c - 1).   Here r is the number of rows and c is the number of columns in the two way table of the values of the categorical variable.   Read on to learn more about this topic and to understand why this formula gives the correct number. Background One step in the process of many hypothesis tests is the determination of the number degrees of freedom.   This number is important because for probability distributions that involve a family of distributions, such as the chi-square distribution, the number of degrees of freedom pinpoints the exact distribution from the family that we should be using in our hypothesis test. Degrees of freedom represent the number of free choices that we can make in a given situation. One of the hypothesis tests that requires us to determine the degrees of freedom is the chi-square test for independence for two categorical variables. Tests for Independence and Two-Way Tables The chi-square test for independence calls for us to construct a two-way table, also known as a contingency table. This type of table has r rows and c columns, representing the r levels of one categorical variable and the c levels of the other categorical variable. Thus, if we do not count the row and column in which we record totals, there are a total of rc cells in the two-way table. The chi-square test for independence allows us to test the hypothesis that the categorical variables are independent of one another. As we mentioned above, the r rows and c columns in the table give us (r - 1)(c - 1) degrees of freedom. But it may not be immediately clear why this is the correct number of degrees of freedom. The Number of Degrees of Freedom To see why (r - 1)(c - 1) is the correct number, we will examine this situation in more detail. Suppose that we know the marginal totals for each of the levels of our categorical variables. In other words, we know the total for each row and the total for each column. For the first row, there are c columns in our table, so there are c cells. Once we know the values of all but one of these cells, then because we know the total of all of the cells it is a simple algebra problem to determine the value of the remaining cell. If we were filling in these cells of our table, we could enter c - 1 of them freely, but then the remaining cell is determined by the total of the row. Thus there are c - 1 degrees of freedom for the first row. We continue in this manner for the next row, and there are again c - 1 degrees of freedom. This process continues until we get to the penultimate row. Each of the rows except for the last one contributes c - 1 degrees of freedom to the total. By the time that we have all but the last row, then because we know the column sum we can determine all of the entries of the final row. This gives us r - 1 rows with c - 1 degrees of freedom in each of these, for a total of (r - 1)(c - 1) degrees of freedom. Example We see this with the following example.   Suppose that we have a two way table with two categorical variables.   One variable has three levels and the other has two.   Furthermore, suppose that we know the row and column totals for this table: Level A Level B Total Level 1 100 Level 2 200 Level 3 300 Total 200 400 600 The formula predicts that there are (3-1)(2-1) 2 degrees of freedom.   We see this as follows.   Suppose that we fill in the upper left cell with the number 80.   This will automatically determine the entire first row of entries: Level A Level B Total Level 1 80 20 100 Level 2 200 Level 3 300 Total 200 400 600 Now if we know that the first entry in the second row is 50, then the rest of the table is filled in, because we know the total of each row and column: Level A Level B Total Level 1 80 20 100 Level 2 50 150 200 Level 3 70 230 300 Total 200 400 600 The table is entirely filled in, but we only had two free choices.   Once these values were known, the rest of the table was completely determined. Although we do not typically need to know why there are this many degrees of freedom, it is good to know that we are really just applying the concept of degrees of freedom to a new situation.

Monday, March 2, 2020

Run a Diesel on Waste Vegetable Oil (WVO)

Run a Diesel on Waste Vegetable Oil (WVO) So, you’re here because you’re curious about the process of running a diesel engine on waste vegetable oil gathered from a restaurant? Well, good for you. Our guess is that in addition to still having the first nickel you ever earned tucked between your mattress and box spring, you no longer want to contribute to all the nastiness that goes along with America’s dependence on fossil fuel. Give yourself a pat on the back. We’re conservationists. People who don’t want to use more of this world’s resources than necessary, and we place a priority on getting a little more mileage out of stuff that most people would toss aside. We’re also rugged individualists. People who don’t like to depend on others when they can depend on themselves. Run a Diesel on Waste Vegetable Oil: A Reality Check By now, you’ve probably read all of the waste veggie oil propaganda: diesel engines run fine on vegetable oil, just as they were originally designed to; restaurants are dying to get rid of this viable fuel alternative - to them it’s a waste product; burning veggie oil is better for the planet than burning fossil. As far as we’ew concerned, all of that is true. But going into this you also need to know that there are no free lunches and no free rides. Yes, you will save money, but you’ll be trading off valuable time out of your life. Compare burning waste vegetable oil in your car to another popular grassroots sustainable energy process: burning wood to heat your house. If you’ve ever cut, split and stacked enough firewood to last through a cold winter, you know what were talking about. It saves you money out of pocket, but it’s going to cost you some sweat and maybe even a minor flesh wound or two. Run a Diesel on Waste Vegetable Oil: Things to Keep in Mind First, if you make a deal with a restaurant to collect their oil, you need to do so in a prompt, professional manner. In my case, the restaurant had little storage space and was eager to get rid of their waste oil when they had a few containers filled up, lest they get cited for having it around in the event of a health department inspection. So when the manager of that fine establishment called, she expected me to get over and collect the oil, pronto. Next, you have to store the oil. I have two clean 55 gallon drums in which I store my filtered oil, but the five-gallon containers I get from the restaurant get stacked up in the corner of my garage until I get around to the next step. Which is... Filtering. There will be food particles suspended in the oil and, before you can burn it in your car, you need to get them out. This isn’t brain surgery, but it can be tedious if you’re doing it the old-fashioned way like I do it, pouring the oil through strainers by hand. There are more effective ways, but it will involve buying additional equipment, a pump, hose, spin on filters etc. Then there’s the waste. My oil is given to me in five-gallon plastic containers inserted in cardboard boxes. These are recyclable, but you’ll have to clean out the containers or risk drawing the ire of the folks at the local transfer station. Ditto for the cardboard. If it’s soaked in oil, they might reject it, which means you’ll be sending it to the landfill. In addition to the packaging waste, you will also invariably have some oil at the bottom of the containers that are so polluted with charred food that it’s virtually unusable. You’re going to need to get rid of this too, unless you plan on taking the time to clean it and burn it. Run a Diesel on Waste Vegetable Oil: Modifying the Vehicle You need to modify your vehicle to burn WVO. If you are planning to burn WVO in a car that is under warranty, first off, I think you’re out of your mind, and second, this will definitely void said warranty. The best kit on the market  is the Greasecar kit. It costs about $1,000, less installation. If you can’t do it yourself, then at $80 an hour, which is what most repair shops charge, you could be looking at more than $1,000 for installation. In fact, Greasecar charges between $1,000 - $1,400 for installation. If you’re driving 15,000 miles a year in a VW diesel that gets 40 mpg, it’s going to take you more than a year just to pay off the price of the kit and the installation. Run a Diesel on Waste Vegetable Oil: Maintenance It’s possible to filter all of the fryer junk out of the oil before you dump it in your car, but for some reason, I’m never able to. So you’re going to have to change the filters on your car more frequently than you ever had to while burning diesel. This isn’t a big deal, but it is one more step in the process that people who just pull up to the pump, fill up and then drive off, never have to deal with. And if you drive too far with a clogging filter, you could be left on the side of the road facing a $200 tow bill. (This happened to me). And there goes some of your savings. Run a Diesel on Waste Vegetable Oil: Final Thoughts Its important to understand that burning WVO isn’t as straightforward as some might lead you to believe. It is interesting and rewarding but will require some work on your part. But, hey, we’re conservationists and rugged individualists. We don’t give up after hearing a little straight talk, right?