chamilka
2012-Jul-31 20:17 UTC
[R] Help on VGAM package(missing value where TRUE/FALSE needed )
I am using VGAM R package for my research works. In my study, I am trying to simulate 1000 datasets from Beta binomial distribution for a given set of (n,prob,size,rho) and then I need to estimate the parameters prob and rho of the simulated 1000 datasets and need to store the fitted coefficients in 1000 by 2 data frame. For that purpose, by referring to VGAM user manual, I tried the following R coded.. * bdata = data.frame(N = 5, mu = 0.2, rho = 0.9) #define the number of trials, mean,rho bdata = cbind(bdata,replicate(1000, rbetabinom(n=10,prob=0.2,size=5,rho=0.9))) #concatenate the above with a simulated 1000 beta binomial datasets ab<-c() #defining a null object for the purpose of storage #Below I am running a for loop by treating each column of bdata as a response(from 4th) to estimate the parameters for(i in 4:100){ fit = vglm(cbind(bdata[,i], N-bdata[,i]) ~ 1, betabinomial, bdata, trace TRUE) ab<-rbind(ab,Coef(fit)) } * The code is running, but I am getting an error of below form /Error in if (any(near0.5 <- (abs(theta - 0.5) < 0.000125))) temp2[near0.5] = log(theta[near0.5]/(1 - : missing value where TRUE/FALSE needed / Please help me on this error. Thanks in advance -- View this message in context: http://r.789695.n4.nabble.com/Help-on-VGAM-package-missing-value-where-TRUE-FALSE-needed-tp4638595.html Sent from the R help mailing list archive at Nabble.com.