Displaying 17 results from an estimated 17 matches for "sim2".
Did you mean:
sim
2007 Jul 14
3
How to read many files at one time?
I want to load many files in the R. The names of the files are "Sim1.txt", "
Sim2.txt", "Sim3.txt", "Sim4.txt", "Sim5.txt" and so on.
Can I read them at one time? What should I do? I can give the same names in
R.
Thanks.
For example:
> tst=paste("Sim",1:20,".txt",sep="") # the file names
> tst
[1] "Sim...
2010 Dec 26
4
how to replace my double for loop which is little efficient!
...: is a matrix 202*263, that is 202 samples, and 263 independent variables
num.compd<-nrow(x); # number of compounds
diss.all<-0
for( i in 1:num.compd)
for (j in 1:num.compd)
if (i!=j) {
S1<-sum(x[i,]*x[j,])
S2<-sum(x[i,]^2)
S3<-sum(x[j,]^2)
sim2<-S1/(S2+S3-S1)
diss2<-1-sim2
diss.all<-diss.all+diss2}
it will cost a long time to finish this computation! i really need "rapid"
code to replace my code.
thanks
kevin
--
View this message in context: http://r.789695.n4.nabble.com/how-to-replace-my-double-fo...
2008 Jul 23
1
Questions on weighted least squares
...en use the "lm" function without "weights". But the two methods yield different results.
Would someone tell me which one is the correct way to do? Thanks in advance, and the code and output are as follows:
> b1=474186/425906
> n=240
> sim1=rnorm(n,425906,40000)
> sim2=matrix(0,n,1)
> for (i in 1:(n)){
+ sim2[i]=rnorm(1,sim1[i]*b1,sqrt(sim1[i])*50)
+ }
> fit1=lm(sim2~-1+sim1,weights=sqrt(sim1)*50)
> coef(fit1)
sim1
1.116028
> y=sim2/(sqrt(sim1)*50)
> x=sim1/(sqrt(sim1)*50)
> fit2=lm(y~-1+x)
> coef(fit2)
x
1.116273
Sincerely,
Yanw...
2012 Mar 16
2
Elegant Code
...help to write a more elegant version of my code? I am sure
this can be put into a loop but I am having trouble creating the
objects b1,b2,b3,...,etc.
b1 <- rigamma(50,1,1)
theta1 <- rgamma(50,0.5,(1/b1))
sim1 <- rpois(50,theta1)
b2 <- rigamma(50,1,1)
theta2 <- rgamma(50,0.5,(1/b2))
sim2 <- rpois(50,theta2)
b3 <- rigamma(50,1,1)
theta3 <- rgamma(50,0.5,(1/b3))
sim3 <- rpois(50,theta3)
b4 <- rigamma(50,1,1)
theta4 <- rgamma(50,0.5,(1/b4))
sim4 <- rpois(50,theta4)
b5 <- rigamma(50,1,1)
theta5 <- rgamma(50,0.5,(1/b5))
sim5 <- rpois(50,theta5)
par(mf...
2005 Jul 04
2
Lack of independence in anova()
...e observations are normally distributed and the 2xk design is
balanced, theory requires that the tests for interaction and row effects be
independent. In my program, appended below, this would translate to cntT
(approx)= cntR*cntI/N if all R routines were functioning correctly. They
aren't.
sim2=function(size,N,p){
cntR=0
cntC=0
cntI=0
cntT=0
cntP=0
for(i in 1:N){
#generate data
v=gendata(size)
#analyze after build(ing) design containing data
lm.out=lm(yield~c*r,build(size,v))
av.out=anova(lm.out)
#if column effect is significant, increment cntC...
2004 Dec 28
1
R: repeat loops
To whoever this may concern
I am trying to write a repeat loop and can't make out from the documentation on the website how exactly to construct the repeat, break structure of the loop. Below is the function sim2.dat that I am trying to create, in which firstly I create n random uniform(0,1) numbers. From there I assign values to k, P and F. From then on for each random number u[j] of u, I try to set up a repeat loop so that if u[j]>=F I alter P, k, and F and then compare u[j] to F again. I want to stop...
2010 Jan 29
1
FracSim set.seed
...need for
reproducible research. The published docs and google have not yielded an
answer, so any help greatly received.
Thanks,
Selwyn
## Example code snippet
library(FracSim)
## simulate some 1d fractal data
set.seed(1234)
sim1 = fracsim.1d(h=0.5,k=1000,n=5000)
## reset the seed
set.seed(1234)
sim2 = fracsim.1d(h=0.5,k=1000,n=5000)
table(sim1$process == sim2$process) ## not identical...
[[alternative HTML version deleted]]
2015 Feb 27
2
situation with ivr and four-channel gateway
2015-02-27 10:25 GMT-06:00 A J Stiles <asterisk_list at earthshod.co.uk>:
> O.K. So what does your existing Dial() statement in extensions.conf look
> like?
>
apology, put the gateway was sangoma but is a openvox ,
all my outgoing calls out for this context:
[my-mobile-out]
exten => _NXXXXXXX,n,Dial(SIP/1003/${EXTEN},55,rT)
exten =>
2009 Jul 31
1
superpose 2 time series with different time intervals
I could use some advice.
I've got 2 time series. Both cover approximately the same period of
time (ie, 1940 to 2009). But one series has annual data and the other
has monthly data. One refers to university enrollment; the other to
unemployment rates. Both are currently in the same data frame.
I'd like to use the monthly times series as a light grayscale
background for a plot of the
2010 Mar 14
3
the error in DoSimulateRF function
Hello,
I am a graduate student of University of Florida.
I am trying to run a process variation model and I am facing the following
error.
-------------------------------------------------------------
Analysis of geostatistical data
For an Introduction to geoR go to http://www.leg.ufpr.br/geoR
geoR version 1.6-27 (built on 2009-10-15) is now loaded
2015 Mar 02
0
situation with ivr and four-channel gateway
...> channel 2
Ah. *Incoming* calls are not something that is within your control; they have
already been routed onto a line by your telco. So you will need to speak to
someone at your telco about doing this.
As a temporary measure, you could try setting up divert-on-busy so SIM1
diverts to SIM2, SIM2 diverts to SIM3, SIM3 diverts to SIM4 and SIM4 diverts
to SIM1. You can do this with specially-crafted Dial() statements, or by
temporarily inserting the SIMs in an old mobile phone. See your telco's
website for details of setting up call diversion.
--
AJS
Note: Originating addr...
2007 Aug 28
4
Nodes & edges with similarity matrix
Hello,
I apologise if someone has already answered this but I searched and
googled but didn't find anything.
I have a matrix which gives me the similarity of each item to each
other. I would like to turn this matrix into something like what they
have in the graph package with the nodes and edges.
http://cran.r-project.org/doc/packages/graph.pdf . However I cannot find
a method to
2005 Mar 31
2
how to simulate a time series
...))
}
allsim <- as.data.frame(sim)
colnames(allsim) <- paste("sim",1:5,sep="")
all <- cbind(rdtb,allsim)
#--------------------------------
I don't understand why the simulation runs generate virtually identical
values:
> all[100:105,]
rdtb sim1 sim2 sim3 sim4 sim5
100 2.3863636 1.065661 1.065661 1.065661 1.065661 1.065661
101 1.9318182 2.606093 2.606093 2.606093 2.606093 2.606093
102 2.2954545 3.854074 3.854074 3.854074 3.854074 3.854074
103 2.5882353 4.880240 4.880240 4.880240 4.880240 4.880240
104 2.0227273 4.917622 4.917622...
2009 Aug 01
2
xyplot: superpose 2 time series with different time intervals
I could use some advice regarding xyplot.
I've got 2 time series. Both cover approximately the same period of
time (ie, 1940 to 2009). But one series has annual data and the other
has monthly data. One refers to university enrollment; the other to
unemployment rates. Both are currently in the same data frame.
I'd like to use the monthly times series as a light grayscale
background for a
2009 Mar 17
0
(no subject)
...xp",15), nmax = 20)
set.seed(1)
iso <- predict(g.dummy, newdata = xy, nsim = 10)
gridded(iso) = ~x+y
# spplot(iso,main="isotropic") # not essential for this question
# I could make a dataframe like:
diso<-data.frame(iso)
diso[1:4,]
# which results in:
# x y sim1 sim2 sim3 sim4 sim5 sim6
sim7 sim8 sim9 sim10
# 1 1 1 0.4093776 1.0752794 -1.5654566 0.6183240 -2.196812 0.4545051
-0.06372423 -2.1544707 -1.131036 -0.4008869
# 2 2 1 0.8133436 0.9041941 -0.9712924 0.4319641 -2.432893 1.0770354
0.21302299 -1.6938882 -2.065350 -0.5331...
2007 Aug 07
1
R2WinBUGS results not different with different runs
Hi All
I dont know if anyone else has noticed the same thing, but with 2 subsequent
runs of the same syntax, I am getting exactly the same results. I was expecting
that results differ slighlty, say in the 4th or 5th decimal place.
Is this a specialty with R2WinBUGS? Does it have something to do with the seed
value? Isnt the seed value reset everytime I restart winbugs?
Thanks Toby
2012 Jan 24
2
Null models of species co-occurrence
I am currently testing species co-occurrence patterns using null models and
the oecosimu() function within the vegan() package. My issue is that none of
the methods appear to be the ones that I want. The methods listed are r0,
r1, r2, r2dtable, swap, tswap. However, I want to know how to go about
implementing fixed row algorithms, as suggested in Gotelli 2000 in Ecology.
Also, the null models