Advertisement
Guest User

Untitled

a guest
May 25th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. > # Introduction to R
  2. > # Copyright 2016 by Michael Grogan
  3. > # Tools -> Install Packages
  4. >
  5. > # Set working directory to where csv file is located
  6. > setwd("C:\\Users\\Michael Grogan\\Documents\\Documents\\R")
  7. >
  8. > # Read the data
  9. > mydata<- read.csv("C:\\Users\\Michael Grogan\\Documents\\Documents\\R\\binomial_stock.csv")
  10. > attach(mydata)
  11. The following object is masked _by_ .GlobalEnv:
  12.  
  13. dividend
  14. The following objects are masked from mydata (position 4):
  15.  
  16. dividend, earnings_estimates, years
  17. >
  18. > # Logistic regression
  19. > dividend <- glm(dividend ~ years + earnings_estimates, data=mydata, family="binomial")
  20. > summary(dividend)
  21.  
  22. Call:
  23. glm(formula = dividend ~ years + earnings_estimates, family = "binomial",
  24. data = mydata)
  25.  
  26. Deviance Residuals:
  27. Min 1Q Median 3Q Max
  28. -1.18463 -0.22497 -0.01288 0.00776 1.96192
  29.  
  30. Coefficients:
  31. Estimate Std. Error z value Pr(>|z|)
  32. (Intercept) -10.6858 3.4413 -3.105 0.0019 **
  33. years 0.8919 0.2974 2.999 0.0027 **
  34. earnings_estimates 0.3953 1.1003 0.359 0.7194
  35. ---
  36. Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  37.  
  38. (Dispersion parameter for binomial family taken to be 1)
  39.  
  40. Null deviance: 97.041 on 69 degrees of freedom
  41. Residual deviance: 22.762 on 67 degrees of freedom
  42. AIC: 28.762
  43.  
  44. Number of Fisher Scoring iterations: 9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement