similar to: WinBUGS Question

Displaying 20 results from an estimated 1000 matches similar to: "WinBUGS Question"

2012 Jul 28
2
Beta-Binomial Regression in R
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 any help. set.seed(111) k<-20 n<-60 x<-NULL p<-rbeta(k,3,3)# so that the mean nausea rate
2013 Sep 15
1
DataEllipse versus Ellipse Function in R
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 normal data and creating ellipse using the 2 functions: library(car) library(mvtnorm) mu =
2008 Dec 09
1
expected variable name error pos 98349 WInBUGS in R
> 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") > > list(names(anal.data)) > [[1]] > [1]
2008 Dec 08
1
Reading txt file in R to run Random Intercept Model
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="\t") > list(names(anal.data)) [[1]] [1] "SITEID"
2006 Apr 25
4
Help needed
Hi, I am trying to change a SAS macro to R. here is my code. I get an error at the last line. attach(fram) dset1<-cbind(AGE,BMI,DEATH) > BMIGRP<-cut(BMI,breaks=3,right=TRUE) > AGEGRP<-floor(AGE/10)-2 > dset<-cbind(AGEGRP,BMIGRP,DEATH) > maxage<-max(dset[,1]) > minage<-min(dset[,1]) > #maxcls<-dset[,2] > #mincls<-dset[,2] >
2013 May 12
1
Multinomial-Dirichlet using R
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 headache Abdominal Distension 1 17 5 10 2 12
2006 Jul 24
5
change the name of file
Dear R Users, Is it possible to make file names dependent on a changing variable? For instance. I generate random numbers in a loop and at each iteration I want data to write to file (I do not want to write everything in one file using 'append'): for (i in 1:50){ x<-matrix(runif(100, min=0,max=1),nrow=5,ncol=20) Write(t(x),file="Data_i.txt",ncolumns=5,sep="\t") }
2010 Aug 16
1
Specify decimal places for parameters in BUGS output
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 want to have the parameters with 5 places after decimal. How would I specify that in my code for
2012 Mar 09
2
qbeta function in R
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 > max<-60 > n<-as.integer(runif(3,min,max)) > for(i in
2012 Mar 07
2
, Exact Confidence Interval
> > 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 was hoping > to get some help. > > Thanks > Anamika >
2013 Oct 25
1
Equation of an Ellipse in R
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]]
2010 Nov 06
4
Using changing names in loop in R
Hello everybody, I have usually solved this problem by repeating lines of codes instead of a loop, but it's such a waste of time, I thought I should really learn how to do it with loops: What I want to do: Say, I have several data files that differ only in a number, e.g. data points (or vector, or matrix...) Data_1, Data_2, Data_3,... and I want to manipulate them e.g. a simple sum of
2006 Apr 26
2
help in R
Hi, I cant understand where I am going wrong.Below is my code.I would really appreciate your help. Thanks. > genfile<-read.table("c:/tina/phd/bs871/hw/genfile.txt",skip=1) > > #read in SNP data > snp.dat <- as.matrix(genfile) > snp.name <- scan("c:/tina/phd/bs871/hw/genfile.txt",nline=1,what="character") Read 100 items
2008 Dec 07
1
Reading txt file in R
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.data)) attach(anal.data) n.samples <- dim(anal.data) [1] # number of data
2007 Mar 09
1
MCMC logit
Hi, I have a dataset with the binary outcome Y(0,1) and 4 covariates (X1,X@,X#,X$). I am trying to use MCMClogit to model logistic regression using MCMC. I am getting an error where it doesnt identify the covariates ,although its reading in correctly. The dataset is a sample of actual dataset. Below is my code: > ####################### > > > #retreive data > # considering four
2006 Apr 17
7
help
Hi, I am trying to runn a age-period-cohort model, but here is what I am having problem with, hope you can help me! This is what I am trying to do: sumzero_a<-((A-min(A))/5+1) - mean((A-min(A))/5+1) where A is my age variable (numeric, the mid-point of a five-year age group), but I got the following error: Error in min(..., na.rm = na.rm) : invalid 'mode' of argument I am pretty
2010 May 18
1
Maximization of quadratic forms
Dear R Help, I am trying to fit a nonlinear model for a mean function $\mu(Data_i, \beta)$ for a fixed covariance matrix where $\beta$ and $\mu$ are low- dimensional. More specifically, for fixed variance-covariance matrices $\Sigma_{z=0}$ and $\Sigma_{z=1}$ (according to a binary covariate $Z $), I am trying to minimize: $\sum_{i=1^n} (Y_i-\mu_(Data_i,\beta))' \Sigma_{z=z_i}^{-1} (Y_i-
2014 Oct 16
2
RCharts+Leaflet+Shiny
Daniel, muchas gracias por contestar y tan rápido. Pues puede ser la solución, he hecho el cambio y sigue sin pintarme los puntos -> data_ <- toJSONArray(data_, json = F) map$geoJson( # leafletR::toGeoJSON(data_, # # lat.lon = c('Lat', 'Long'), # dest=output_geofile), data_, onEachFeature =
2014 Oct 15
2
RCharts+Leaflet+Shiny
Hola, Ando un poco desesperado con los mapas interactivos de Rcharts <https://github.com/ramnathv/rCharts>+Leaflet. Estoy intentando pintar en un mapa las cámaras de tráfico de madrid, y las estaciones de calidad del aire, simplemente donde están, es decir, aun no estoy recogiendo los datos de medida. Proyecto -> https://github.com/ADIRSE/maddata He conseguido pintar ambos, con
2011 Jun 22
1
Appending to list
So im here now b/c im incredibly frustrated. Please consider the following: #Try 1 Data_<-list() Sn<-1:12 for(sn in Sn){ for(i in 1:10){ Data.X <- rnorm(100,0,10) Data_[[paste(sn,i,sep="-")]]<-Data.X } } ##Try 2 Data_<-list() Sn<-1:12 for(sn in Sn){ for(i in 1:10){ Data.X <- rnorm(100,0,10) Data_[[sn]][[i]]<-Data.X } } In Try 1 i am able to append