Never mind. Stupid misplaced 's'.
-Andrew
On Sun, May 16, 2010 at 5:39 PM, Andrew Redd <aredd at stat.tamu.edu>
wrote:> Dear R help,
>
> What am I doing wrong here? when I don't specify the priors it works
> just fine but when I specify the priors it breaks.? Does anyone know
> why and how I can fix it?
> ----
>> N=20000
>> ncontrol=ncases=50
>> X <- as.matrix(rnorm(N,0,1))
>> eta <- -5.3 + X * 1.7
>> p <- exp(eta)/(1+exp(eta))
>> Y <- rbinom(N,1,p)
>> controls <- sample(seq_len(N), ncontrol, prob=!Y)
>> cases <- sample(seq_len(N), ncases, prob=Y)
>> data<-rbind(
> + data.frame(Y = 0, X = cbind(1,X[controls,])),
> + data.frame(Y = 1, X = cbind(1,X[cases,])))
>> head(data)
> ? Y X.1??????? X.2
> 1 0?? 1? 0.6965323
> 2 0?? 1 -0.0817520
> 3 0?? 1? 2.8673412
> 4 0?? 1 -0.2351386
> 5 0?? 1? 0.2653452
> 6 0?? 1 -1.2437612
>> m <- lda(Y~X,subset=c(controls,cases),priors=c(.95,.05))
>> predict(m)
> Error in model.frame.default(formula = Y ~ X, priors = c(0.95, 0.05),? :
> ? variable lengths differ (found for '(priors)')
>> predict(m,prior=c(.95,0.05))
> Error in model.frame.default(formula = Y ~ X, priors = c(0.95, 0.05),? :
> ? variable lengths differ (found for '(priors)')
> ---
> Thanks,
> Andrew
>