Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > # Introduction to R
- > # Copyright 2016 by Michael Grogan
- > # Tools -> Install Packages
- >
- > # Set working directory to where csv file is located
- > setwd("C:\\Users\\Michael Grogan\\Documents\\Documents\\R")
- >
- > # Read the data
- > mydata<- read.csv("C:\\Users\\Michael Grogan\\Documents\\Documents\\R\\binomial_stock.csv")
- > attach(mydata)
- The following object is masked _by_ .GlobalEnv:
- dividend
- The following objects are masked from mydata (position 4):
- dividend, earnings_estimates, years
- >
- > # Logistic regression
- > dividend <- glm(dividend ~ years + earnings_estimates, data=mydata, family="binomial")
- > summary(dividend)
- Call:
- glm(formula = dividend ~ years + earnings_estimates, family = "binomial",
- data = mydata)
- Deviance Residuals:
- Min 1Q Median 3Q Max
- -1.18463 -0.22497 -0.01288 0.00776 1.96192
- Coefficients:
- Estimate Std. Error z value Pr(>|z|)
- (Intercept) -10.6858 3.4413 -3.105 0.0019 **
- years 0.8919 0.2974 2.999 0.0027 **
- earnings_estimates 0.3953 1.1003 0.359 0.7194
- ---
- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
- (Dispersion parameter for binomial family taken to be 1)
- Null deviance: 97.041 on 69 degrees of freedom
- Residual deviance: 22.762 on 67 degrees of freedom
- AIC: 28.762
- Number of Fisher Scoring iterations: 9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement