pdalgd at gmail.com
Tue Dec 27 16:15:28 CET 2011
On Dec 27, 2011, at 15:47 , Scott Raynaud wrote:
> I have the following code (which I did not write) that generates
> data based on a logistic model. I'm only getting a single record
> with y=1. It seems implausible that in 50k cases that have a
> single y=1. Does that ring alarm bells for anyone else?
Not really. As far as I can tell, "fixpart" is roughly -10.5 (= -1.5 - .25*36), so binomprob is around 2.75e-5, which - nonlinearity notwithstanding - suggests that the expected number of positives out of 50K is something like 1.4.
To do this more precisely, just compute and print sum(binomprob) in the code you gave.
> #loop code
> x<-matrix(1,length,betasize) #length set to 50k
> #loop code
> x[,2]<-rnorm(length,meanpred,sqrt(varpred)) #length set to 50k
> #more loop code
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help