Re: [R] Stack dataframes into a matrix

2016-07-27 Thread Anamika Chaudhuri
,2])) print(x) # Need to be able to stack the x's to produce one matrix } Thanks Anamika On Wed, Jul 27, 2016 at 2:46 AM, David Winsemius wrote: > > > On Jul 26, 2016, at 8:07 PM, Anamika Chaudhuri > wrote: > > > > I have 100 datasets with 20 rows and 2 columns in

[R] Stack dataframes into a matrix

2016-07-26 Thread Anamika Chaudhuri
I have 100 datasets with 20 rows and 2 columns in each dataset. I am looking for help to produce x and y below as 1000 X 20 matrix and then repeat that across 100 datasets using R library(MASS) library(car) set.seed(1234) library(mixtools) library(sp)

Re: [R] How to use dwish in MCMCpack in R

2015-09-03 Thread Anamika Chaudhuri
I put in the matrix at which I want the density as S. I was wondering what is W then? Thanks Anamika On Thu, Sep 3, 2015 at 12:28 PM, Duncan Murdoch wrote: > On 03/09/2015 9:29 AM, Anamika Chaudhuri wrote: > > Hi All: > > > > I am trying to use the dwish function

[R] How to use dwish in MCMCpack in R

2015-09-03 Thread Anamika Chaudhuri
Hi All: I am trying to use the dwish function in the MCMCpack in R dwish(W, v, S) where Arguments W-Positive definite matrix W v-Degrees of freedom (scalar). S-Inverse scale matrix How do I determine W, the positive definite matrix. The matrix provided in the documentation doesnot help. Thanks

[R] Need help with kde2d function in R

2015-08-05 Thread Anamika Chaudhuri
Hi, I am trying to create a bivariate ellipse to see if the true values fall within the 95% confidence ellipse. I am getting subscript out of bounds error in R with following code. Not sure what is causing it. When I use the kde2d function with n>=30 I get the error but not for n=25 and below.

[R] Equation of an Ellipse in R

2013-10-25 Thread Anamika Chaudhuri
Hi All: I was looking for some help to code the equation of an ellipse in R, given I have a Bivariate Normal distribution (X,Y) with mean (m1,m2) and var-covariance matrix (var1,cov12,cov12,var2). Thanks Anamika [[alternative HTML version deleted]] __

Re: [R] Data Manipulation in R

2013-10-21 Thread Anamika Chaudhuri
> write.csv(dat,paste0("file",i,".csv"),row.names=FALSE,quote=FALSE)}) > > > A.K. > > > > > > A.K. > > > > > On Monday, October 21, 2013 12:24 AM, Anamika Chaudhuri < > canam...@gmail.com> wrote: > Hi: > > I am looking for

[R] Data Manipulation in R

2013-10-20 Thread Anamika Chaudhuri
Hi: I am looking for some help to manipulate data in R. I have two csv files. datasetY1 V1 "V2" "V3" "V4" 1 4 0 20 17 2 4 0 15 17 3 2 0 13 21 datasetY2 V1 "V2" "V3" "V4" 1 20 52 15 18 2 18 54 14 21 3 18 51 13 21 I want to be able to create separate csv files by taking the corresponding

[R] Help with automation of WinBUGS from R

2013-09-28 Thread Anamika Chaudhuri
Hi: I have a question related to the R Code which calls BUGS. I have run the model in WinBUGS and it runs fine giving me the expected results. Below is the automation code used when I had single outcome or univariate data for Y’s. Now I want to use it for multiple outcomes. So the trial.data below

[R] DataEllipse versus Ellipse Function in R

2013-09-14 Thread Anamika Chaudhuri
Hi: Does Ellipse and dataellipse function in R produce the same ellipse? I wanted to see how the radius for the Ellipse function in R calculated. Also what is the var-covariance matrix, if any, assumed for the dataellipse function? Heres an example of the code where I am generating Multivariate no

Re: [R] R.oo in R-3.0.1

2013-08-21 Thread Anamika Chaudhuri
Hi All: I am getting some warnings trying to run the following code and I am not sure what they mean. > set.seed(111) > k<-63 > n<-60 > x<-NULL > p<-rbeta(k,3,3)# so that the mean nausea rate is alpha/(alpha+beta) > #min<-10 > #max<-60 > #n<-as.integer(runif(k,min,max)) > for(i in 1:k) + x<-cbind(

[R] Error from running R2WinBUGS in R

