Displaying 20 results from an estimated 900 matches similar to: "Multinomial-Dirichlet using R"
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
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]
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
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
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
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 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 =
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
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
>
2010 Apr 13
1
WinBUGS Question
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]]
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]]
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
2007 Jan 07
1
Partial proportional odds logistic regression
R-experts:
I would like to explore the partial proportional odds models of Peterson
and Harrell (Applied Statistics 1990, 39(2): 205-217) for a dataset that
I am analyzing. I have not been able to locate a R package that
implements these models. Is anyone aware of existing R functions,
packages, etc... that might be used to implement the partial
proportional odds models?
Brant Inman
2012 Apr 11
2
What is a better way to deal with lag/difference and loops in time series using R?
Hello,
I am writing codes for time series computation but encountering some
problems
Given the quarterly data from 1983Q1 to 1984Q2
PI1<-ts(c(2.747365190,2.791594762, -0.009953715, -0.015059485,
-1.190061246, -0.553031799, 0.686874720, 0.953911035),
start=c(1983,1), frequency=4)
> PI1
Qtr1 Qtr2 Qtr3 Qtr4
1983 2.747365190 2.791594762
2013 Feb 04
2
reshape help
Dear R users -
I have a list of patient identifiers and diagnoses from inpatient
admissions. I would like to reorganize the list, presently in a long
format to a wide format in reshape, but in the absence of a "time" element,
I am uncertain how to do this - any help greatly appreciated.
ID Dx
A nausea
A diabetes
A kidney failure
A heart attack
A fever
B fever
B
2006 Sep 18
1
Simulation of a Dirichlet Process.
I'm just getting started with R, having a lot of original work on
modeling and exploring the simulation by MCMC. I want to simulate the
prior and the posterior distribution of Dirichlet Process by MCMC.
Is there anyone in NYC that might be a good
tutor for me?
--
Dr. P. NGOM,
Facult? des Sciences et Techniques
D?partement de Math?matiques et Informatique
Universit? Cheikh Anta Diop Dakar -
2024 Sep 14
1
Dirichlet kernel requires r to be defined, which is not in the help
Code to reproduce
> kernel("dirichlet")
Error in kernel("dirichlet") : argument "r" is missing, with no default
The help says
r??? the kernel order for a Fejer kernel.
Thanks to update the help.
Best,
Samuel
2011 Mar 29
1
Dirichlet surface
Dear list members,
I want to draw surfaces of Dirichlet distributions with different
parameter settings.
My code is the following:
#<begin code>
a1 <- a2 <- a3 <- 2
#a2 <- .5
#a3 <- .5
x1 <- x2 <- seq(0.01, .99, by=.01)
f <- function(x1, x2){
term1 <- gamma(a1+a2+a3)/(gamma(a1)*gamma(a2)*gamma(a3))
term2 <- x1^(a1-1)*x2^(a2-1)*(1-x1-x2)^(a3-1)