sofoki.blogg.se

Regression in r studio
Regression in r studio









regression in r studio

Regression in r studio how to#

# How to do Logistic Regression in R # Created by Michaelino Mervisiano > install.packages("AER") > library("AER") > data(Affairs, package="AER") > View(Affairs) > summary(Affairs) affairs gender age yearsmarried children Min. Then, you can use the model to check which one between you and your partner that more likely to have an affair or not 😜īut, before that, we will run through some descriptive statistics with the code below to get a better understanding of our data. The figure below shows a few observations to give you an overview of the data.Īpplying Logistic Regression, we can find which factors contributed the most to infidelity. This data contains 9 variables collected on 601 respondents which hold information such as how often they have affairs during the past years, as well as their age, gender, education, years married, have children (yes/no), how religious they are (on a 5-point scale from 1=anti to 5=very), occupation (7-point classification), and a self-rating on happiness toward their marriage (from 1=very unhappy to 5=very happy). We will use infidelity data as our example dataset, known as Fair’s Affairs, which is based on a cross-sectional survey conducted by Psychology Today in 1969 and is described in Greene (2003) and Fair (1978). In this article, I will discuss an overview on how to use Logistic Regression in R with an example dataset. It comes in handy if you want to predict a binary outcome from a set of continuous and/or categorical predictor variables.

regression in r studio

Logistic regression is one of the most popular forms of the generalized linear model.











Regression in r studio