Displaying 20 results from an estimated 3000 matches similar to: "Car.proper C[] matrix"
2008 Dec 15
3
R2winbugs : vectorization
I'm new to bugs, so please bear with me. Can someone tell me if the
following two models are doing the same thing? The reason I ask is
that with the same data, the first (based on 4 separate coeffs
a1--a4) takes about 50 secs, while the second (based on a vectorized
form, a[]) takes about 300. The means are about the same, though
R-hat's in the second version are quite a bit better.
2012 Dec 04
1
Winbugs from R
Hi,
I am trying to covert a Winbugs code into R code. Here is the winbugs code
model{# model’s likelihoodfor (i in 1:n){time[i] ~ dnorm( mu[i], tau ) # stochastic componenent# link and linear predictormu[i] <- beta0 + beta1 * cases[i] + beta2 * distance[i]}# prior distributionstau ~ dgamma( 0.01, 0.01 )beta0 ~ dnorm( 0.0, 1.0E-4)beta1 ~ dnorm( 0.0, 1.0E-4)beta2 ~ dnorm( 0.0, 1.0E-4)#
2007 Dec 12
2
problem applying a conditional formula to each element of a matrix
I'm applying a function (Cov.f) defined below to each element of a
distance matrix. When I run the code below, I get a warning message
(below) and elements of returned matrix [2,3] and [3,2] are not zero
as I would expect. Clearly, there is an error... What am I doing
wrong? Thanks. --Dale
Warning message:
In if (h <= phi) { :
the condition has length > 1 and only the first element
2009 Jul 20
2
HELP: BRUGS/WinBUGS/RBUGS Response is a combination of random variables
Hi,
Is there anyone know if BUGS language allows the combination of variables as response
such as
Y[i] <- a*X1[i]+b*X2[i]
Y[i] ~ dnorm(c,d)
It seems doesn't work in my model. The problem is between two ######.
The error message is
> modelCheck("BayesBioMarker.BUGS")
model is syntactically correct
> modelData(paste("BUGS_data.txt",sep=""))
data
2006 Oct 09
1
winbugs - R question
hi all
i would like to use r and winbugs in order to undertake seemingly unrelated regression. i am using the R2WINBUGS library. i just simulated a simple example (sample size is 25) in order to get the correct code.
i suspect that the problem is in my definition of the prior. it wants a multivariate node.
the example could be extended by including more than 1 X variable in the system of
2010 Oct 15
1
Problem using BRugs
Hi R users,
I am trying to call openbugs from R. And I got the following error message:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
model is syntactically correct
expected the collection operator c error pos 8 (error on line 1)
variable ww is not defined in model or in data set
[1] "C:\\DOCUME~1\\maomao\\LOCALS~1\\Temp\\RtmpqJk9R3/inits1.txt"
1999 Jun 09
1
smbtar cannot recognize space character in filename
Hi. My friend has a problem that smbtar cannot recognize space character
in specified filenames. He tried to execute following command line
to back file "long file name" up:
$ smbtar -s SERVER -p PASSWORD -x SHARE -u username -t /tmp/backup.tar \
"long file name"
but smbtar tried to include three files as 'long', 'file' and 'name'. :-(
Here is the
1999 Aug 05
1
pairwise scatterplot matrix
Dear Friends:
I like so much to work with R program. Congratulations for your work.
I need R for work with multivariate data.
My question is:
With the pairs(X) command my output is a pairwise scatterplot symmetric matrix. Like:
| X1 |X1 vs X2|X1 vs X3|X1 vs X4|
|X2 vs X1| X2 |X2 vs X3|X2 vs X4|
|X3 vs X1|X3 vs X2| X3 |X3 vs X4|
|X4 vs X1|X4 vs X2|X4 vs X3| X4 |
It is
2010 Mar 05
3
How to match vector with a list ?
Dear list,
I have a vector of characters and a list of two named elements :
i <- c("a","a","b","b","b","c","c","d")
j <- list(j1 = c("a","c"), j2 = c("b","d"))
I'm looking for a fast way to obtain a vector with names, as follows :
[1] "j1" "j1"
2008 Dec 09
2
Need help optimizing/vectorizing nested loops
Hi,
I'm analyzing a large number of large simulation datasets, and I've
isolated one of the bottlenecks. Any help in speeding it up would be
appreciated.
`dat` is a dataframe of samples from a regular grid. The first two
columns are the spatial coordinates of the samples, the remaining 20
columns are the abundances of species in each cell. I need to calculate
the species richness in
2013 Apr 16
1
Spatial Ananlysis: zero.policy=TRUE doesn't work for no neighbour regions??
Hello,
I'm new to R and to Spatial Analysis and got a problem trying to create a
Spatial Weights Matrix.
*I us the following code to create the Neighbourslist:*
>library(maptools)
>library(spdep)
>library(rgdal)
>location_County<- readShapePoly("....")
>proj4string(location_County)<- CRS("+proj=longlat ellps=WGS84")
>location_nbq<-
2004 Nov 04
3
keep dimension of a sub matrix
Hi,
is there any way to keep a sub matrix dimension?
exemple :
i1<-1; i2<-1
j1<-2; j2<-3;
ret <-matrix(1,4,4)[i1:i2,j1:j2] ;
dim(ret) is NULL because the submatrix single col or single row is coerce to a vector automaticaly.
How can i bypass this cast : submatrix->vector ???????
Thank you.
---------------------------------
[[alternative HTML version
2006 Oct 03
2
strverscmp, scandir, alphasort and versionsort
Hello,
These are implementations of strverscmp, scandir, alphasort and
versionsort, and some test cases for them.
I know these aren't in POSIX, but they're useful, nonetheless, and
someone else might be interested in them.
Regards,
Luciano Rocha
--
lfr
0/0
-------------- next part --------------
/* ----------------------------------------------------------------------- *
*
*
2006 Nov 22
1
how to merge these dataframes
Hi,
Having 3 dataframes with different row numbers, but equal column names
(see below) I want to merge them by Var1 so I've tried:
merge(j1,j2,j3,by="Var1")
merge(j,j1,j2,by=names("Var1"))
But always got the same message:
Erro en fix.by(by.x, x) : 'by' must specify column(s) as numbers, names
or logical
What I'm doing wrong?
Thanks,
Antonio
j1
2007 Mar 09
1
Applying some equations over all unique combinations of 4 variables
#I have a data set that looks like this. A bit more
complicated actually with
# three factor levels but these calculations need to
be done on one factor at a
#I then have a set of different rates that are applied
#to it.
#dataset
cata <- c( 1,1,6,1,1,2)
catb <- c( 1,2,3,4,5,6)
doga <- c(3,5,3,6,4, 0)
data1 <- data.frame(cata, catb, doga)
rm(cata,catb,doga)
data1
# start rates
#
2002 Feb 22
3
Cent. Mov. Ave
Dear R People:
Here is an interesting question(I think)
Suppose I want to calculate Centered Moving Averages; i.e.
x[1] <- ( sum(y[1:12]) )/12
x[2] <- ( sum(y[2:13]) )/12
and so on.
Of course, this is easily done through loops. However, I have
been trying to do this more elegantly, but have failed. I have
tried things like
j1 <- 1:109
j2 <- 12:120
x[1:109] <- ( sum( y[j1:j2])
2012 Jun 20
1
nearest neighbours and their ID
Dear R users,
I used nndist() to gain the distance of 2 nearest
neighbours of the points in my dataset. Is there a way of getting the ID numbers
of these nearest neighbours (along with their distances).
The command I used: nn2 <- nndist(X2, k=1:2). This is the output of the nearest neighbour distances I got (the IDs of the given points are there but their IDs aren't). Any help or
1999 Jun 04
2
Does mksmbpasswd.sh have any real purpose?
I see that mksmbpasswd.sh (plus a little editing) would
be a good way to set up users with "NO PASSWORD"
in bulk.
But suppose I don't want the risk of the "NO PASSWORD"
approach. Now somebody with root access must run
smbpasswd for each user they want to activate. But can't
I just do this anyway (with the -a 'add user' option), without
ever having run
2006 Jun 07
2
help with combination problem
hello:
I have 3 data.frame objects.
First df object:
Of dim (149,31). Columns 2:31 are marked as T1..T14
and N1..N16.
Name T1 T2 N1 T3 N2 N3 N4 T4
mu1 10 10 9 10 9 9 8 10
mu2 11 11 9 11 9 9 9 11
...
muN 12 12 9 11 9 9 8 12
Second df object:
of Dim (50000,31). Columns 2:31 are maked as T1...T14
and N1..N16.
2003 Jun 30
2
spatial correlation test
hello,
I want to do a test for spatial correlation.
I tried it with geary.test() but I don't understand the required input.
x= a numeric vector the same length as the neighbours list in listw (my
sampled data, I assume)
listw= a listw object created for example by nb2listw (well when I check
nb2listw() I get to "neighbours - an object of class nb" - but I couldn't
figure