This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function calculate() { | |
| for (i=0; i<=99; i++) { | |
| probs[i]=[]; | |
| for (j=0; j<=99; j++) { | |
| probs[i][j]=[]; | |
| for (k=0; k<=99; k++){ | |
| probs[i][j][k]=.5; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AppTitle "Mouse Distance" | |
| file=ReadFile("distance.ini") | |
| Global custom=ReadLine(file) | |
| Global width=ReadLine(file) | |
| Global height=ReadLine(file) | |
| Global writedelay=ReadLine(file) | |
| Global inches#=ReadLine(file) | |
| Global feet=ReadLine(file) | |
| Global miles=ReadLine(file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| female time churned | |
| 0 273 0 | |
| 0 360 0 | |
| 0 8 0 | |
| 0 211 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use the survival library | |
| library(survival) | |
| # Read in the NetLixx data... yes, I use Windows. | |
| net_lixx <- read.csv('C:/Users/dayne/Desktop/NetLixx.csv') | |
| # Create a "survival object" for each observation, using time and churn data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Run basic setup again | |
| library(survival) | |
| net_lixx <- read.csv('C:/Users/dayne/Desktop/NetLixx.csv') | |
| net_lixx$survival <- Surv(net_lixx$time, net_lixx$churned == 1) | |
| # Fit survival curves based on the female binary | |
| fit <- survfit(survival ~ female, data = net_lixx) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Call: | |
| survdiff(formula = survival ~ female, data = net_lixx) | |
| N Observed Expected (O-E)^2/E (O-E)^2/V | |
| female=0 6722 830 778 3.48 12.4 | |
| female=1 2532 251 303 8.94 12.4 | |
| Chisq= 12.4 on 1 degrees of freedom, p= 0.000422 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| female age coupon churned time | |
| 0 64 0 1 158 | |
| 0 22 0 0 25 | |
| 0 37 0 0 150 | |
| 0 55 0 0 311 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Load the survival library | |
| library(survival) | |
| # Read in the data and create a "survival object" | |
| netlixx_cox <- read.csv('C:/Users/dayne/Desktop/NetLixxCox.csv') | |
| netlixx_cox$survival <- Surv(netlixx_cox$followtime, netlixx_cox$churn == 1) | |
| # Run a cox regression of survival on female, age, and coupon status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| coxph(formula = survival ~ female + age + coupon, data = netlixx_cox) | |
| coef exp(coef) se(coef) z p | |
| female -0.03749 0.963 0.09098 -0.412 6.8e-01 | |
| age -0.00561 0.994 0.00176 -3.191 1.4e-03 | |
| coupon 0.58709 1.799 0.08104 7.245 4.3e-13 | |
| Likelihood ratio test=58.3 on 3 df, p=1.37e-12 n= 5124, number of events= 743 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Run a test for non-proportional hazards on our cox regression results | |
| cox.zph(results) |
OlderNewer