[R] Proc Nnpar1way with D option - equivalent in R

2012-11-12 Thread SASandRlearn
I am trying to match SAS output with R. I am using Proc Npar1way with D option to get KS test statistic. • Here X is a binary dependent variable and Y is the predicted probabilities; proc npar1way data = mydata D; class x; var y; run; When i try this in R ks.test(x, fitted(y),alternative = c

Re: [R] Proc Nnpar1way with D option - equivalent in R

2012-11-13 Thread SASandRlearn
Dan Thank you for your reply. I will try what you recommended. yes.. i have a 1 and 0 as binary. Here is what i have so far d <- read.csv(c:/test.csv", header=T) dlogit <- glm(x ~ a + b + c, data = d, family = "binomial") attach(d) ks.test(x, fitted(values),alternative = c("two.sided"),exact

Re: [R] Proc Nnpar1way with D option - equivalent in R

2012-11-13 Thread SASandRlearn
Dan, what you suggested worked out well. This code below also worked out well for me and it matches with SAS output. Ks <- cbind(x,fitted(d1logit)) ks.df <- data.frame(Ks) x <- subset(ks.df,x==0,select=c(V2)) y <- subset(ks.df,x==1,select=c(V2)) ks.test(x[,'V2'], y[,'V2'], alternative = c("two.si

[R] Macro Variable in R

2012-11-13 Thread SASandRlearn
I have over 300 variables in my table. I want to choose only a handful of those variables to run through many procedures. Lm(), glm() etc..i have over 10 procedures that i need to run those variables everytime. Those handful of variables can change everytime if output is satisfactory or not. I ha

[R] Random sampling many times and run through glm model

2012-11-13 Thread SASandRlearn
I have a large dataset from which i need to take a random sample many times ( say N=50) and run it through the same glm() - logistic regression model everytime ( 50 times ) and capture the chi-square p-values ( Pr > ChiSq ) of the variables for each run and output average p-value of the variables