Simple Linear Regression in R | R Tutorial 5.1 | MarinStatsLectures

  Рет қаралды 563,722

MarinStatsLectures-R Programming & Statistics

MarinStatsLectures-R Programming & Statistics

10 жыл бұрын

Simple Linear Regression in R: Learn how to fit a simple linear regression model with R, produce summaries and ANOVA table; To learn more about Linear Regression Concept and with R (bit.ly/2z8fXg1); For the free Practice Dataset: (bit.ly/2rOfgEJ)
More Statistics and R Programming Tutorials (goo.gl/4vDQzT)
▶︎▶︎Like to support us? You can Donate statslectures.com/support-us or Share our Videos with all your friends!
How to fit a Linear Regression Model in R, Produce Summaries and ANOVA table for it.
◼︎ What to Expect in this R video Tutorial:
► learn when to use a regression model, and how to use the “lm” function in R to fit a linear regression model for your data
► learn to produce summaries for your regression model using “summary” function in R statistics software; these summaries can include intercept, test statistic, p value, and estimates of the slope for your linear regression model
► become familiar with the Residual Error: a measure of the variation of observations in regression line
► learn to ask R programming software for the attributes of the simple linear regression model using "attributes" function, extract certain attributes from the regression model using the dollar sign ($), add a regression line to a plot in R using "abline" function and change the color or width of the regression line.
► this R tutorial will also show you how to get the simple linear regression model's coefficient using the "coef" function or produce confidence intervals for the regression model using "confint" functions; moreover, you will learn to change the level of confidence using the "level" argument within the "confint" function.
►You will also learn to produce the ANOVA table for the linear regression model using the "anova" function, explore the relationship between ANOVA table and the f-test of the regression summary, and explore the relationship between the residual standard error of the linear regression summary and the square root of the mean squared error or mean squared residual from the ANOVA table.
► ►You can access and download the dataset here: statslectures.com/r-scripts-d...
►► Watch More:
► Intro to Statistics Course: bit.ly/2SQOxDH
►R Tutorials for Data Science bit.ly/1A1Pixc
►Getting Started with R (Series 1): bit.ly/2PkTneg
►Graphs and Descriptive Statistics in R (Series 2): bit.ly/2PkTneg
►Probability distributions in R (Series 3): bit.ly/2AT3wpI
►Bivariate analysis in R (Series 4): bit.ly/2SXvcRi
►Linear Regression in R (Series 5): bit.ly/1iytAtm
►ANOVA Concept and with R bit.ly/2zBwjgL
►Linear Regression Concept and with R bit.ly/2z8fXg1
◼︎ Table of Content:
0:00:07 When to fit a simple linear regression model?
0:01:11 How to fit a linear regression model in R using the "lm" function
0:01:14 How to access the help menu in R for any function
0:01:36 How to let R know which variable is X and which one is Y when fitting a regression model
0:01:45 How to ask for the summary of the simple linear regression model in R including estimates for intercept, test statistic, p-values and estimates of the slope.
0:02:27 Residual standard error (residual error) in R
0:02:53 How to ask for the attributes of the simple linear regression model in R
0:03:06 How to extract certain attributes from the simple linear regression model in R
0:03:40 How to add a regression line to a plot in R
0:03:52 How to change the color or width of the regression line in R
0:04:07 How to get the simple linear regression model's coefficient in R
0:04:11 How to produce confidence intervals for model's coefficients in R
0:04:21 How to change the level of confidence for model's coefficients in R
0:04:38 How to produce the ANOVA table for the linear regression in R
0:04:47 Explore the relationship between ANOVA table and the f-test of the linear regression summary
0:04:55 Explore the relationship between the residual standard error of the linear regression summary and the square root of the mean squared error or mean squared residual from the ANOVA table
This video is a tutorial for programming in R Statistical Software for beginners, using RStudio.
Follow MarinStatsLectures
Subscribe: goo.gl/4vDQzT
website: statslectures.com
Facebook:goo.gl/qYQavS
Twitter:goo.gl/393AQG
Instagram: goo.gl/fdPiDn
Our Team:
Content Creator: Mike Marin (B.Sc., MSc.) Senior Instructor at UBC.
Producer and Creative Manager: Ladan Hamadani (B.Sc., BA., MPH)
These videos are created by #marinstatslectures to support some courses at The University of British Columbia (UBC) (#IntroductoryStatistics and #RVideoTutorials for Health Science Research), although we make all videos available to the everyone everywhere for free.
Thanks for watching! Have fun and remember that statistics is almost as beautiful as a unicorn!

