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

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Tue Nov 13 18:26:57 CET 2012


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of SASandRlearn
> Sent: Tuesday, November 13, 2012 4:26 AM
> To: r-help at r-project.org
> Subject: 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 ?
> 
> 
> 

I am not sure what you mean about exporting the output from glm.  You basically already have that in the dlogit object.  Given your code above, you could call the ks.test() function like this

ks.test(fitted(dlogit)[d$x==1], fitted(dlogit)[d$x==0], alternative = c("two.sided"), exact = NULL)

This should produce results consistent with the SAS results.  Whether you should do this I can't tell from way over here, because I don't know your data nor do I know what you are trying to do.  You may want to seek out a local statistical consultant.

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204




More information about the R-help mailing list