

{"id":4925,"date":"2018-01-17T12:04:47","date_gmt":"2018-01-17T12:04:47","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=4925"},"modified":"2021-08-25T17:25:41","modified_gmt":"2021-08-25T11:55:41","slug":"generalized-linear-models-in-r","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/","title":{"rendered":"How to Create Generalized Linear Models in R &#8211; The Expert&#8217;s Way!"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:1467,&quot;href&quot;:&quot;https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/R_(programming_language)&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251001042859\\\/https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/R_(programming_language)&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 08:17:04&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-12 12:22:33&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-15 12:29:21&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-18 15:20:53&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-21 18:00:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-25 04:08:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-28 06:54:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-31 09:47:17&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-03 17:14:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-06 19:17:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-09 21:09:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-13 04:31:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-16 15:06:53&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-19 19:03:58&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-23 05:30:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-26 10:18:28&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-29 11:45:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-01 12:00:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-04 12:09:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-07 15:09:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-10 18:01:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-13 23:45:59&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-17 05:29:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-20 07:23:59&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-23 10:05:24&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-26 14:54:33&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-01 16:00:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-04 19:56:49&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-08 03:19:57&quot;,&quot;http_code&quot;:429},{&quot;date&quot;:&quot;2026-03-11 07:47:37&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-14 13:54:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-17 17:24:09&quot;,&quot;http_code&quot;:429},{&quot;date&quot;:&quot;2026-03-20 23:04:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-24 00:07:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-27 00:15:51&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-30 08:20:38&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-03 14:48:26&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-06 19:55:35&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-10 05:52:27&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-13 07:47:26&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-16 08:05:10&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-19 13:04:23&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-22 13:52:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-25 13:58:03&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-29 01:16:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-02 04:13:02&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-05 06:33:38&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-08 17:48:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-12 03:38:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-15 04:53:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-18 09:15:30&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-21 12:35:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-25 03:51:04&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-28 07:13:15&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-01 04:45:49&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-04 06:40:14&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-07 06:45:43&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-10 09:02:48&quot;,&quot;http_code&quot;:404}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-10 09:02:48&quot;,&quot;http_code&quot;:404},&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p>Earlier we have discussed <em><strong><a href=\"https:\/\/data-flair.training\/blogs\/r-graphical-models-tutorial\/\">Graphical Models<\/a><\/strong><\/em>. Today, DataFlair has come up with a new and very important topic that is R Generalized Linear Models. We will see what exactly R Generalized linear models are and how can you create them. Also, we will discuss Logistic and Poisson Regression in detail. So, let&#8217;s start the tutorial &#8211;<\/p>\n<h2>What are the Generalized Linear Models in R?<\/h2>\n<p>Generalized Linear Models in R are an extension of linear regression models allow dependent variables to be far from normal. A general linear model makes three assumptions &#8211;<\/p>\n<ul>\n<li>Residuals are independent of each other.<\/li>\n<li>Residuals are distributed normally.<\/li>\n<li>Model parameters and y share a linear relationship.<\/li>\n<\/ul>\n<p>A Generalzed Linear Model extends on the last two assumptions. It generalizes the possible distributions that the residuals share to a family of distributions known as the exponential family.<\/p>\n<p><b>For Example &#8211; Normal, Poisson, Binomial<\/b><\/p>\n<p>In R, we can use the function glm() to work with generalized linear models in R. Thus, the usage of glm() is like that of the function lm() which we before used for much linear regression. We use an extra argument family. That is to describe the error distribution. And link function to <span class=\"passivevoice\">be used<\/span> in the model to show the main difference.<\/p>\n<p><span style=\"font-weight: 400\">GLM are fit using the glm( ) function. The form of the glm function is &#8211;<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">glm(formula, family=familytype(link=linkfunction), data=)<\/pre>\n<h3>a. Logistic Regression<\/h3>\n<p><span style=\"font-weight: 400\">We implement the<em><strong><a href=\"https:\/\/data-flair.training\/blogs\/logistic-regression-in-r\/\"> Logistic Regression<\/a> <\/strong><\/em>method for fitting the regression curve y = f(x). Here, y is a categorical variable.\u00a0\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">It is a classification algorithm. This model gives out an outcome which is binary in nature. We also use dummy variables to indicate the absence or presence of an effect on the overall result of the model.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">The response variable, also known as the <strong>dependent variable<\/strong> is categorical in nature. It measures the outcome of the binary response variable. Thus, it actually measures the probability of a binary response.<\/span><\/p>\n<p>We use the following R glm() function for modeling our logistic regression method.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt; glm( response ~ explanantory_variables , family=binomial)<\/pre>\n<h3>b. Poisson Regression<\/h3>\n<p><span style=\"font-weight: 400\">Data is often collected in counts. Hence, many discrete response variables have counted as possible outcomes. While binomial counts are the number of successes in a fixed number of trials, n.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Poisson counts are the number of occurrences of some event in a certain interval of time (or space). Apart from this, Poisson counts have no upper bound and binomial counts only take values between 0 and n.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">To perform logistic regression in <a href=\"https:\/\/en.wikipedia.org\/wiki\/R_(programming_language)\">R<\/a>, we use the command:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\">&gt; glm( response ~ explanantory_variables , family=poisson)<\/pre>\n<p><b><i>Don&#8217;t forget to check our leading blog on <a href=\"https:\/\/data-flair.training\/blogs\/graphical-models-applications\/\">Graphical Models Applications<\/a><\/i><\/b><\/p>\n<h2>How to Create a Generalized Linear Model in R<\/h2>\n<p>In order to create our first linear model, we will make apply linear regression over the \u2018car\u2019 dataset.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#Author DataFlair\r\ndata(cars)\r\nhead(cars)\r\nscatter.smooth(x=cars$speed, \r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0y=cars$dist, \r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0main=\"Dist ~ Speed\")<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/How-to-create-linear-model-in-R.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-65484\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/How-to-create-linear-model-in-R.jpg\" alt=\"How to create linear model in R\" width=\"1298\" height=\"744\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/How-to-create-linear-model-in-R.jpg 1298w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/How-to-create-linear-model-in-R-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/How-to-create-linear-model-in-R-300x172.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/How-to-create-linear-model-in-R-768x440.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/How-to-create-linear-model-in-R-1024x587.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/How-to-create-linear-model-in-R-520x298.jpg 520w\" sizes=\"auto, (max-width: 1298px) 100vw, 1298px\" \/><\/a><\/p>\n<p>One of the most important steps before implementing linear regression is to check if the dependent variable (distance) is close to normal. We will assess this by visualizing a density plot as follows &#8211;<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">library(e1071) # for skewness function\r\npar(mfrow=c(1, 2)) # divide graph area in 2 columns\r\n\r\nplot(density(cars$speed), main=\"Speed\", ylab=\"Frequency\", \r\n   sub=paste(\"Skewness:\", round(e1071::skewness(cars$speed), 3)))\r\n\r\npolygon(density(cars$speed), col=\"darkorange\")\r\n\r\nplot(density(cars$dist), main=\"Distance\", ylab=\"Frequency\", \r\n   sub=paste(\"Skewness:\", round(e1071::skewness(cars$dist), 3)))\r\n\r\npolygon(density(cars$dist), col=\"darkorange\")<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/visualizing-density-plot-in-R-linear-model.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-65487\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/visualizing-density-plot-in-R-linear-model.jpg\" alt=\"visualizing density plot in R linear model\" width=\"1296\" height=\"742\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/visualizing-density-plot-in-R-linear-model.jpg 1296w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/visualizing-density-plot-in-R-linear-model-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/visualizing-density-plot-in-R-linear-model-300x172.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/visualizing-density-plot-in-R-linear-model-768x440.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/visualizing-density-plot-in-R-linear-model-1024x586.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/visualizing-density-plot-in-R-linear-model-520x298.jpg 520w\" sizes=\"auto, (max-width: 1296px) 100vw, 1296px\" \/><\/a><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">LinearModel &lt;- lm(dist ~ speed, data=cars) \r\nprint(LinearModel)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Linear-Modeling-Input.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-65488\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Linear-Modeling-Input.jpg\" alt=\"Creating linear model in r \" width=\"1300\" height=\"746\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Linear-Modeling-Input.jpg 1300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Linear-Modeling-Input-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Linear-Modeling-Input-300x172.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Linear-Modeling-Input-768x441.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Linear-Modeling-Input-1024x588.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/Linear-Modeling-Input-520x298.jpg 520w\" sizes=\"auto, (max-width: 1300px) 100vw, 1300px\" \/><\/a><\/p>\n<p><em><strong>This is the right time to learn the most important topic of R programming &#8211; <a href=\"https:\/\/data-flair.training\/blogs\/data-visualization-in-r\/\">R Data Visualization<\/a>. Check this and comment us your learning experience<\/strong><\/em><\/p>\n<p>Now, with the help of summary() function, we will understand the summary statistics associated with our model &#8211;<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">summary(LinearModel)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/GLM-R.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-65489\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/GLM-R.jpg\" alt=\"GLM R\" width=\"1296\" height=\"742\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/GLM-R.jpg 1296w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/GLM-R-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/GLM-R-300x172.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/GLM-R-768x440.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/GLM-R-1024x586.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/GLM-R-520x298.jpg 520w\" sizes=\"auto, (max-width: 1296px) 100vw, 1296px\" \/><\/a><\/p>\n<p><em><strong>Another type of linear modeling is survival analysis. You can learn about it in our <a href=\"https:\/\/data-flair.training\/blogs\/survival-analysis-in-r\/\">tutorial on Survival Analysis in R<\/a>.\u00a0<\/strong><\/em><\/p>\n<h2>Summary<\/h2>\n<p>We learned the concept of generalized linear model in R. Hope after completing this, you are able to create a generalized linear model. If still in doubt, comment below. DataFlair will surely help you.<\/p>\n<p><strong>Happy Learning\ud83d\ude0a<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier we have discussed Graphical Models. Today, DataFlair has come up with a new and very important topic that is R Generalized Linear Models. We will see what exactly R Generalized linear models are&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":65500,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51],"tags":[5044,5103,16726,16727,13994],"class_list":["post-4925","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-r","tag-generalized-linear-models","tag-glm-in-r","tag-linear-models-in-r","tag-r-linear-models","tag-survival-analysis-in-r"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Create Generalized Linear Models in R - The Expert&#039;s Way! - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn everything about Generalized Linear models in R. Know how to create a GLM in R and also Logistic and Poisson regression\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create Generalized Linear Models in R - The Expert&#039;s Way! - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn everything about Generalized Linear models in R. Know how to create a GLM in R and also Logistic and Poisson regression\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-17T12:04:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-25T11:55:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/R-generalized-linear-models.png\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"419\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create Generalized Linear Models in R - The Expert's Way! - DataFlair","description":"Learn everything about Generalized Linear models in R. Know how to create a GLM in R and also Logistic and Poisson regression","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/","og_locale":"en_US","og_type":"article","og_title":"How to Create Generalized Linear Models in R - The Expert's Way! - DataFlair","og_description":"Learn everything about Generalized Linear models in R. Know how to create a GLM in R and also Logistic and Poisson regression","og_url":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-01-17T12:04:47+00:00","article_modified_time":"2021-08-25T11:55:41+00:00","og_image":[{"width":802,"height":419,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/R-generalized-linear-models.png","type":"image\/png"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"How to Create Generalized Linear Models in R &#8211; The Expert&#8217;s Way!","datePublished":"2018-01-17T12:04:47+00:00","dateModified":"2021-08-25T11:55:41+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/"},"wordCount":605,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/R-generalized-linear-models.png","keywords":["Generalized Linear Models","GLM in R","Linear models in R","R Linear Models","Survival analysis in r"],"articleSection":["R Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/","url":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/","name":"How to Create Generalized Linear Models in R - The Expert's Way! - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/R-generalized-linear-models.png","datePublished":"2018-01-17T12:04:47+00:00","dateModified":"2021-08-25T11:55:41+00:00","description":"Learn everything about Generalized Linear models in R. Know how to create a GLM in R and also Logistic and Poisson regression","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/R-generalized-linear-models.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/01\/R-generalized-linear-models.png","width":802,"height":419},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/generalized-linear-models-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"R Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/r\/"},{"@type":"ListItem","position":3,"name":"How to Create Generalized Linear Models in R &#8211; The Expert&#8217;s Way!"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/4925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=4925"}],"version-history":[{"count":9,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/4925\/revisions"}],"predecessor-version":[{"id":65501,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/4925\/revisions\/65501"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/65500"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=4925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=4925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=4925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}