YouTube transcript (YwsYKNWSw2o) — Transcript
Full transcript
- 0:00hello and welcome to the next video in
- 0:02my series on basic statistics if you are
- 0:05a firsttime viewer please stick around
- 0:07for the intro it is worth the time at
- 0:09least once if you are a regular viewer
- 0:11feel free to skip ahead using The
- 0:13annotation so first a few things I do
- 0:16these videos because I love to learn and
- 0:18help others learn we are all good at
- 0:20something so I encourage you to give
- 0:23back to the world in a similar way share
- 0:25your passion whatever it is any way you
- 0:28can now this video focuses on basic
- 0:31stats and is not a quick fix it aims to
- 0:34be thorough my goal is an understanding
- 0:37of fundamental concepts and that takes
- 0:39time but when you understand the
- 0:40fundamentals learning other topics is
- 0:43much easier now related to that if
- 0:46you're watching because you are
- 0:47struggling in a class or at work I want
- 0:50you to stay positive and keep your head
- 0:51up you can learn this I have faith in
- 0:55you many other people around you have
- 0:57faith in you and so should you
- 1:00feel free to connect with me on LinkedIn
- 1:03go+ Twitter and of course subscribe here
- 1:06on YouTube now if you think there is
- 1:08something I can do better please leave a
- 1:10constructive comment below I do take
- 1:13those comments into account when I make
- 1:14new videos I also encourage you to talk
- 1:17with other viewers in the comments help
- 1:19each other when you can and finally if
- 1:22you like the video please give it a
- 1:24thumbs up share it with classmates or
- 1:27colleagues and put it on a playlist for
- 1:29review later that does encourage me to
- 1:31keep making them for you so let's go
- 1:34ahead and start
- 1:37learning so this video is the next in
- 1:40our series about multiple regression now
- 1:42it's really an extension of part four
- 1:44and in part four we looked at the case
- 1:46where we had one dummy variable in this
- 1:49video we're going to extend that to two
- 1:51dummy variables we will see how to set
- 1:53up the problem we will see how to
- 1:54conduct the analysis and then interpret
- 1:56our result in the end now if you did not
- 1:59watch part 4
- 2:00I highly recommend going back and
- 2:01watching it before proceeding with this
- 2:04one so that small warning aside let's go
- 2:07ahead and get
- 2:10started so as in the last video you are
- 2:13an analyst for a small company that
- 2:15develops house pricing models for
- 2:17independent Realtors to generate your
- 2:19models you use publicly available data
- 2:22such as the list price the square
- 2:23footage the number of bedrooms number of
- 2:25bathrooms among other data points that
- 2:27you
- 2:28collect now now in this problem you're
- 2:30interested in two main questions number
- 2:33one is the public high school in the
- 2:36neighborhood exemplary which is the
- 2:38highest rating and how is that rating
- 2:41related to the home price if at all
- 2:44number two what region so north south
- 2:47east or west of the city is the home
- 2:50located and how is that related to the
- 2:52home price if at all now you'll notice
- 2:55that this data is not quantitative it is
- 2:58qualitative they are categ atories in
- 3:01the first case the high school is either
- 3:02exemplary or it's not it's a yes or no
- 3:05question in the second case it's just
- 3:07the region or the directions of north
- 3:09south east or west so because we have
- 3:12categorical data we will need to use
- 3:14dummy variables in our regression to
- 3:16conduct this
- 3:19analysis so in this problem we are going
- 3:22to use 100 fictitious observations I did
- 3:26make up this data for this video so here
- 3:29are the first 15 observations let's go
- 3:31ahead and look at our data structure in
- 3:33the First Column we have our dependent
- 3:35variable which is price so the first
- 3:37home is
- 3:41$450,000 now in the second column we
- 3:43have our first independent variable
- 3:45that's the square footage so that first
- 3:47home is
- 3:493,860 square ft it's a very big home in
- 3:53the third column we have our second
- 3:55independent variable and that is whether
- 3:57or not the high school is exemplary or
- 3:59not so it's either yes or no and then in
- 4:03the fourth column we have our third
- 4:05independent variable which is region so
- 4:08north south east or west and that's how
- 4:11our data was originally collected now
- 4:13the first thing we're going to do is
- 4:15some recoding we're going to change our
- 4:17text entries such as yes no north south
- 4:20east or west into numerical values and
- 4:22we can do that like this so for examplar
- 4:26high school if it's a yes we code that
- 4:28as one if it's it's a no we code that as
- 4:30zero now for location we do it a bit
- 4:33differently I'm going to code these in
- 4:35alphabetical order and I do that to make
- 4:37many tab happy which I'll talk about
- 4:39later so East is the first alphabetical
- 4:42region so we'll give that a code of zero
- 4:45and then we have North which is a code
- 4:46of one then we have South which is a
- 4:49code of two and finally we have West
- 4:52which is a code of three so up to this
- 4:54point we've gone from text entries to
- 4:57numerical entries but we have not
- 4:59created our dummy variables yet we're
- 5:01going to go ahead and do that
- 5:02now so here we have what I call
- 5:05dumbification so the price column is the
- 5:08same the square footage column is the
- 5:10same the exemplary High School column is
- 5:12the same but now we have three dummy
- 5:15variables South West and North now you
- 5:19might be saying to yourself wait a
- 5:20minute we have four locations north
- 5:23south east and west but we only have
- 5:25three dummy variables well if you
- 5:27remember from part four our number of
- 5:29dummy variables is always the number of
- 5:31categories minus one so we have four
- 5:34categories north south east west minus
- 5:37one is three so we have three dummy
- 5:41variables now I think it's pretty
- 5:42straightforward to see how these are
- 5:44coded so for the first home we have it
- 5:47as being in the South Region so over
- 5:50here on the right for South we put a one
- 5:52under the South column now for the
- 5:54second home it's in the North Region so
- 5:57in that case we put a one in the the
- 5:59north column and the other regions are
- 6:01zero so you can kind of see how this
- 6:03works but you'll notice that there's no
- 6:06column for
- 6:08East Now by far the most important thing
- 6:11the most valuable thing you can do
- 6:12before you ever run a test before you
- 6:14ever crunch the numbers or anything is
- 6:17to look at some Scatter Plots of your
- 6:19data so here we have the price of the
- 6:22home versus its square footage along the
- 6:24x axis at the bottom we have the square
- 6:26footage and on the Y AIS on the left we
- 6:29have the price now we can see that this
- 6:31is a pretty linear relationship if we
- 6:34just sort of eyeballed a best fit line
- 6:36we would see that it runs sort of
- 6:37through the middle of the data now I
- 6:39would argue that this is probably a
- 6:40curval linear relationship but in this
- 6:43case we are doing linear regression
- 6:45we'll talk about nonlinear regression at
- 6:47a later point but we can see that this
- 6:49is a definite pattern of a smaller home
- 6:52having a smaller price and larger homes
- 6:54having larger
- 6:58prices now this Scutter plot is a bit
- 7:00more interesting as it separates out our
- 7:02data into groups so as you can see the
- 7:05blue dots represent homes where the high
- 7:08school is not exemplary and the red
- 7:11squares represent homes where the high
- 7:14school is exemplary now you can see a
- 7:17definite pattern here look at the blue
- 7:19dots where are they well they're
- 7:22definitely along the bottom of this
- 7:24scatter plot so especially if you look
- 7:27from about 2,000t homes up to 3,000 ft
- 7:31homes the blue dots are consistently
- 7:34below the red squares now we can go
- 7:36ahead and put some lines just sort to
- 7:38eyeball it and there they are so let's
- 7:40step back and look at the big picture
- 7:43let's take a average home that is
- 7:462500 ft now we can see that for a home
- 7:50that's 2500 ft the price of a home where
- 7:52the high school is not exemplary the
- 7:55blue dots in line is about $150,000
- 7:58[Music]
- 8:00now for the same size home 2500 sare ft
- 8:04if the high school is exemplary the home
- 8:08is a little bit over
- 8:11$200,000 so for the same size home the
- 8:15only difference being whether the high
- 8:16school is exemplary or not we have a
- 8:19price difference of over
- 8:23$50,000 so we can think of that as the
- 8:25exemplary High School premium price
- 8:29given the same size home the one where
- 8:32the high school is exemplary Demands a
- 8:35price that is about $50,000 more and I
- 8:38find things like that very interesting
- 8:40so let's go ahead and keep that in the
- 8:41back of our minds as we go
- 8:46forward so here we have a very busy
- 8:48graph here we're looking at the regions
- 8:51on the same basic scatter plot so we
- 8:53have East which are blue dots North
- 8:56which are red squares South which are
- 8:58green diamonds and West which is purple
- 9:01triangles so what general patterns do we
- 9:03see here what looks like the West holes
- 9:06the purple triangles stay along the
- 9:08bottom of the scatter plot the north
- 9:10homes kind of stay along the top of the
- 9:12scatter plot and then you know the other
- 9:15ones the East and the South kind of stay
- 9:19in the middle of the scatter plot so
- 9:21let's help ourselves out by putting some
- 9:23best fit lines on this
- 9:27graph now that's a bit easier to read so
- 9:30we can learn a ton of information just
- 9:32from this scatter plot so let's look at
- 9:34the West homes first so those are the
- 9:37purple triangles as we can see they're
- 9:39along the bottom of the scatter plot
- 9:42they start at around,
- 9:441500t the largest one is about 3500 ft
- 9:48now the price does not increase as
- 9:52steeply as the other regions you can see
- 9:55that the slope of the purple line of the
- 9:57dash line is quite a bit shallower than
- 10:01the slope of the other three lines so in
- 10:04the west region as the homes get larger
- 10:08the price doesn't go up as much as the
- 10:11other regions now let's look at the
- 10:13green the South Region so we have the
- 10:16green diamonds now there the smallest
- 10:18home is about 2,000 sare ft and they go
- 10:21all the way up to almost 4,000 sare ft
- 10:24now look at the slope of that line it is
- 10:28Extreme L steep so as the homes get
- 10:32bigger the price shoots up very rapidly
- 10:35as compared to the other regions so we
- 10:37can sort of see the difference here in
- 10:40the west we have smaller homes that are
- 10:43less expensive the price increases less
- 10:46as the home gets bigger in the opposite
- 10:48extreme we have the south region where
- 10:51the homes start a bit bigger and as they
- 10:53get bigger the price goes up
- 10:55dramatically and then we have the other
- 10:57two the East and the North which kind of
- 11:00hang around in the middle so we can
- 11:02definitely see the relationship between
- 11:04square footage the size of the home and
- 11:06the price as separated out by region so
- 11:10keep that in mind as we go
- 11:14forward so here we're going to look at a
- 11:16surface plot now the purist out there
- 11:19I'm going to note because I know you're
- 11:21going to say something probably that
- 11:22this is not the best use of a surface
- 11:25plot and I know that I'm just using this
- 11:28as a visual tool to show the difference
- 11:31in price in square footage across
- 11:34another variable so here we have a
- 11:36surface plot of price which a square
- 11:37foot in three dimensions and exemplary
- 11:40high school you can see that we have the
- 11:42price and the vertical axis we have the
- 11:44square footage in the z-axis front to
- 11:47back then we have the exemplary High
- 11:49School category running along the x-axis
- 11:52here in the front here's the question is
- 11:56the surface tilted downward where where
- 11:59the exemplary High School equals zero so
- 12:01down here in the lower left corner is
- 12:03this sort of tilted down into the
- 12:06left so if we're looking at this from
- 12:08the front view if we were standing right
- 12:11where it says exempt High School exempt
- 12:14HS down here at the bottom if we stood
- 12:16there and looked at it would it look
- 12:18like this would it start at the bottom
- 12:20and then kind of slope up up towards
- 12:22where we have one well I would say yes
- 12:27so what does that tell us that tells us
- 12:29that as we go from 0 to one from a not
- 12:33exemplary High School to an exemplary
- 12:36High School the price and the square
- 12:39footage both tend to increase so this
- 12:42threedimensional plane is sort of tilted
- 12:45down here at
- 12:460.0 and kind of goes up as we go to the
- 12:49right and somewhat to the back and
- 12:52that's how we can use this 3D plot to
- 12:54visualize our data and again it's not
- 12:56the proper use of a 3D plot but it does
- 12:58help us visualize this in three
- 13:02dimensions so here's a surface plot of
- 13:04price and square foot again but this
- 13:06time location is here in the front axis
- 13:10so what are we looking for here now are
- 13:13there front to back what I would call
- 13:15sort of mountain ranges at any location
- 13:18so do they run front to back like this
- 13:22does any location have higher prices
- 13:26across the surface taking into account
- 13:28the square footage well what do you
- 13:30think about that well I think they all
- 13:34tend to follow the same basic pattern or
- 13:36most of them do we can definitely tell
- 13:38that the east region front to back has
- 13:41that one Spike at around 3,000 square ft
- 13:44the South kind of goes up as it proceeds
- 13:47to the back the west region however
- 13:50really increases in price and square
- 13:53footage as it goes to towards the back
- 13:55and the north maybe a little bit less so
- 13:58so here we can see that the west region
- 13:59it seems like has the biggest change in
- 14:03square footage and price as we increase
- 14:06both of those
- 14:10Dimensions okay so this is probably the
- 14:12most complicated slide in this uh
- 14:14presentation so I want to do it real
- 14:15slow so you understand where everything
- 14:16is coming
- 14:17from so here is our estimated regression
- 14:20equation so we have the expected value
- 14:22of y which is our dependent variable
- 14:25equals beta Sub 0 which is our intercept
- 14:28and then we have our series of
- 14:30independent variables from beta 1 X1 all
- 14:33the way up to Beta 5 X5 now remember
- 14:36these all stand for something so we have
- 14:38our constant which is our intercept and
- 14:40then beta 1 X1 is our coefficient and
- 14:43then X1 is our square footage variable
- 14:46then X2 is our exemplary High School
- 14:48variable and then Southwest and North
- 14:51are our dummy variables we can think of
- 14:53those kind of as a group so here are all
- 14:56of our variables as represented in our
- 14:58estimated regression
- 14:59equation now let's look at an example
- 15:02what's the expected value of the home
- 15:04price given that the high school is not
- 15:08exemplary so in that case X2 is zero if
- 15:14you look up here for exemplary high
- 15:16school at the top that's our X2 variable
- 15:19so if it's not exemplary we know that
- 15:21that value is a zero and the home is in
- 15:25the west so remember for X4 that's our
- 15:29West dummy variable so that would be a
- 15:31one in that spot so we can write this
- 15:33out using some notation so the expected
- 15:36value of y our dependent variable given
- 15:38that's sort of the vertical line pipe
- 15:40there that is not exemplary and it's in
- 15:43the west equals beta 0 plus beta 1 X1
- 15:47plus remember that's our square footage
- 15:49plus beta 2 X2 but in this case X2 is
- 15:54zero because the high school is not
- 15:57exemplary then we have beta 3 0 well why
- 16:01is that that's because the home is not
- 16:03in the south then we have beta 4 * 1
- 16:07well why is that a one that's because
- 16:09our home is in the west if we look up
- 16:11there we have beta 4 X4 where the West
- 16:14is so that's a one then we have beta 5 0
- 16:18that's a zero well why because the home
- 16:20is not in the North so what we can do is
- 16:23actually do some simple algebra here and
- 16:25reduce this down to this so we have beta
- 16:290 + beta 1 X1 + beta 4 now where does
- 16:33that come from well if you look at the
- 16:35one above it anything that's multiplied
- 16:37by zero goes away so beta 2 goes away
- 16:40beta 3 goes away and beta 5 goes away
- 16:43because they're all multiplied by 0 so
- 16:46we're left with beta 0 + beta 1 X1 +
- 16:50beta 4 because beta 4 * 1 is beta 4
- 16:53itself so that is our simplified
- 16:56estimated regression equation for this
- 16:58particular
- 16:59example so what are the total number of
- 17:02possible equations we could actually
- 17:04have in this problem well we're always
- 17:08going to have one constant which is our
- 17:11beta 0 times our 1 s foot variable
- 17:15that's just a simple quantitative
- 17:17variable times two for our exemplary
- 17:19High School variable it can take the
- 17:22value of a one or zero so in that spot
- 17:26we have two possibilities it's either
- 17:28one or zero now for the region we have
- 17:32four possibilities so in this case we
- 17:36could have 1 0 0 which is South we could
- 17:39have 0 1 0 which is West we could have
- 17:41001 which is north or we could have 0000
- 17:450 which is a home in the east region so
- 17:50we multiply all these possibilities for
- 17:52each part of our estimated regression
- 17:54equation we have eight possible
- 17:58equations
- 17:59in this multiple progression model with
- 18:01these two dummy variables so 1 * 1 is 1
- 18:04* 2 for two possibilities for examplar
- 18:07high school times four possibilities for
- 18:10the region which we can see over here on
- 18:12the right 1 * 1 * 2 * 4 is 8 and we'll
- 18:16actually see all eight of these
- 18:18equations here in a minute or two
About this transcript
This page contains the full transcript of YouTube transcript (YwsYKNWSw2o) , generated from the public captions YouTube serves with the video. The transcript has 3,136 words across 424 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.