Пікірлер: 168
@marinstatlectures
@marinstatlectures 5 жыл бұрын
in this video tutorial we will learn when and how to fit a linear regression model using R programming software. We will also learn to produce ANOVA table and explore the relationship between ANOVA table and the f-test, the residual standard error and more. For more in-depth explanation of linear regression check our series on linear regression concept and R (bit.ly/2z8fXg1); Like to support us? You can Donate statslectures.com/support-us or Share our Videos with all your friends!
@sotirisparaskevopoulos7730
@sotirisparaskevopoulos7730 5 жыл бұрын
Hello,congrats on the insightful video. Do you have any tutorial regarding multiple NON linear regression analysis? I keep searching for it but nothing! Thanks in advance!
@6331097
@6331097 8 жыл бұрын
And sir we are a bunch of Post grad students and learned the R programming merely watching and following ur tutorials. for that we really are grateful to you.
@marinstatlectures
@marinstatlectures 8 жыл бұрын
That's great to hear +Ubaid Khan ! R is an extremely flexible programming language, and a great skill to have! We plan on continually adding to our video library, so keep your eyes out for more to come...
@charleshenderson4373
@charleshenderson4373 5 жыл бұрын
Hi Mike, I check your KZfaq site regularly and ALWAYS find great information there. I work with college faculty at various institutions (mostly Chiropractic Colleges) to train faculty to be informed consumers of the research literature. Some also go on to become research producers. I also work with them. An essential part of the training I provide is instruction in statistics concepts and guidance on how to use that understanding when reading journal articles. As informed research consumers they must be capable of giving appropriate critical attention to the study design, analysis plan, and results. Of course, those that go on to become research producers have even greater need to understand statistics and study design. Your excellent site provides inspiration and clarification that I use frequently. Thanks for your good work! Chuck
@shubhamlahan
@shubhamlahan 4 жыл бұрын
Mike, you are the BEST. Hands-down!
@NellieNilsen
@NellieNilsen 6 жыл бұрын
This video is pure gold! I have been struggling with lm and you just made it so easy! Thank you very much 😀
@danielzacarias4611
@danielzacarias4611 9 жыл бұрын
I'm on my first steps in R and your videos are quite a great support. Many thanks, from Mozambique!
@reubenchemmanam2502
@reubenchemmanam2502 5 жыл бұрын
this video was thorough and well-paced! Thank you :)
@shamsuzzoha532
@shamsuzzoha532 2 жыл бұрын
You such a good teacher ever I seen. Many many thanks sir
@joerouse9792
@joerouse9792 7 жыл бұрын
Excellent video. Really helped drive these concepts home and showed me specifically what I need to study. I guess I should view all your R videos in order from the beginning. Thank you for the great work!
@PedramRezaei
@PedramRezaei 7 жыл бұрын
Great series Mike and Ladan. Really enjoyed watching all the videos. Looking forward to the next series. -Pedram
@hushamfusion
@hushamfusion Жыл бұрын
Honestly a life saver. Thank you so much :)
@nicoloretis6328
@nicoloretis6328 6 жыл бұрын
Thank you for making easy some difficult stuff!
@marinstatlectures
@marinstatlectures 10 жыл бұрын
Thanks Fahd! Glad you're finding them helpful!
@grassfedgains1216
@grassfedgains1216 4 жыл бұрын
brilliant tutorial mate, you have my statistical equivalent of a thanks!
@filmonafewerki7884
@filmonafewerki7884 3 жыл бұрын
very nice and clear tutorial. Thank you, sir!!!
@bradmorgan60
@bradmorgan60 3 жыл бұрын
Very helpful video! I never learned R in school even though I took courses on Statistics and Econometrics. I used Stata but I wanted to become familiar with R for fun and to learn a new programming language.
@Juan-Hdez
@Juan-Hdez Жыл бұрын
Very useful. Thank you!
@didacartes2019
@didacartes2019 10 жыл бұрын
Michael, Thanks for the video sessions. For someone getting his hands dirty with R for the first time they are very useful. Dídac
@marinstatlectures
@marinstatlectures 10 жыл бұрын
Hi Didac Artes , you're very welcome. happy to hear you are finding them helpful! thanks for watching!
@Shahada2012
@Shahada2012 7 жыл бұрын
Martin, you are great ... Thank you
@flamboyantperson5936
@flamboyantperson5936 5 жыл бұрын
You have explained in the proper statistical way. Thank you so much. Plz keep the good work going.
@marinstatlectures
@marinstatlectures 5 жыл бұрын
thanks, we plan to keep making videos for a long time :)
@jesusdavidcastano678
@jesusdavidcastano678 7 жыл бұрын
Very useful video, thanks!
@kayzielmartinez6177
@kayzielmartinez6177 4 жыл бұрын
very helpful, thank you so much :)
@rezaliswara4086
@rezaliswara4086 4 жыл бұрын
Very helpfull, thank youu :D
@AtulKakrana
@AtulKakrana 6 жыл бұрын
Two thumbs up!!
@shashanktelugu3851
@shashanktelugu3851 4 жыл бұрын
Thanks Buddy for the video. Need more practical examples videos
@ArunSingh23
@ArunSingh23 2 жыл бұрын
Thanks for the help
@hubwells-testingwonders9274
@hubwells-testingwonders9274 5 жыл бұрын
Good one and really apprecaiting
@nothingsintheflowerz1740
@nothingsintheflowerz1740 8 жыл бұрын
thank you so much; i had been struggling to correct my commands for hours !
@marinstatlectures
@marinstatlectures 8 жыл бұрын
you're welcome +nothingsintheflowerz !
@adnanmajeed4825
@adnanmajeed4825 2 жыл бұрын
great work
@hallow6994
@hallow6994 2 жыл бұрын
How and is it possible to get a linear trend precision indicators from the accuracy command where I can get rmse,mape exct...
@majidosman286
@majidosman286 4 жыл бұрын
Thank you Mike for sharing your knowledge with us. I have really learnt a lot from your videos. I am now making nice plots with R. Many thanks:).
@marinstatlectures
@marinstatlectures 4 жыл бұрын
you're welcome! we are planning on creating a series of videos teaching how to use ggplot2, so even more beautiful plots are on the way ;)
@SexyMicelio
@SexyMicelio 9 жыл бұрын
Thanks a lot for the videos, we learned a lot, thanks! :)
@marinstatlectures
@marinstatlectures 9 жыл бұрын
you're welcome Maia Lia , glad you found then helpful!
@faridsanchez
@faridsanchez 10 жыл бұрын
thanks for the video, I'm new to R and this vid was a huge help
@marinstatlectures
@marinstatlectures 10 жыл бұрын
Thanks, glad you found it useful!
@KnightPapa
@KnightPapa 5 жыл бұрын
Very concise and helpful, thanks!
@marinstatlectures
@marinstatlectures 5 жыл бұрын
you are welcome! glad to hear you found the video helpful
@ElNick09
@ElNick09 5 жыл бұрын
Very nice and succinct explanation, thanks!
@marinstatlectures
@marinstatlectures 5 жыл бұрын
You’re welcome
@abolemar
@abolemar 10 жыл бұрын
very helpful and professional work. Thank you Sir
@kalyantummanapalli3800
@kalyantummanapalli3800 7 жыл бұрын
Hi Michael, Thanks alot for your videos and that could be more helped me to enhance my skill set. And also I'm interested to learn other statistical modeling techniques like logistic regression , Factore analysis, Cluster analysis,etc. Requesting you to share some videos to get the knowledge out of it. Thanks in Advance
@dwucentreforlearningandtea249
@dwucentreforlearningandtea249 5 жыл бұрын
Thank you, for the great tutorial.
@marinstatlectures
@marinstatlectures 5 жыл бұрын
you are very welcome!
@labotzabob1499
@labotzabob1499 7 жыл бұрын
Do you have a youtube tutorial on how to show whether, once a model has been evaluated by predicting a certain variable of a data set, how do you then show whether the predictors are close to the observed values of that specific variable?
@mrsilvito8789
@mrsilvito8789 2 жыл бұрын
Thank you! You saved my scatterplots
@markherbertcabuang6283
@markherbertcabuang6283 3 жыл бұрын
My 2 sesh module is discuss in 5mins. Thanks!
@ranimaharaj-sharma4332
@ranimaharaj-sharma4332 5 жыл бұрын
Loved this short simple to the point video. I could not understand what I was taught in class.. This video just took 5 minutes and showed me what to do..Thanks for being so clear and concise. and to the point...
@marinstatlectures
@marinstatlectures 5 жыл бұрын
great to hear! check out our other videos...we have a ton that i use for my intro/intermediate stats courses, so should cover most of the content covered in your course...
@alexdesouza8351
@alexdesouza8351 8 жыл бұрын
Thanks for all videos, I am introduced to R successfully with your shares
@marinstatlectures
@marinstatlectures 8 жыл бұрын
you're welcome +alex de souza , glad you've found our videos helpful!
@ahmadmassinasery4029
@ahmadmassinasery4029 7 жыл бұрын
Thank you Sir, I am Masters student, i was thinking how i can analyze my data in R . it is very helpful. Thanks again.
@huangqiuhao2780
@huangqiuhao2780 6 жыл бұрын
Very useful, even in 2017
@tatianacocerva8239
@tatianacocerva8239 4 жыл бұрын
Hi, How can I add regression line equation and R^2 on the graph? Thanks.
@jmca_power
@jmca_power 6 жыл бұрын
your content is very helpful, thank you
@marinstatlectures
@marinstatlectures 6 жыл бұрын
thanks, we appreciate that. and you're welcome :)
@abbas8646
@abbas8646 10 жыл бұрын
thanks very much, simple and informative
@marinstatlectures
@marinstatlectures 10 жыл бұрын
Thanks, and thanks for watching abbas8646 !
@vasuchouhan2987
@vasuchouhan2987 4 жыл бұрын
thank you so much...keep doing this stuff
@marinstatlectures
@marinstatlectures 4 жыл бұрын
you're welcome. we plan to keep on making these, and have a long list of topics, just need to find the time to create them :)
@22vasu22
@22vasu22 4 жыл бұрын
@@marinstatlectures If you have some database to manipulate , let me know. I will do it for free as it enhance my skills
@kiennguyentrung6011
@kiennguyentrung6011 3 жыл бұрын
hi, thank for your sharing, I'm having problem with "variable lengths differ", can you have me with fixing this thing?
@edonovanto
@edonovanto 4 жыл бұрын
thanks
@thupham4649
@thupham4649 2 жыл бұрын
The video sound is pretty good, beyond my imagination
@johnrojas7380
@johnrojas7380 4 жыл бұрын
I got the scatter plot but I can’t get the regression line. I keep getting error, object ‘price’ not found. Any suggestions? Thanks
@maryamsalehi1940
@maryamsalehi1940 6 жыл бұрын
Thank you so much for your video I have one question: how can I write a linear regression equation in R studio? Thank you
@RobFS1
@RobFS1 5 жыл бұрын
Thank you for providing explanations that my stats professor apparently didn't think were very important.
@marinstatlectures
@marinstatlectures 5 жыл бұрын
we have videos that cover most topics for intro (and intermediate) stats, so check out the rest of our library. i use them for the uni stats courses that i teach, so covers most relevant content
@djanmhood
@djanmhood 7 жыл бұрын
Hi, first of all thank you for your videos, they are really meaningfull and well explained. Can you please tell me when you type summary(mod), how to interpret the results statistically ? I mean, if they are statistically significant or not, what are the NULL hypothesis behind, if we reject it or not, and what is our conclusion ? Thanks
@tekilemariambekele8146
@tekilemariambekele8146 4 жыл бұрын
nice
@ahmed007Jaber
@ahmed007Jaber 2 жыл бұрын
hi Mike thank you for this. I am trying to do it but I am getting an error. all varaiables are made as factors. the predicted value is boolean 0 and 1 # Fitting Simple Linear Regression to the Training Set regressor = lm(formula = Recommendation ~ Style, data = training_set) mod mod
@ayodejiologun5394
@ayodejiologun5394 5 жыл бұрын
HI, great tutorial. I want to do a linear regression in the iris data in R with the lm() function and i want to construct three models for the three iris species. How do I go about this
@guitarman4513
@guitarman4513 4 жыл бұрын
You are a legend
@marinstatlectures
@marinstatlectures 4 жыл бұрын
thanks :)
@diallo9149
@diallo9149 5 жыл бұрын
that baby voice at the and crank me up :))) by the way great content !!!
@marinstatlectures
@marinstatlectures 5 жыл бұрын
thanks, that is our son contributing to development of our videos ;) we have him at the end of most of our newer videos. and thanks for your appreciation of our content....we're adding new videos just about every week, so keep watching for more to come!
@MrFelo17
@MrFelo17 9 жыл бұрын
Hi Marin. I tried to run a linear regression in R Studio but the following message appears: Error in eval(expr, envir, enclos) : object 'inconsistencia' not found. What does this mean? How can I solve this problem? Thank you.
@tenzinnamdhak
@tenzinnamdhak 7 жыл бұрын
I got this four plots at the same time in the plot section after learning the Multiple regression. But then now i am confused to bring it to normal size? What can I do with that?
@rajeshrajbhandari
@rajeshrajbhandari 7 жыл бұрын
HI, Thank you for the very useful videos. how can I get all R -script of all the videos?
@basmaal-ghali9174
@basmaal-ghali9174 4 жыл бұрын
u good
@nguyenhuy-zz4nz
@nguyenhuy-zz4nz 5 жыл бұрын
Sir, do we have a connection between ANOVA and Linear Regression? Is ANOVE equivalent to Linear Regression, please?
@123fyn
@123fyn 4 жыл бұрын
Hi i am new to this software but in great need for analysis. Kindly help me
@mehwishmehmood9219
@mehwishmehmood9219 7 жыл бұрын
your videos are so much helpful. can u please help me in finding that how to find p value for 5 variables?
@Hubbath
@Hubbath 3 жыл бұрын
I keep getting this error "Error: object 'Height' not found" Help?
@THERAAMBODX
@THERAAMBODX 3 жыл бұрын
My Y axis don’t show as numeric does that matter?
@Lew291
@Lew291 10 жыл бұрын
how do you exclude points from the model? like if you want the y variables to only plot above 1
@marinstatlectures
@marinstatlectures 10 жыл бұрын
Hi Lew291 , you can use square brackets to subset data, and select only certain values. For example if you wanted to plot the data only for those with y-values >1, you can use the following: *plot(x[y>1], y[y>1])*. This will take x, and extract only the x-values that have a corresponding y-value that is greater than 1, and it will plot this against only the y-values that are greater than 1. You could fit a regression model to only the data where y-values are greater than 1 using the same idea: *model 1] ~ x[y>1])*. You can check out this video of ours (Subsetting Data in R With Square Brackets and Logic Statements (R Tutorial 1.6)) to learn more about how to use the square brackets to take subsets of your data, based on values of certain variables.
@raj9101990
@raj9101990 7 жыл бұрын
Sir, Your videos are very nice. I am highly grateful to you. I have followed your video but when i run the abline command. The line didn't match from your line of best fit lungcap
@tanushreedutta9474
@tanushreedutta9474 9 жыл бұрын
Your videos on R are really good.I want to know if you have videos for learning STATA or could recommend some good sites for that.
@marinstatlectures
@marinstatlectures 9 жыл бұрын
Hi Tanushree Dutta , wer haven't created any videos for STATA, but a good resource to check out is the UCLA website here: www.ats.ucla.edu/stat/stata/
@missnitties
@missnitties 4 жыл бұрын
Why when I typed plot(Age, LungCap, main="Scatterplot") they said that object 'Age' not found?
@marinstatlectures
@marinstatlectures 4 жыл бұрын
You either need to use *plot(LungCapData$Age, LungCapData$LungCap)* , or you need to *attach(LungCapData)* and then your code should work
@jenniferprine1457
@jenniferprine1457 3 жыл бұрын
When I type in Summary() it put out the following error message: Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘Summary’ for signature ‘"lm"’ I've looked up everything I can on it and I cannot figure out what is going wrong. I followed the steps in the video (but with my own data). Any help is greatly appreciated.
@marinstatlectures
@marinstatlectures 3 жыл бұрын
Hi, it should be a lower case s in summary... summary() not Summary(). That should solve the issue
@3foss191
@3foss191 8 жыл бұрын
I would like to asl please how to manage dataframe, particularly dataframe with vector of different lengths. Thks
@hernanmurillo4432
@hernanmurillo4432 3 жыл бұрын
It’s possible to save the mean in a variable?, if it’s possible do you know how?
@marinstatlectures
@marinstatlectures 3 жыл бұрын
Yes, saved.mean
@rraattutll
@rraattutll 9 жыл бұрын
thank you very much for such videos...I would like to know whether you have any video for factor analysis??Whenever I am trying to run "factanal", it returns "covmat is of unknown type"..what can be the cause for this?
@marinstatlectures
@marinstatlectures 9 жыл бұрын
Ratul Sur we haven't created any videos for factor analysis. it's always hard to figure out error messages from a distance, but the error is mentioning that it has to do with the covariance matrix, so i would start by examining that. good luck.
@6331097
@6331097 8 жыл бұрын
hi sir... found your videos tons of helpful, specially on finding correlation.. please provide us some tutorial with a bit more illustration about correlation matrix.
@marinstatlectures
@marinstatlectures 8 жыл бұрын
Thanks +Ubaid Khan . We have an entire short-video dedicated to correlation, you can check that out here: kzfaq.info/get/bejne/jsd-ftalnbWodYU.html
@bharathjc4700
@bharathjc4700 7 жыл бұрын
Thank a ton for your Valuable inputs. Can u please share thecode
@wenpengdi5807
@wenpengdi5807 4 жыл бұрын
Hi, anyone can tell me what is the conclusion of the F-test, if the p-value almost equal to 0.
@thomasverbeek7115
@thomasverbeek7115 4 жыл бұрын
that means that the chance of that event happening (or more extreme) is almost equal to 0.
@ricardojunior3362
@ricardojunior3362 7 жыл бұрын
Do you have a tutorial for quantile regression and nonparametric quantile regression? If not, can you make plis?
@sohamchintawar4015
@sohamchintawar4015 3 жыл бұрын
I am getting this error. Can you help on this. Error in eval(predvars, data, env) : object 'LungCap' not found.
@marinstatlectures
@marinstatlectures 3 жыл бұрын
It’s difficult to know without seeing the code you’ve entered, but the message is saying that there isn’t any object called “LungCap”. You can’t call on a variable unless you’ve “attached” the data, or by using LungCapData$LungCap
@anastasia.2007.
@anastasia.2007. 8 жыл бұрын
Hi again Mike, Thanks for your previous answer! I have another question regarding the whole tutorial and some symbols, used in R. In particular, we should write the command this way: lm(LungCap ~ Age). So the tilde is used, to describe an “interaction” (in form of a linear regression in this case) between the LungCap variable and the Age variable. But, in other instances, within other commands of “interaction”, such as cor(Age, LungCap), we should use the comma. Furthermore, for commands, such as plot(LungCap ~ Age) and plot(Age, LungCap), there is no obvious difference, so both symbols can be used (the only detail here is that in the command plot(LungCap ~ Age) Age, although written second, will be X, and LungCap, although written first, will be Y, as you also explained in the video above). So what is the logic behind using the tilde only for some commands (destined to describe some “interaction” between 2 numeric variables), and using the comma only for other commands of this nature? Is there a way to understand this logic, or do we need to memorise the correct way each command should be written? (Same question seems to be true for categorical variables, but I am not totally sure at this point...) Thanks a lot again!
@marinstatlectures
@marinstatlectures 8 жыл бұрын
Hi +Anastasia Levchenko , sorry for the delay with this. KZfaq did not give me a notification of this comment..i just stumbled on it by chance! it can be lengthy to try and explain all of the technicalities in the differnces between the two, but here's something short that gets at the difference, for the most part. you can think of the "~" as being "by" and the "," as an "and". so, a command that goes something like boxplot(y~x) will make box plots of Y, separated for categories of X. while a command that uses boxplot(x1, x2) will make side by side box plots of x1 and of x2. also, just worth mentioning to be 'careful' with the use of the word 'interaction' as it actually has a very specific meaning in statistics. when you are saying that a regression of X on Y looks as "the interaction between X and Y", it does not. it is looking at the 'association' between X and Y. just wanted to point that out because the term interaction does have a different meaning. hope this was helpful!
@anastasia.2007.
@anastasia.2007. 8 жыл бұрын
+MarinStatsLectures Thank you very much for the explanation regarding the symbols! I understand that using the word "interaction" above is not at all accurate from the point of view of statistics. I just tried to simplify my question and for that reason I used quotation marks. I guess I should have used the term "relationship" (between 2 variables) instead...
@marinstatlectures
@marinstatlectures 8 жыл бұрын
yeah, i get that Anastasia Levchenko and it did make your question clear, i just thought it was worth mentioning, as i wanted to make sure my answer was complete and accurate.
@mallikathanky553
@mallikathanky553 8 жыл бұрын
Why is the intercept coefficient from the summary 1.14 yet the regression line hits the y axis above 2 in the chart? Thanks!
@marinstatlectures
@marinstatlectures 8 жыл бұрын
Hi +Mallika Thanky , it is because the intercept is where the regression line crosses the y-axis *at x=0* . where you see the line hitting a bit above 2 is actually at a value for x larger than 0...it looks like it is around x=1.5 or so. if you want to see this more clearly, in the plotting command set the x-limits using *xlim=c(-1,20)* (to make the x-axis run from -1 to 20 include the value of 0), and then add a vertical line at x=0 using *abline(v=0)* (this is a separate command from the plotting command). you'll then see more clearly that the regression line passes through this (x=0) at about y=1.14
@makenzeelabutte9974
@makenzeelabutte9974 4 жыл бұрын
hello can you please help, what error in the summary(mod) represents the average error in prediction?
@marinstatlectures
@marinstatlectures 4 жыл бұрын
the *residual standard error* is the SD of the residuals, or what you can think of as the "average error". worth noting that mathematically, this is the square root of the squared error...but fine to think of it as the "average error"
@makenzeelabutte9974
@makenzeelabutte9974 4 жыл бұрын
@@marinstatlectures thanks a lot
@aronkovacs1386
@aronkovacs1386 5 жыл бұрын
How would you produce the equation for the regression line?
@marinstatlectures
@marinstatlectures 5 жыл бұрын
from the R output the column with "Estimate" are the model coefficients/parameters, and the first row is the (intercept) = (b0), for the model and the rows below are the coefficients (b1) (the slope when X is numeric) for the model. so the model is y = b0 + b1*X
@ChristopherNips81
@ChristopherNips81 4 жыл бұрын
I am trying this step by step with my own imported data and when using my fields (Score and GIR) it says, 'Score' not found. I see in another comment you suggested CapData and another variation, neither of which worked. Ideas?
@marinstatlectures
@marinstatlectures 4 жыл бұрын
You would either need to attach the data first using *attach(data.name)* or use the $ to extract the variables, eg *mean(data.name$variable.name)*
@jonathanhagglund9682
@jonathanhagglund9682 4 жыл бұрын
use: LungCapData$Age instead of just Age, worked for me
@hawkf2937
@hawkf2937 3 ай бұрын
Hi can you explain splithalfr package please
@SAM46323
@SAM46323 2 жыл бұрын
how i put the data and where .
@montgomeryfrenwheringwerth5584
@montgomeryfrenwheringwerth5584 2 жыл бұрын
Generally, you want to put the data in a folder you choose (usually in csv form , csv comma separated values). You then set your working directory in Rstudio to the folder the data is in. Then you use a "read csv" line of code, which reads the data and stores it in your Rstudio variable list. carSpeeds
@emilylarson795
@emilylarson795 4 жыл бұрын
I try doing this step by step but just keep getting error messages. :( like when I try to attach the data I just get an error saying “global environment is blocked by” and it states the header of one of my variables. Ugh :(
@marinstatlectures
@marinstatlectures 4 жыл бұрын
If you can include some of the code you’re using I may be able to help. It sounds like you may have the dataset having the same name as one of the variables? This would cause an error
@liamgleeson8673
@liamgleeson8673 10 жыл бұрын
Hello from Australia. Do you have a video on Logistic regression? Thanks for your series - its been very helpful Lyn
@marinstatlectures
@marinstatlectures 10 жыл бұрын
Thanks liam gleeson , we haven't had a chance to prepare that one yet...its on the list of upcoming videos, but not quite there yet. in the meantime, here's a quick overview of it. you can use *glm(Y ~ X1 + X2, family=binomial)* to fit a logistic regression, with a default of the logit link function.
@liamgleeson8673
@liamgleeson8673 10 жыл бұрын
Thanks so much for taking the time to write back. And thanks again for your amazing contribution to all those international students struggling to study online :-)
@marinstatlectures
@marinstatlectures 10 жыл бұрын
no problem at all, and thanks for saying that, we both really appreciate hearing this!
@JPdevil74
@JPdevil74 7 жыл бұрын
I have the data in r but when I try to plot it i get this error. do you know what I am doing wrong? > str(rdata) Classes ‘data.table’ and 'data.frame': 85 obs. of 10 variables: $ pvdate : Factor w/ 85 levels "Dec-11","Dec-12",..: 1 2 3 4 5 6 7 8 9 10 ... $ pvmonth : int 12 12 12 12 12 12 12 12 12 12 ... $ pvyear : int 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 ... $ pvrain : num 4.28 5.06 14.35 7.05 11.18 ... $ pvannual: num 38.6 45.3 43.4 51.9 60.1 ... $ ukyear : int 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 ... $ ukmonth : int 12 12 12 12 12 12 12 12 12 12 ... $ ukdate : Factor w/ 85 levels "Dec-11","Dec-12",..: 1 2 3 4 5 6 7 8 9 10 ... $ ukrain : num 3.75 5.45 13.63 7.43 8.15 ... $ ukannual: num 34.7 36.2 38.3 43.4 50.7 ... - attr(*, ".internal.selfref")= > plot(ukannual,pvannual) Error in plot(ukannual, pvannual) : object 'ukannual' not found
@samdavepollard
@samdavepollard 7 жыл бұрын
I think you need to make it explicit that you're using the rdata object. plot(rdata$ukannual,rdata$pvannual)
@swamybanoth3525
@swamybanoth3525 8 жыл бұрын
I am new to R and these videos are very useful to me ,thanx a lot. can we get the continuation of this course ? after tutorial 5.10 .
@marinstatlectures
@marinstatlectures 8 жыл бұрын
hi +swamy banoth , thanks. we make the videos available as we create them. currently, 5.10 is as far as we've developed. but as we develop more, we will make them available for free as well.
@swamybanoth3525
@swamybanoth3525 8 жыл бұрын
thanxx you MarinStatsLectures your doing really great job
@user-bz9nt8gh3x
@user-bz9nt8gh3x 5 жыл бұрын
I want to know how to select first 7 data (rows) to draw the graph. For example, you have 10 rows. But you only use 7 rows to draw the age vs height.
@marinstatlectures
@marinstatlectures 5 жыл бұрын
Hi, the most direct way is to use *plot(x[1:7], y[1:7])* . We have a separate video explaining “use of square brackets to subset data”, which you can check out if you want to learn more about how to them.
@mugrespan
@mugrespan 7 жыл бұрын
i typed the comand abline(mod) and nothing happened. any suggestions to the line appears ? thanks
@marinstatlectures
@marinstatlectures 7 жыл бұрын
Hi +mugrespan , it's hard to know what the issue is without knowing the commands you've entered. did you fit a model and save it in an object called *mod*? what was the model you fit? i really have no idea of what the issue might be without knowing what you have done....if you can let me know the commands you've entered, etc, i may be able to help...
@quratulainahmad7041
@quratulainahmad7041 7 жыл бұрын
Hi Marin, I am new to learn R and I really liked your video tutorial on Correlation coefficients and covariance calculation. for my work, I ma also interested to calculate Nash Sutcliff efficiency of two discharge flows data in R. Whether it is possible to calculate in R, Can you please provide some of your esteemed tutorial on required analysis. regards
@jaimeblair7200
@jaimeblair7200 4 жыл бұрын
saved my life
@marinstatlectures
@marinstatlectures 4 жыл бұрын
i'll add that to my resume :) good to hear!
@benm2156
@benm2156 4 жыл бұрын
so do we just not care about the intercept values in the summary or do we need them for something else
@polarizedsquirrel3867
@polarizedsquirrel3867 4 жыл бұрын
Intercept values are only used in interpreting the model when you don't take into consideration your dependent variables. In this case you'd have a low lung capacity (1.1) at Age 0
@raoufzanati7532
@raoufzanati7532 3 жыл бұрын
man ur videos are amazing, why you stopped aploading
@marinstatlectures
@marinstatlectures 3 жыл бұрын
Thanks! We haven’t completely stopped. But having a new baby and the pandemic has really slowed things down. But I’m working on getting a course online for a course I teach that will be all online this year, and will be adding those as soon as they’re ready. It’s a course covering regression modeling for health research...linear, logistic, poisson aka log-linear regression, and some survival analysis. Should be ready in a few months
@raoufzanati7532
@raoufzanati7532 3 жыл бұрын
@@marinstatlectures thank you very much Sir, and I hope the best for you and your family
@agape13
@agape13 3 жыл бұрын
@@marinstatlectures 💖🙏
@yanishappadoo9067
@yanishappadoo9067 4 жыл бұрын
> abline(mod,col=2,lwd=3) Warning message: In abline(mod, col = 2, lwd = 3) : only using the first two of 6 regression coefficients
Checking Linear Regression Assumptions in R | R Tutorial 5.2 | MarinStatsLectures
7:49
MarinStatsLectures-R Programming & Statistics
Рет қаралды 331 М.
Linear regression using R programming
20:01
R Programming 101
Рет қаралды 99 М.
Doing This Instead Of Studying.. 😳
00:12
Jojo Sim
Рет қаралды 21 МЛН
Inside Out Babies (Inside Out Animation)
00:21
FASH
Рет қаралды 23 МЛН
Это реально работает?!
00:33
БРУНО
Рет қаралды 2,4 МЛН
Simple Linear Regression Concept | Statistics Tutorial #32 | MarinStatsLectures
18:33
MarinStatsLectures-R Programming & Statistics
Рет қаралды 55 М.
Learn Statistical Regression in 40 mins! My best video ever. Legit.
40:25
Logistic Regression in R, Clearly Explained!!!!
17:15
StatQuest with Josh Starmer
Рет қаралды 512 М.
Interpreting R Output For Simple Linear Regression Part 1
13:00
Jonathan Brown
Рет қаралды 89 М.
Adding variables to your multiple regression model
28:40
R Programming 101
Рет қаралды 4,1 М.
Simple Linear Regression Using R Studio(Regression)(Bivariate regression)(one independent variable)
15:45
8.3 Effect Modification: Stratifying vs Modelling With Interaction Term
9:40
MarinStatsLectures-R Programming & Statistics
Рет қаралды 9 М.
Video 1: Introduction to Simple Linear Regression
13:29
dataminingincae
Рет қаралды 1,6 МЛН
How to interpret (and assess!) a GLM in R
17:36
Chloe Fouilloux
Рет қаралды 27 М.
Doing This Instead Of Studying.. 😳
00:12
Jojo Sim
Рет қаралды 21 МЛН