- WELCOME TO A LESSON ON LOGISTIC REGRESSION.
THE GOALS OF THE VIDEO ARE TO PERFORM LOGISTIC REGRESSION
ON THE TI84 GRAPHING CALCULATOR,
DETERMINE HOW WELL THE REGRESSION MODEL FITS THE DATA,
AND THEN MAKE PREDICTIONS USING THE REGRESSION EQUATION.
A LOGISTIC FUNCTION IS DEFINED
AS WE SEE HERE, WHERE A, B, AND C ARE CONSTANTS,
AND IF B IS > 0 WE HAVE A GROWTH MODEL,
AND IF B IS < 0 WE HAVE A DECAY MODEL.
SO PICTURED HERE IN RED, WE HAVE A LOGISTIC GROWTH MODEL.
SO IF OUR SCATTER PLOT FITS THE PATTERN OF THIS CURVE,
LOGISTIC REGRESSION WOULD BE A GOOD CHOICE TO MODEL THE DATA.
LET'S TAKE A LOOK AT SOME OTHER VARIATIONS
OF THE LOGISTIC CURVE.
HERE'S ANOTHER MODEL OF LOGISTIC GROWTH.
NOTICE HOW AT THE BEGINNING IT LOOKS LIKE EXPONENTIAL GROWTH,
BUT THEN OVER TIME IT LEVELS OFF.
AND IT CAN TAKE ON A VARIETY OF FORMS
AND STILL MODEL LOGISTIC GROWTH, AS WE SEE HERE.
THESE WOULD ALL BE LOGISTIC GROWTH.
AND HERE WE SEE A MODEL OF LOGISTIC DECAY.
SO AGAIN, BASED UPON HOW THE SCATTER PLOT BEHAVES,
WE MAY WANT TO SELECT LOGISTIC REGRESSION.
LET'S TAKE A LOOK AT AN EXAMPLE.
HERE A POPULATION OF A NEW FISH WAS INTRODUCED TO A LAKE,
AND WE'RE COMPARING THE NUMBER OF MONTHS SINCE THE INTRODUCTION
TO THE FISH POPULATION IN THE THOUSANDS.
LET'S CREATE A SCATTER PLOT,
AND SEE IF LOGISTIC FUNCTION WOULD BE APPROPRIATE.
SO THE FIRST THING WE'RE GOING TO DO IS ENTER IN OUR DATA.
SO WE'LL PRESS THE STAT KEY AND THEN ENTER,
CLEAR OUT ANY OLD DATA BY GOING TO THE TOP OF THE COLUMN,
PRESS CLEAR, AND THEN ENTER.
SO WE'LL GO TO THE TOP OF L1 AND PRESS CLEAR, ENTER,
AND NOW WE'LL ENTER THE NEW DATA.
NOW WE NEED TO ADJUST THE WINDOW TO MAKE SURE
THAT THESE SIX POINTS WILL SHOW ON THE SCREEN.
I'VE ALREADY DONE THAT.
LET'S GO AHEAD AND TAKE A LOOK.
NOTICE THE X VALUES GO FROM 0 TO 5,
SO I SET THE X MINIMUM TO -1 AND THE X MAX TO 6,
SCALING IT BY ONES.
NOTICE THAT 0 THROUGH 5 ARE IN THIS INTERVAL.
AND THEN THE Y VALUES GO FROM 1000 TO 10500.
I WANTED TO SEE THE ORIGIN, SO I SET THE Y MINIMUM TO -500,
THE Y MAX TO 11000.
AGAIN, NOTICE THESE VALUES WILL BE IN THIS INTERVAL,
AND I SCALED IT BY FIVE HUNDREDS.
LET'S GO AHEAD AND PRESS GRAPH,
AND IT DOES LOOK LIKE LOGISTIC GROWTH WILL BE A NICE MODEL
FOR THIS DATA.
LET'S GO AHEAD AND PERFORM THE REGRESSION,
AND ALSO STORE THE REGRESSION EQUATION IN Y1.
UNFORTUNATELY, THE TI84 GRAPHING CALCULATOR
DOES NOT SHOW R SQUARED FOR LOGISTIC REGRESSION,
SO THERE'S NO NEED TO MAKE SURE THE DIAGNOSTIC TOOL IS TURNED ON
FOR LOGISTIC REGRESSION.
LET'S GO AHEAD AND PRESS THE STAT KEY,
RIGHT ARROW ONCE, AND SCROLL DOWN TO LOGISTIC REGRESSION,
WHICH IS OPTION B.
SO WE'RE GOING TO PRESS ENTER HERE.
NOW, WE WANT TO STORE THE EQUATION IN Y1,
SO WE'RE GOING TO PRESS VARS,
RIGHT ARROW ONCE, ENTER, AND THEN ENTER TO SELECT Y1.
SO THE REGRESSION EQUATION WILL BE AUTOMATICALLY STORED IN Y1.
SO NOW WE'LL PRESS ENTER.
HERE'S OUR LOGISTIC MODEL, AND IT'S ALSO STORED IN Y1.
NOTICE HERE WE HAVE THE VALUES OF A, B, AND C,
AND IF WE PRESS GRAPH,
WE HAVE THE SCATTER PLOT AND THE MODEL GRAPHED
ON THE SAME COORDINATE PLANE.
AND WE CAN VISUALLY SEE THAT THE EQUATION
IS AN EXCELLENT MODEL FOR THE GIVEN DATA.
IN FACT, IT ALMOST LOOKS LIKE IT GOES THROUGH EACH POINT.
LET'S GO AHEAD AND WRITE DOWN OUR EQUATION,
AND THEN ANSWER SOME QUESTIONS BASED UPON OUR MODEL.
THE FIRST QUESTION IS WHAT WILL THE FISH POPULATION BE
AFTER ONE YEAR ACCORDING TO OUR MODEL?
REMEMBER THAT X REPRESENTS THE NUMBER OF MONTHS,
AND Y REPRESENTS THE POPULATION IN THOUSANDS.
SO IF WE WANT TO KNOW WHAT THE POPULATION IS AFTER ONE YEAR,
WE WANT TO KNOW WHEN X = 12, FOR 12 MONTHS,
WHAT WOULD Y BE EQUAL TO?
THERE'S A COUPLE OF WAYS TO ANSWER THIS QUESTION.
ONE WAY WOULD BE TO USE THE TABLE FEATURE.
IF WE PRESS SECOND WINDOW,
LET'S HAVE THE TABLE START AT 0, INCREASE BY ONES,
AND LEAVE THESE ON AUTOMATIC.
SO IF WE PRESS SECOND GRAPH, WE CAN JUST SCROLL DOWN TO X = 12,
AND THE Y VALUE WOULD BE OUR POPULATION.
SO IT LOOKS LIKE IT'S 10,661.
HOWEVER, REMEMBER THIS IS IN THOUSANDS,
SO THAT WOULD BE THOUSANDS OF FISH.
THE OTHER WAY WOULD BE TO GO BACK TO THE HOME SCREEN
AND SELECT Y1 OF 12.
WE DO THAT BY PRESSING VARS, RIGHT ARROW, ENTER, ENTER,
AND THEN IN PARENTHESES ENTER 12.
SO THIS IS JUST LIKE FUNCTION NOTATION,
AND I ACTUALLY PREFER THIS METHOD HERE.
BECAUSE REMEMBER, THIS IS IN THOUSANDS,
SO IF WE MULTIPLY THIS BY 1000
WE'LL HAVE THE ACTUAL NUMBER OF FISH PREDICTED FROM OUR MODEL.
SO IT LOOKS LIKE WE'D HAVE 10,660,543 FISH AFTER ONE YEAR,
BASED UPON OUR MODEL.
NUMBER TWO, IS THE MODEL A GOOD INDICATOR
OF THE INITIAL FISH POPULATION?
GOING BACK TO OUR DATA,
THE INITIAL FISH POPULATION WAS 1000 x 1000,
OR 1 MILLION FISH.
USING OUR MODEL, IF WE REPLACE X WITH 0,
THAT WILL GIVE US THE INITIAL AMOUNT BASED UPON THE MODEL.
AND INSTEAD OF DOING THIS BY HAND,
WE CAN GO AHEAD AND USE THE GRAPHING CALCULATOR
AND DETERMINE Y1 OF 0.
SO VARS, RIGHT ARROW, ENTER, ENTER.
SO Y1 OF 0 GIVES US APPROXIMATELY 1013.
REMEMBER THIS IS IN THE THOUSANDS,
SO I'LL MULTIPLY THIS BY 1000.
AND ACCORDING TO THE MODEL,
THE INITIAL POPULATION WAS 1,012,863 FISH.
AND AGAIN, THIS WAS FROM THE MODEL,
BUT THE ACTUAL DATA SAYS IT WAS 1 MILLION.
SO OUR MODEL IS OFF A LITTLE BIT,
BUT THAT'S THE CASE FOR MOST MODELS.
THERE ARE LIMITATIONS FOR EVERY MODEL.
NUMBER THREE ASKS WHAT WILL THE MAXIMUM BE?
IF WE GO BACK TO OUR TABLE AND START SCROLLING DOWN,
NOTICE HOW THE POPULATION LEVELS OUT AT IT
LOOKS LIKE APPROXIMATE 10,661.
AND AGAIN, THAT WOULD BE THOUSANDS,
SO THAT WOULD BE 10,661,000 AS THE MAXIMUM POPULATION.
SO WE CAN SEE FROM THE DATA
THE POPULATION GREW DRAMATICALLY FOR THE FIRST FOUR MONTHS,
AND THEN IT STARTED TO LEVEL OFF, MORE THAN LIKELY
BECAUSE THE LAKE HAD A LIMITED AMOUNT OF RESOURCES
TO SUPPORT THE POPULATION.
LOOKING AT THE EQUATION FOR A MOMENT, AS X INCREASED,
THIS EXPONENT DECREASED.
SO THIS ENTIRE TERM HERE ACTUALLY APPROACHED 0,
AND THEREFORE THE NUMERATOR OF THIS FRACTION
ROUNDED TO THE NEAREST INTEGER
GAVE US THE MAXIMUM FISH POPULATION.
AND THAT'S TRUE FOR ANY LOGISTIC GROWTH FUNCTION.
THE LAST QUESTION TO CONSIDER, IS THIS A GOOD MODEL?
WHY OR WHY NOT?
AGAIN, UNFORTUNATELY THE GRAPHING CALCULATOR
DIDN'T GIVE US R SQUARED,
BUT WE CAN TELL GRAPHICALLY THAT THIS MODEL
SEEMS LIKE AN EXCELLENT FIT FOR THAT DATA,
AND THEREFORE IT WOULD BE A GOOD MODEL TO MAKE PREDICTIONS,
ASSUMING THE RESOURCES IN THE LAKE
STAY CONSISTENT AFTER THE TIMEFRAME
PROVIDED BY THE GIVEN DATA.
I THINK WE'LL GO AHEAD AND STOP HERE.
I HOPE YOU FOUND THIS EXAMPLE HELPFUL.
THANK YOU AND HAVE A GOOD DAY.