2013-07-16 Thread Anamika Chaudhuri
Hi All: I am getting an error (highlighted) from running R2WinBUGS in R. To be able to replicate the situation heres the code: .#Set working directory setwd("H://AChaudhuri/Testing/CSVS") matrix=NULL csvs <- paste("MVN", 1:2, ".csv", sep="") for(i in 1:length(csvs)){ matrix[[i]] <- read.csv(file=

[R] How to find the probability of falling in a bivariate ellipse

2013-07-12 Thread Anamika Chaudhuri
Hi All: How would you find out the probability that a point lies within an ellipse? For eg if I was plotting (x,y) for 300 datasets in an 95% ellipsoid region, how do I calculate how many times out of 300 will my points fall inside the ellipse? Heres the code I am using library(MASS) seed<-1234

[R] Bivariate Tolerance Region

2013-07-10 Thread Anamika Chaudhuri
Hi: I apologize for posting in the R listserv. But I am trying to do the following in R. I am trying to construct Bivariate 95% Approximate Confidence interval for the mean vector p=(p1,p2) similar to what we have in the univariate case. [image: \hat p \pm z_{1 - \frac{1}{2}\alpha} \sqrt{\frac{1}

[R] Automating the running of MVLN model in R using R2WinBUGS

2013-07-01 Thread Anamika Chaudhuri
Hi: To test the situation below I am creating 2 datasets .#Set working directory setwd("C://Tina/USB_Backup_042213/Testing/CSV") matrix=NULL csvs <- paste("MVN", 1:2, ".csv", sep="") for(i in 1:length(csvs)){ matrix[[i]] <- read.csv(file=csvs[i], header=T) print(matrix[[i]]) } So now I have

[R] Add constraints to rbinom

2013-06-27 Thread Anamika Chaudhuri
Hi: I am trying to generate Beta-Binomial random variables and then calculate Binomial exact confidence intervals to the rate..I was wondering if I needed to add a constraint such that x<=n to it, how do I go about it. The reason is I am getting data where x>n which is giving a rate>1. Heres my co

[R] Running MCMC using R2WinBUGS

2013-06-24 Thread Anamika Chaudhuri
Hi All: Not sure why my previous question never got posted. Here I am seeking some help on my code. I am using the following code to run MCMC simulation on the following data using the model below: # Data matrix<-NULL > csvs<-paste("MVN", 1:2,".csv",sep="") > for (i in 1:length(csvs)){ + matrix[[i

[R] Automation using R2WinBUGS

2013-06-18 Thread Anamika Chaudhuri
Hi All: I am running R2WinBUGS so that I could automate the running of my Multivariate Logit Normal model on 300 simulated datasets. The problem I have is I am not able to read in the data correctly and then code it in the automation part. *Heres my model:* model { for (j in 1 : Nf) { p1[j, 1:

Re: [R] Multinomial-Dirichlet using R

2013-05-13 Thread Anamika Chaudhuri
Winsemius wrote: > > On May 12, 2013, at 4:44 PM, Anamika Chaudhuri wrote: > > > Hi: > > > > I have asked this question on Cross-Validated. So it might be a cross > > posting but havent received any responses to it. > > > > I am trying to see which dis

[R] Multinomial-Dirichlet using R

2013-05-12 Thread Anamika Chaudhuri
Hi: I have asked this question on Cross-Validated. So it might be a cross posting but havent received any responses to it. I am trying to see which distribution will best fit the data I am working on. The dataset is as following: Site Nausea headacheAbdominal Distension

[R] Beta-Binomial Regression in R

2012-07-28 Thread Anamika Chaudhuri
Hi All: I am trying to generate Beta-Binomial data with regressors using R. I have used the following code to generate Beta-Binomial data. Now I want to add a covariate to the equation. I would then like to use the simulated data to run the Beta-Binomial model with covariates on it. Appreciate an

Re: [R] qbeta function in R

2012-03-09 Thread Anamika Chaudhuri
Hi David: Thanks, I actually realized it was error on my part. I didnt think there was a problem with R-code, just wanted to get a better understanding of the function qbeta. Anamika On Fri, Mar 9, 2012 at 3:04 PM, David Winsemius wrote: > > On Mar 9, 2012, at 2:48 PM, Anamika Chaudhuri

[R] qbeta function in R

2012-03-09 Thread Anamika Chaudhuri
HI All: Does anyone know the code behind the qbeta function in R? I am using it to calculate exact confidence intervals and I am getting 'NaN' at places I shouldnt be. Heres the simple code I am using: k<-3 > x<-NULL > p<-rbeta(k,3,3)# so that the mean nausea rate is alpha/(alpha+beta) > min<-10

[R] , Exact Confidence Interval

2012-03-07 Thread Anamika Chaudhuri
> > Hi All: > > I am using R to calculate exact 95% confidence interval using Clopper > Pearson method. I am using the following code but it seems to get into a > loop and not get out of it, it goes on forever although I am looping it > only 10 times across 63 sites with 10 observations per site. I

[R] Specify decimal places for parameters in BUGS output

2010-08-16 Thread Anamika Chaudhuri
Hi All: I had a basic question to ask. I am running R2WinBUGS so that I could automate the running of my model using 1000 simulated datasets. Below is the code I am using. The only problem I am having is the bugs output that comes out shows my parameters as nos with 1 decimal place after. I would

Re: [R] [BUGS] [R-BUGS] error while plotting

2010-08-10 Thread Anamika Chaudhuri
Trevor, Thanks for your reply. That doesnot help Any other suggestions? Anamika On Tue, Aug 10, 2010 at 11:58 AM, Trevor Davies wrote: > I think you need to load is R2WinBUGS again. > > require(R2WinBUGS) > > Trevor > > > Hi All: > > > > I am getting an error while trying to plot in R2Winbugs >

[R] WinBUGS Question

2010-04-13 Thread Anamika Chaudhuri
Hi: Is there a way we can set up WINBUGS to run 100 simulated datasets on the same model and output results? Or do we have to call in each dataset at a time and repeat the process 100 times manually? Thanks Anamika [[alternative HTML version deleted]] ___

[R] Beta Conjugate Prior for Random intercept model -WInBUGS

2008-12-16 Thread Anamika Chaudhuri
I have been using the following random intercept model with non-informative prior: model { for (i in 1:n.samples) { vomit[i] ~ dbern(p[i]) logit(p[i]) <- beta0 + alpha[siteid[i]] } for (j in 1:n.sites) { alpha[j]~dnorm(0,tau) } beta0 ~ dnorm(0.0,1.0E-6) tau ~ dgamma(0.01,0.01) } list(n.samples=3780

Re: [R] expected variable name error pos 98349 WInBUGS in R

2008-12-09 Thread Anamika Chaudhuri
the > error comes from the BUGS interpreter. Hence wrong mailing list. > > Best wishes, > Uwe Ligges > > > > > Anamika Chaudhuri wrote: > >> I am using a random intercept model with SITEID as random and NAUSEA as >>> outcome. >>> >>&

[R] error from running WinBUGS in R

2008-12-08 Thread Anamika Chaudhuri
Has anyone ever seen an error like this from running WinBUGS in R '> modelCompile(numChains=2) # compile model with 1 chain error for node p[3421] of type GraphLogit.Node node vetor contains undefined elements [[alternative HTML version deleted]] __

[R] expected variable name error pos 98349 WInBUGS in R

2008-12-08 Thread Anamika Chaudhuri
> I am using a random intercept model with SITEID as random and NAUSEA as > outcome. > > I tried using a dataset without missing values and changed my model > statement accordingly but still get the same error. Follwoing in an excerpt. > > anal.data <- read.table("nausea.txt", header=T, sep="\t") >

[R] Reading txt file in R to run Random Intercept Model

2008-12-07 Thread Anamika Chaudhuri
I am using a random intercept model with SITEID as random and NAUSEA as outcome. Thanks. Anamika I tried using a dataset without missing values and changed my model statement accordingly but still get the same error. Follwoing in an excerpt. > anal.data <- read.table("nausea.txt", header=T, sep=

Re: [R] Reading txt file in R

2008-12-07 Thread Anamika Chaudhuri
 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 0 1 1   -Anamika --- On Sun, 12/7/08, jim holtman <[EMAIL PROTECTED]> wrote: From: jim holtman <[EMAIL PROTECTED]> Subject: Re: [R] Reading txt file in R To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Date: Sunday, December 7, 2008, 10:27 AM In your sa

Re: [R] Reading txt file in R

2008-12-07 Thread Anamika Chaudhuri
nt? How do you intend to read them in and use them? On Sat, Dec 6, 2008 at 10:42 PM, Anamika Chaudhuri <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hi: > > I am using the following code to read a data set in txt in R and using the follwoing model. But it seem

[R] Reading txt file in R

2008-12-07 Thread Anamika Chaudhuri
Hi:   I am using the following code to read a data set in txt in R and using the follwoing model. But it seems to give me an error ' expected variable name error pos 134022'. Any help is greatly appreciated.   Code: anal.data <- read.table("nausea.txt", header=T, sep="\t") list(names(anal