Advertisement
897bhgy

Untitled

Jul 16th, 2023 (edited)
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.45 KB | Source Code | 0 0
  1. # Set seed for reproducibility
  2. set.seed(42)
  3.  
  4. # Randomly sample 70% of data indices for training set
  5. train_indices <- sample(1:nrow(credit), nrow(credit)*0.7)
  6.  
  7. # Create training and testing datasets
  8. train_data <- credit[train_indices, ]
  9. test_data <- credit[-train_indices, ]
  10.  
  11. # Build logistic regression model
  12. model2 <- glm(upgraded ~ purchases + extraCards, family = binomial, data = credit)
  13.  
  14. # Output of logistic regression model
  15. summary(model2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement