[R] Proc Nnpar1way with D option - equivalent in R
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("two.sided"),exact = NULL) I get very different result compared to SAS. I am new to R. Any help is appreciated. I think i am missing a datastep maybe ? Thank you. -- View this message in context: http://r.789695.n4.nabble.com/Proc-Nnpar1way-with-D-option-equivalent-in-R-tp4649348.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Proc Nnpar1way with D option - equivalent in R
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 = NULL) I would also like to know how to export the model output from the glm into a output dataset with those fitted values and then subset them into the 1's and 0's. That might work as well ? -- View this message in context: http://r.789695.n4.nabble.com/Proc-Nnpar1way-with-D-option-equivalent-in-R-tp4649348p4649370.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Proc Nnpar1way with D option - equivalent in R
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.sided"),exact=NULL) Thank you -- View this message in context: http://r.789695.n4.nabble.com/Proc-Nnpar1way-with-D-option-equivalent-in-R-tp4649348p4649459.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Macro Variable in R
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 have done this in SAS. Now i need to know how to do this in R. Any help or even if someone can point to a previous thread will help. -- View this message in context: http://r.789695.n4.nabble.com/Macro-Variable-in-R-tp4649460.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Random sampling many times and run through glm model
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 that went into the model. I have done this in SAS. LIke to know how i can do this in R. Any help is appreciated. -- View this message in context: http://r.789695.n4.nabble.com/Random-sampling-many-times-and-run-through-glm-model-tp4649461.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.