Displaying 20 results from an estimated 900 matches similar to: "Substituting vectors into a legend"
2010 Apr 08
1
a small question about R with Winbugs
I try to do a test for dirichlet process for Multivariate normal, but Winbugs
always says "expected multivariate node", does that mean I miss something at
initialization? I will really appreciate the help to solve this problem
Here is the R code, and Winbugs code.
model
{
for(i in 1:N){
y[i,1:2] ~ dmnorm(mu[i,],tau[i,,])
S[i] ~ dcat(pi[])
mu[i,1:2] <- mu.star[S[i],]
2010 Apr 19
1
BRugs
Hi. I am new here, and I am writing this Winbugs code with BRugs.
n=length(bi.bmi)
Lagegp=13
Lgen=2
Lrace=5
Lstra=15
Lpsu=2
#model gen x race
bi.bmi.model=function(){
# likelihood
for (i in 1:n){
bi.bmi[i]~ dbern(p[i])
logit(p[i])<- a0 + a1[agegp[i]]+a2[gen[i]]+a3[race[i]]
+ a12[agegp[i], gen[i]]
+ gam[stra[i]]+ u[psu[i],stra[i]] }
# constraints for a1, a2, a3, a12
a1[1]<-0.0
2010 Apr 03
2
histogram-like barplot? (or reverse?)
Hi,
I have a simple task I can't figure out. I'd like to take
some measurements I made, e.g.:
year (y-axis)
1
2
3
4
5
6
counts (x-axis)
10
10
20
30
40
50
And then, make a barplot with the x-axis ticks (representing
the borders between years) between the bars.
However, barplot seems to force you to make the x-axis
arbitrary categories. I want it to be continuous (as in a
2004 Oct 20
2
Odd behaviour with scale()
Moi!
A student here has been getting a bit irritated with some side effects
of scale() (OS is Windows XP, the behaviour occurs in R 2.0.0, but not
1.7.1). The problem is that she scales a variable in a data frame, then
does a regression, and tries to get some predictions for some new data.
However, at this point she gets an error (see the example below). This
seems to be because the
2004 Mar 19
2
Odd behaviour of step (and stepAIC)?
I can only assume I'm betraying my ignorance here, but this is not what
I would expect.
I'm getting the following from a stepwise selection (with both step and
stepAIC):
> step(lm(sqrt(Grids)~ SE + Edge + NH), scope=~ (Edge + SE + NH)^2)
Start: AIC= 593.56
sqrt(Grids) ~ SE + Edge + NH
Df Sum of Sq RSS AIC
<none> 2147.0 593.6
+ Edge:NH 1
2004 Sep 29
0
[Fwd: OpenBUGS]
This is slightly off-topic, but there was a discussion about MCMC a
couple of weeks ago. OpenBUGS can operate from R, at least in Windows
(there are some problems in Linux at the moment).
The interface with R is one are that there are plans to work on: it's a
bit basic at the moment.
Bob
--
Bob O'Hara
Dept. of Mathematics and Statistics
P.O. Box 68 (Gustaf H??llstr??min katu 2b)
2011 Feb 20
1
inter-specific competition - community matrices and two species models using Lotka-Volterra
Does anyone know of example r-code/packages for carrying out analysis?
Preferably this would have examples from real experimental data of two or
more competing species...
Thanks
Chris Buddenhagen
[[alternative HTML version deleted]]
2012 Jun 28
1
Mystery!!!
I am executing the following loops in R 15.1.0 and the first one works and
produces results. However, the second one is not with initiating the object
as x[i]. Further, I was able to get the second loop work in R 15.0. Am I
missing something here?
for(i in 1:length(b))
{y[i]<-paste(a,b[i],c,sep="")
print(y[i])
print(fromJSON(file=y[i],method="C"))
}
for(i in 1:length(b))
2012 Apr 04
1
BRugs crash, question
(Using BRugs 0.7-5, R 2.14.2 32-bit on 64-bit Windows 7, OpenBUGS 3.2.1)
1. BRugs crashes R for me as follows. Sorry about the lack of detail; please let
me know if / how to supply a more useful bug report on this issue.
fit <- BRugsFit(...)
# BRugs and OpenBUGS runs fine, the parameter estimates are reasonable
# across 3 chains
samplesBgr("beta") # crash
2011 Apr 26
2
what's wrong with plot(..., type="p")?
Dear users,
I'm trying to get a dot plot but always end up with a boxplot. Can
someone please tell me what I am doing wrong?
df <- structure(list(FACETTE = structure(c(1L, 1L, 1L, 1L, 2L, 2L,
+ 2L, 2L), .Label = c("base", "tip"), class = "factor"), Sq = c(274836,
+ 0.74182, 0.709205, 0.984552, 279869, 255712, 26566, 301464)), .Names =
c("FACETTE",
2017 Sep 20
0
arguments imply differing number of rows
4000:6000 gives you 4000, 4001, ..., 6000. I suspect you want
population= c(seq(4000, 6000, length=5), seq(3500, 4300, length=5),
seq(3000, 3200, length=5))
Bob
On 20 September 2017 at 17:07, Shivi Bhatia <shivipmp82 at gmail.com> wrote:
> Hi Team,
>
> I using the syntax as:
>
> data.df<- data.frame(
> city= c(rep(c("Delhi",
2017 Sep 20
4
arguments imply differing number of rows
Hi Team,
I using the syntax as:
data.df<- data.frame(
city= c(rep(c("Delhi", "Bangalore","Chandigarh"),each=5)),
population= c(4000:6000,3500:4300,3000:3200)
)
But i am getting the error as arguments imply differing number of rows: 15,
3003.
Tried searching google but could not understand & find the solution.
Thanks, Shivi
[[alternative HTML version
2018 Apr 24
0
How to visualise what code is processed within a for loop
The loop never assigns anything to d0, only t. The first line makes t
a character string "d0$V1" (or "d0$V2" etc.). The second line assigns
either 0 or 1 to t.
Looking at this, I don't think you've got into the R psychology (bad
news if you want to use R, good news in many other ways). I assume d0
is a list, so could you put the V's into a vector, and then just use
2017 Jun 29
0
Help : glm p-values for a factor predictor
It might help if you provided the code you used. It's possible that
you didn't use direction="backward" in stepAIC(). Or if you did, it
was still running, so whatever else you try will still be slow. The
statement "R provides only the pvalues for each level" is wrong: look
at the anova() function.
Bob
On 29 June 2017 at 11:13, Beno?t PELE <benoit.pele at
2004 Dec 19
1
Different graph type can coexisti??
Please consider a data frame
A B C D
1 4 5 0
2 3 2 75
3 4 1 84
4 5 1 90
5 3 0 100
Is there a way to plot column B and C as barplot *and* D as line on the same
graph??
R-2.0.1 powered by Mandrake 10.1
-------------------------------------------------------------------------------------------------------------------------
Landini dr. Massimiliano
Tel. mob. (+39) 347 140 11 94
Tel./Fax. (+39)
2005 Aug 25
3
Converting characters to numbers in data frames
I'm sure I'm missing something obvious here, but I can't find the
solution (including in the FAQ etc.).
I have a vector of names of variables like this: NRes.x.y. where x and y
are numbers. I want to extract these numbers as numbers to use
elsewhere. I can extract the numbers as a list of characters using
strsplit(), and convert that to a data frame, e.g.:
2004 Apr 27
3
Mixed Effects Models in S and S-Plus book
Anybody know where I can get the Pinheiro/Bates book?
I can't find a bookstore w/ stock and the publisher
says they don't know when they'll have it again.
Thanks.
-Frank
2017 Jun 29
3
Help : glm p-values for a factor predictor
Hello,
i am a newby on R and i am trying to make a backward selection on a
binomial-logit glm on a large dataset (69000 lines for 145 predictors).
After 3 days working, the stepAIC function did not terminate. I do not
know if that is normal but i would like to try computing a "homemade"
backward with a repeated glm ; at each step, the predictor with the max
pvalue would be
2004 Jul 24
3
Population simulation.
Hello,
can anyone tell me if R has any special function for simulating the structure
of human populations? Something like the genetic algorithm?
I need to simulate a sample of a population with a specific structure. Is
there something on R that can help me?
Thanks to everyone.
__________________________________________________________
A log on Bayesian statistics, stochastic cost frontier, montecarl o markov chains, bayesian P-values
2004 Feb 17
0
A log on Bayesian statistics, stochastic cost frontier, montecarl o markov chains, bayesian P-values
Dear friends,
Over the past weeks, I have been asking a lot of questions about how to
use R in Bayesian analysis. I am brand new to R, but I am very pleased with
it. I started with winbugs but I found winbugs to be a limited software, not
bad but has several limitations. By contrast, R allows the analyst to tackle
any problem with a huge set of tools for any kind of analysis. I love R. In