YouTube2Text

YouTube transcript (fTfMdCQJz4s) — Transcript

3,230 words · 456 segments · language en · Watch on YouTube

Full transcript

  1. 0:00hello and welcome to the next video in
  2. 0:02my series on basic statistics if you are
  3. 0:05a firsttime viewer please stick around
  4. 0:07for the intro it is worth the time if
  5. 0:10you are a regular viewer feel free to
  6. 0:12skip ahead using The annotation so first
  7. 0:15a few things I do these videos because I
  8. 0:17love to learn and help others learn we
  9. 0:19are all good at something so I encourage
  10. 0:22you to give back to the world in a
  11. 0:23similar way share your passion any way
  12. 0:26you can now this video focuses on basic
  13. 0:30stats and is not a quick fix it aims to
  14. 0:33be thorough my goal is an understanding
  15. 0:36of fundamental concepts and that takes
  16. 0:39time but when you understand the
  17. 0:41fundamentals learning other topics is
  18. 0:43much easier now related to that if you
  19. 0:46are watching because you are struggling
  20. 0:48in a class or at work I want you to stay
  21. 0:51positive and keep your head up you can
  22. 0:54learn this I have faith in you many
  23. 0:56other people around you have faith in
  24. 0:58you and so should you
  25. 1:00feel free to connect with me on LinkedIn
  26. 1:03go+ Twitter and of course subscribe here
  27. 1:06on YouTube now if you think there is
  28. 1:08something I can do better please leave a
  29. 1:10constructive comment below I do take
  30. 1:13those comments into account when I make
  31. 1:15new videos I also encourage you to talk
  32. 1:17with other viewers in the comments help
  33. 1:19each other out when you can and finally
  34. 1:22if you like the video please give it a
  35. 1:24thumbs up share it with classmates or
  36. 1:26colleagues and put it on a playlist to
  37. 1:28review later that does encourage me to
  38. 1:31keep making them for you so all that
  39. 1:33being said let's go ahead and start
  40. 1:39learning so here we are in the fourth
  41. 1:42video in our series on multiple
  42. 1:43regression now as I'm sure you know
  43. 1:46there are many different data types
  44. 1:48we're most familiar with interval data
  45. 1:51like the temperature outside or the
  46. 1:53value of money or the mass of something
  47. 1:55on a scale but there are other types
  48. 1:58like categorical variables so male
  49. 2:01female yes no true false north south
  50. 2:04east west London Liverpool Blackpool
  51. 2:06Newcastle you get the idea but luckily
  52. 2:10regression is a very flexible
  53. 2:12statistical technique and we can
  54. 2:14implement or use categorical variables
  55. 2:17in our analysis so this first video is
  56. 2:20all about that using a technique called
  57. 2:23dummy variables to represent categorical
  58. 2:28information so as usual let's go ahead
  59. 2:30and start out with an actual problem now
  60. 2:32I will say that most of the data in this
  61. 2:34problem is actually real I went out and
  62. 2:36got it on the internet now I did change
  63. 2:39some of the numbers for pedagogical
  64. 2:40reasons but other than that this is
  65. 2:42actually real data so here is our
  66. 2:45scenario you are an analyst for a small
  67. 2:48company that develops house pricing
  68. 2:50models for independent Realtors to
  69. 2:53generate your models you use publicly
  70. 2:55available data such as list price the
  71. 2:58square footage of the the home the
  72. 3:00number of bedrooms the home has the
  73. 3:02number of bathrooms
  74. 3:04Etc but you're thinking sort of outside
  75. 3:07of the box here you are interested in
  76. 3:10another question is the public high
  77. 3:12school in the neighborhood exemplary
  78. 3:15that's the highest rating and how is
  79. 3:17that rating related to the home
  80. 3:20price so the high school rating is not
  81. 3:23quantitative it is qualitative it's
  82. 3:26categorical so for each home price the
  83. 3:29high scho is either exemplary or not yes
  84. 3:33or no and those are going to be the two
  85. 3:35categories for one of our
  86. 3:38variables so here is our home price
  87. 3:41data so on the top we have price in
  88. 3:45thousands that's our dependent variable
  89. 3:48then we have square feet that's our
  90. 3:50first independent variable and then we
  91. 3:53have exempt high school that's our
  92. 3:55second independent variable so as we can
  93. 3:58see the first home has a price of
  94. 4:03$145,000 the square footage is
  95. 4:06$1,872 square feet and that home is in a
  96. 4:09school district where the high school is
  97. 4:11not exemplary so if we go down to the
  98. 4:14third one that home is
  99. 4:18$315,000 it is $
  100. 4:204,14 Square ft and it is in a school
  101. 4:24district where the public high school is
  102. 4:26exemplary so you can see how this data
  103. 4:28works we have price that's our dependent
  104. 4:31then we have our two independent
  105. 4:32variables square footage and whether or
  106. 4:35not it's in a school district where the
  107. 4:37high school is
  108. 4:39exemplary so what I went ahead and did
  109. 4:42is coded the exemplary High School
  110. 4:44column so everything is the same but in
  111. 4:47the last column you'll see that if the
  112. 4:49high school is not exemplary then I
  113. 4:53coded that as zero if the high school is
  114. 4:56exemplary I coded that as a one this is
  115. 5:00sort of the first lesson in dummy
  116. 5:02variables so we have two categories here
  117. 5:05I assigned one zero and the other one a
  118. 5:08one that's completely arbitrary I could
  119. 5:11have switched them I could have made not
  120. 5:14exemplary one and exemplary zero it does
  121. 5:18not matter which one it goes in but for
  122. 5:20me it sort of made more sense that
  123. 5:23exemplary would be denoted with a
  124. 5:25one so here why is the home price in
  125. 5:28thousands X1 is the square footage of
  126. 5:31the home and X2 is one if the high
  127. 5:35school is exemplary and zero otherwise
  128. 5:38that's also a common way to write these
  129. 5:41so one if it's exemplary zero otherwise
  130. 5:45because often times I'll show you here
  131. 5:47in a minute there are more than two
  132. 5:48categories so it's best just to put zero
  133. 5:54otherwise so here is a grouped scatter
  134. 5:57plot of our data you can see a definite
  135. 6:00pattern here so the blue dots represent
  136. 6:02homes where the high school is not
  137. 6:04exemplary and the red squares represent
  138. 6:07homes where the high school is exemplary
  139. 6:10so on the bottom of our graph we have
  140. 6:11square footage and on the left hand the
  141. 6:14y- AIS we have the price in thousands so
  142. 6:18most of our homes down here in the lower
  143. 6:20left are homes that are smaller they are
  144. 6:24homes where the high school is not
  145. 6:26exemplary and the price is less
  146. 6:30now the red squares show us that those
  147. 6:33schools are in districts where the high
  148. 6:35school is exemplary they're larger homes
  149. 6:38and therefore they are higher priced so
  150. 6:40we can see a different pattern here so
  151. 6:43you can look at it two ways we can look
  152. 6:44at the two groups individually but if
  153. 6:46you sort of squint your eyes and look at
  154. 6:48the data points as a group we can see
  155. 6:50that there seems to be a definite
  156. 6:52pattern here so we have two patterns
  157. 6:54going on the data points as a whole
  158. 6:57start in the lower left and go up to the
  159. 6:58upper right
  160. 7:00and then we have sort of a separation in
  161. 7:01the Middle where the non-exemplar
  162. 7:04schools are on the lower left and the
  163. 7:06exemplary schools are in the upper right
  164. 7:09so there's kind of an imaginary line
  165. 7:11that runs through the graph here
  166. 7:13separating the blue dots from the red
  167. 7:18ones so what are dummy variables exactly
  168. 7:21now in many situations we must work with
  169. 7:24categorical independent variables so in
  170. 7:27regression analysis we call these dummy
  171. 7:30variables or sometimes they're called
  172. 7:31indicator variables they mean the same
  173. 7:34thing for a variable with a certain
  174. 7:37number in categories there are always
  175. 7:40going to be n minus one dummy variables
  176. 7:44and we'll walk through that here in a
  177. 7:45minute so for example in this case we
  178. 7:48have exemplary high schools and not
  179. 7:51exemplary high schools therefore there
  180. 7:53are two categories so 2 - 1 equals one
  181. 7:58dummy variable and we saw that in our
  182. 8:00original data we had one dummy variable
  183. 8:03that represented the exemplary schools
  184. 8:05and the non-exemplar schools with ones
  185. 8:08and
  186. 8:09zeros now not related to this problem
  187. 8:12necessarily at least yet let's say we
  188. 8:15have four categories north south east
  189. 8:18and west so there there are four
  190. 8:20categories so 4 minus 1 would equal
  191. 8:24three dummy variables and we'll look at
  192. 8:26that here in a second
  193. 8:30now even though it's not related to this
  194. 8:32problem necessarily let's go ahead and
  195. 8:34look at the north south east and west
  196. 8:36example we talked about in the previous
  197. 8:38slide so let's say we have north south
  198. 8:41east and west maybe we're looking at
  199. 8:43housing data or sales data across these
  200. 8:45four regions now how could we code these
  201. 8:48as dummy variables so we have four
  202. 8:51categories we're going to need four
  203. 8:53minus one dummy variables so we could
  204. 8:56code it like this so we have X1 X2 and
  205. 9:00X3 along the top those are our three
  206. 9:02dummy variables now we could represent
  207. 9:05North where X1 is 1 and X2 and X3 are
  208. 9:09zero the South Region would be 0er for
  209. 9:12X1 1 for X2 and 0 for X3 East would be
  210. 9:1700
  211. 9:1801 and here's what confuses some people
  212. 9:21the West the 4th region would be zeros
  213. 9:26all across so West would be coded
  214. 9:29nothing so North would be one for X1
  215. 9:32South would be one for X2 East would be
  216. 9:34one for X3 and for the west region we
  217. 9:37would not put any ones in our regression
  218. 9:40and we'll see how that works as we go
  219. 9:42forward so this is an example of a
  220. 9:44variable with four categories and three
  221. 9:47dummy
  222. 9:50variables so let's back to our problem
  223. 9:52at hand so this is very similar to some
  224. 9:55of the other multiple progression we did
  225. 9:57in previous uh videos so the expected
  226. 10:00value of y the dependent variable equals
  227. 10:02beta 0 that's our intercept plus beta 1
  228. 10:06X1 that's our first coefficient and our
  229. 10:08first independent variable plus beta 2
  230. 10:12and X2 that's our second coefficient and
  231. 10:15our second
  232. 10:18variable now we have two things going on
  233. 10:21here we have one case where the X2 is
  234. 10:25zero where the high school is not
  235. 10:27exemplary and then we have another case
  236. 10:30where the high school is exemplary and
  237. 10:32X2 is a one so let's look at the first
  238. 10:36case first so the expected value of home
  239. 10:39price given the high school is not
  240. 10:42exemplary that's where X2 equals 0 so
  241. 10:46we're going to go ahead and change this
  242. 10:47estimated regression equation up there
  243. 10:49at the top to reflect that so e the
  244. 10:52expected value of y our dependent
  245. 10:56variable given that's the straight line
  246. 10:58given that the high school is not
  247. 11:02exemplary so we rewrite that equation as
  248. 11:04beta 0 + beta 1 X1 plus beta 2 * 0 CU
  249. 11:11remember when X2 is0 that means our high
  250. 11:14school is not exemplary so we can go
  251. 11:16ahead and put that in for X2 now we just
  252. 11:19do some simple
  253. 11:21algebra well beta sub 2 * 0 is 0 so it
  254. 11:25basically disappears and we're left with
  255. 11:28beta Sub 0 plus beta 1
  256. 11:32X1 now what about when the high school
  257. 11:36is exemplary and X2 = 1 same process so
  258. 11:41beta Sub 0 plus beta 1 X1 + beta 2 but
  259. 11:46this time times 1 CU remember that's the
  260. 11:50value when the high school is
  261. 11:52exemplary so again some simple algebra
  262. 11:55beta 0 plus beta 1 X1 plus beta 2 cuz is
  263. 11:59beta 2 * 1 is itself beta 2 now those
  264. 12:03are going to be two constant numbers
  265. 12:05beta Sub 0 and beta 2 are just going to
  266. 12:09be numbers without any variables
  267. 12:12attached so we can actually combine them
  268. 12:15so in parentheses we have beta Sub 0
  269. 12:17plus beta 2 plus beta 1 X1 so we
  270. 12:23actually have two different regression
  271. 12:25equations here in the first case X2 is Z
  272. 12:30in the second case X2 is 1 so we always
  273. 12:34have to realize that there is a
  274. 12:36regression equation for every possible
  275. 12:39scenario in the dummy variable in this
  276. 12:42case it's two we have zero and one as
  277. 12:45far as the values of that dummy
  278. 12:50variable so when we conduct the
  279. 12:52regression in manyi tab this is what we
  280. 12:54get we can see our categorical predictor
  281. 12:57coding of 1 and zero then we have our
  282. 13:00Innova table as usual so we look across
  283. 13:02the regression line there we can see
  284. 13:05that our F value is
  285. 13:0735.94 with a P value of
  286. 13:100. that of course means it's less than
  287. 13:130.1 and is
  288. 13:15significant now we look down here at the
  289. 13:17bottom our model summary we have an R
  290. 13:19squ of
  291. 13:2085.7 an R squ adjusted of 83.3 1 and an
  292. 13:25r s predicted of
  293. 13:2770.3 so so a high R squ and high R squ
  294. 13:31adjusted along with an r s predicted
  295. 13:33that doesn't fall off a cliff remember
  296. 13:36in part three I mentioned that even if
  297. 13:38we have an high R squar and a high R squ
  298. 13:42adjusted and then our r s predicted just
  299. 13:45goes crazy low like off a cliff say you
  300. 13:48know
  301. 13:4950% then we would be concerned our
  302. 13:52regression equation is not doing a good
  303. 13:54job at predicting so everything here
  304. 13:56looks good let's go ahead and look at
  305. 13:58our Co efficients so we have the
  306. 14:01constant term we don't worry about that
  307. 14:02in this case then we have the square
  308. 14:04foot variable that has a P value of
  309. 14:080.10 so that is significant at
  310. 14:1105 and then we have exempt High School
  311. 14:14where the value is one and that is
  312. 14:17significant at
  313. 14:19018 so square foot coefficient is
  314. 14:22significant and the exempt High School
  315. 14:24coefficient is significant now what
  316. 14:28about the values of the coefficients for
  317. 14:30square foot it's
  318. 14:330621 now remember that's in thousands of
  319. 14:36dollars now for exempt high school it's
  320. 14:3998.6 and we'll talk about that here in a
  321. 14:41second so first let's talk about square
  322. 14:44foot and its coefficient so every square
  323. 14:46foot is related to an increase in price
  324. 14:49in the home of 0 621,000
  325. 14:53or when you multiply that out
  326. 14:57$621 per square foot so think about this
  327. 15:00for a minute that's 1 square ft what if
  328. 15:03the house is 10 s ft larger well that
  329. 15:08would be
  330. 15:09$621 what about 100 squ ft larger that
  331. 15:14would be
  332. 15:16$621 but what about a th000 ft larger
  333. 15:21home well that would be
  334. 15:23$62,400 in price so you can see how each
  335. 15:28additional square foot is related to the
  336. 15:31price of the home in this regression
  337. 15:33model so now let's interpret exempt High
  338. 15:36School remember its coefficient is 98.6
  339. 15:39so what does that mean well it means
  340. 15:41that on average a home in an area with
  341. 15:44an exemplary High School is related to a
  342. 15:48$98,500
  343. 15:49higher price so if we have two homes the
  344. 15:54same square footage let's say both homes
  345. 15:57are 1,500 Square ft one is in a district
  346. 16:01where the high school is not exemplary
  347. 16:04one is in a district where the high
  348. 16:05school is exemplary same square foot the
  349. 16:09only difference is the high school
  350. 16:11rating the home in the district with the
  351. 16:14higher rated high school will be $98,700
  352. 16:19higher in
  353. 16:22price so let's go ahead and do the full
  354. 16:24interpretation with the numbers we just
  355. 16:25generated along with our regression
  356. 16:28equation so the equation we got for
  357. 16:30minab is 27.1 + 0621 X1 we talked about
  358. 16:35that last slide plus 98.6 X2 so the only
  359. 16:40thing we didn't talk about really in the
  360. 16:41last slide was The Intercept but that's
  361. 16:43not really relevant for this type of
  362. 16:45model but we still need it of
  363. 16:48course so let's go ahead and just plug
  364. 16:50everything in so the expected value of a
  365. 16:52home price given the high school is not
  366. 16:54exemplary where X2 equals 0 so all we do
  367. 16:57is take the zero and substitute that in
  368. 16:59for X2 so we go ahead and do that so
  369. 17:0298.6 * 0 is 0 so we're left with
  370. 17:0627.1 plus
  371. 17:080621 X1 so it's a very simple algebraic
  372. 17:13linear
  373. 17:14equation now what about when the high
  374. 17:17school is exemplary so there X2 equal 1
  375. 17:21so we go ahead and substitute everything
  376. 17:22back in there so 98.6 * 1 is
  377. 17:2698.6 now we can combine the
  378. 17:2998.6 with the 27.1 so we put that in
  379. 17:32parenthesis and that is
  380. 17:37125.77 21 X1 so here are our two lines
  381. 17:44here are our two linear equations and
  382. 17:46we'll actually look at that on a graph
  383. 17:48here
  384. 17:50next so here are the two regression
  385. 17:52equations that mini tab gives us it's
  386. 17:55saying that when the high school is not
  387. 17:57exemplary that's 0 the price in
  388. 18:00thousands is equal to 27.1 +
  389. 18:030621 ft we just figured that out on the
  390. 18:06last slide when the high school is
  391. 18:09exemplary it's one the price in
  392. 18:11thousands is 125 plus 06 to 1T so you
  393. 18:17notice there that the slope of these
  394. 18:20lines are the same
  395. 18:230621 the only thing that's different are
  396. 18:25the intercepts so let's go ahead and put
  397. 18:28those actually on a
  398. 18:30graph and here it is so we can see that
  399. 18:34the first example where the high school
  400. 18:36is exemplary where it's one that's the
  401. 18:41125.77 21 ft that is sort of the blue
  402. 18:44purple line here on the top when we
  403. 18:47actually graph that on our graph then of
  404. 18:49course the red line is the homes without
  405. 18:53an exemplary high school so you can see
  406. 18:55that these two lines are just algebra 1
  407. 18:58we go ahead and put those on a graph now
  408. 19:01it actually has meaning though there's a
  409. 19:03distance between them and guess what
  410. 19:05that is
  411. 19:0798.6 so the average distance between
  412. 19:10these two lines is the
  413. 19:1498,6 that we talked about a couple of
  414. 19:16slides ago so everywhere along this
  415. 19:19distance the average distance or the
  416. 19:21average price difference is 98.6 or 98,6
  417. 19:26[Music]
  418. 19:31now just for the sake of learning I went
  419. 19:32ahead and conducted another scou plot
  420. 19:34but actually put each groups regression
  421. 19:37line inside of it now as you can see
  422. 19:40this looks somewhat similar to the graph
  423. 19:42we had in the previous slide but
  424. 19:45remember the previous slide is the
  425. 19:47average over everything here each line
  426. 19:51is unique to each group so the general
  427. 19:54pattern is the same and actually the red
  428. 19:57line is actually pretty close to the
  429. 19:58exact same but because the way the homes
  430. 20:01are distributed on here it's not going
  431. 20:03to be exactly the same as we saw in the
  432. 20:04in the last slide cuz it's again
  433. 20:06regression is all about the averages
  434. 20:09over everything but here you can
  435. 20:10definitely see the difference between
  436. 20:12the homes that have an exemplary High
  437. 20:14School in its district and those that
  438. 20:18don't okay so that wraps up our
  439. 20:20introduction to dummy variables now
  440. 20:23we'll be doing more with dummy variables
  441. 20:24in the next video but I just wanted to
  442. 20:26get your feet wet so you understand what
  443. 20:28they are where they come from how we use
  444. 20:31them to code different categories of
  445. 20:34data and then we how we use those
  446. 20:36variables that we code in actual
  447. 20:38regression of course they do get more
  448. 20:40complex but the basic interpretation is
  449. 20:43the same so hopefully you were able to
  450. 20:45develop a good fundamental understanding
  451. 20:47of dummy variables so you can apply that
  452. 20:50to more complex problems so thank you
  453. 20:52very much for watching please subscribe
  454. 20:54if you have not done so already and I
  455. 20:56look forward to seeing you again in the
  456. 20:57next video

About this transcript

This page contains the full transcript of YouTube transcript (fTfMdCQJz4s) , generated from the public captions YouTube serves with the video. The transcript has 3,230 words across 456 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.