search for: n2

Displaying 20 results from an estimated 658 matches for "n2".

Did you mean: nb2
2017 Jan 24
3
Convertir programa Matlab a R sacado de Threshold Models of Collective Behavior de Michèle Lai & Yann Poltera
...rcises: Modelling and simulating social systems with matlab. Tech. rep., Swiss Federal Institute of Technology (December 2009). 27. Ahora estoy convirtiendo la siguiente funcin: function sizes = gridsizes(N,varargin) % gridsizes(N) calculates the best factorization of N into two integers N1 and % N2 such that : N1xN2 == N and N2-N1 -> min (optimal grid) % gridsizes(N,C1,C2) calculates the best factorization of N into two integers N1 and % N2 such that : N1xN2 == N and N2-N1 -> min, under the condition that N1 % divides C1 and N2 divides C2 (optimal subgrids for an already existing % grid...
2012 Dec 04
1
Solve system of equations (nleqslv) only returns origin
...require(nleqslv) ###### Global Parameters ############ beeta=0.8 pq=10000 L=12600 theta=0.6 psale=0.6 mu=psale*(1-theta) alphah=0.15 Cg=6240 Cs=2820 A= 100 D=0.0001 greekp=0.43 K=100000 ##### Species Parameters ########## b1=0.38 p1=16654 v1 = 0.28 N1=6000 g1=1 delta1=1 b2=0.4 p2=2797 v2 = 0.31 N2=10000 g2=1 delta2=1 ### Define functions with vector x = c(Lg, Ls, gamma1, gamma2, lamda) firstordercond <- function (x) { y=numeric(4) y[1]=(alphah/x[3])-(x[5]*((p1-(((theta+mu)*(((N1/A)*g1^greekp*x[1]^b1)+K))+((theta+mu)*(((1-exp(-2*D*v1*N1))*x[2])+K))))*(((N1/A)*g1^(greekp))*x[1]^b1+...
2004 Oct 01
3
same test statistic for t-test with and without equal variance assumption
...SE in t.test ? set.seed(1066) x1 <- rnorm(50) x2 <- rnorm(50) t.test(x1, x2, var.equal=FALSE)$statistic # 0.5989774 t.test(x1, x2, var.equal=TRUE)$statistic # 0.5989774 ??? Here are my own calculations that shows that perhaps the result when var.equal=TRUE is wrong. n1 <- length(x1); n2 <- length(x2) m1 <- mean(x1) ; m2 <- mean(x2) ; num <- (m1 - m2) v1 <- var(x1) ; v2 <- var(x2) # t-test with UNequal variance denom1 <- sqrt( v1/n1 + v2/n2 ) num / denom1 # gives 0.5989774 # t-test with equal variance sp <- ( (n1-1)*v1 + (n2-1)*v2 )/(n1 + n2 - 2)...
2013 Jan 03
0
help with NLOPTR
...aic) ###### Global Parameters ############ beeta=0.8 pq=10000 pf=10000 F=20 L=12600 theta=0.6 psale=0.6 mu=psale*(1-theta) alphah=0.15 Cg=6240 Cs=2820 A= 100 D=0.0001 greekp=0.43 K=100000 ##### Species Parameters########## b1=0.38 p1=16654 v1 = 0.28 N1=6000 g1=1 delta1=1 b2=0.4 p2=2797 v2 = 0.31 N2=10000 g2=1 delta2=1 ####################################### Objective function ############################################ eval_f = function (x) { return(-1 * ( ( (1-alphah) *log(F) ) + ( alphah* ( (x[1]*(((N1/A)*(g1^greekp)*(x[3]^b1))+((1-exp(-2*D*v1*N1))*x[4]))) + (x[2]*(((N2/A)*(g2^g...
2010 Jul 24
1
Doubt about a population competition function
Hi, I'm doing a function that describe two populations in competition. that's the function that i wrote: exclusao<-function(n10, n20, k1, k2, alfa, beta, t){ n1<-k1-(alfa*n20) n2<-k2-(beta*n10) if(t==0){plot(t, n10, type='b', xlim=range(c(1:t),c (1:t)), ylim=range(n10, n20), xlab='tempo', ylab='tamanho populacional') points(t, n20, type='b', col="red") points(t,n10,type="b...
2003 Mar 04
4
writing several command line in R console
...ode more clearly : if for example I write a function, so far i have to write the all code inside on the same line wich may become obscure as the function is more and more complex. I would like to do like in the example of the manuels: >twosam <- function(y1, y2) { n1 <- length(y1); n2 <- length(y2) yb1 <- mean(y1); yb2 <- mean(y2) s1 <- var(y1); s2 <- var(y2) s <- ((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2) tst <- (yb1 - yb2)/sqrt(s2*(1/n1 + 1/n2)) tst } all I can do is something like that: >twosam <- function(y1, y2) { n1 <-...
2007 Oct 29
3
using survfit
hie when i use plot.survfit to plot more than one graph why I only see the last graph how do i see the other graphs.for example n=20 n1=n/2 n2=n/4 a11=4;a12=4 ;a21=4 ;a22=4 t1<-array(1,c(n1)) t2<-array(2,c(n1)) treatgrp=matrix(c(t1,t2)) st11<-array(1,c(n2)) st12<-array(2,c(n2)) st21<-array(1,c(n2))...
2007 Oct 18
1
programming question
hie i'm tryimg to generate two survival data using the following code (I know its ugly ) but it seems to repeat two of the variables can any one tell me whats the porblem. n=20 n1=n/2 n2=n/4 a11=1 ;a12=1.4 ;a21=16 ;a22=a12 * a21 t1<-array(1,c(n1)) t2<-array(2,c(n1)) treatgrp=matrix(c(t1,t2)) st11<-array(1,c(n2)) st12<-array(2,c(n2)) st21<-arra...
2003 Nov 24
1
[PATCH] library functions
...a/klibc/strcasecmp.c b/klibc/strcasecmp.c --- /dev/null Wed Dec 31 16:00:00 1969 +++ b/klibc/strcasecmp.c Mon Nov 24 11:33:52 2003 @@ -0,0 +1,25 @@ +/* + * strcasecmp.c + * + */ + +#include <string.h> +#include <ctype.h> + +int strcasecmp(const char *s1, const char *s2) +{ + char *n1, *n2; + int i, retval; + + n1 = strdup(s1); + n2 = strdup(s2); + + for (i = 0; i < strlen(n1); i++) + n1[i] = toupper(n1[i]); + for (i = 0; i < strlen(n2); i++) + n2[i] = toupper(n2[i]); + retval = strcmp(n1, n2); + free(n1); + free(n2); + return retval; +} diff -Nru a/klibc/strncasecmp.c b/klib...
2010 Jun 07
0
No subject
void inverse_mdct_slow(float *buffer, int n) { =A0=A0 int i,j; =A0=A0 int n2 =3D n >> 1; =A0=A0 float *x =3D (float *) malloc(sizeof(*x) * n2); =A0=A0 memcpy(x, buffer, sizeof(*x) * n2); =A0=A0 for (i=3D0; i < n; ++i) { =A0=A0=A0=A0=A0 float acc =3D 0; =A0=A0=A0=A0=A0 for (j=3D0; j < n2; ++j) =A0=A0=A0=A0=A0=A0=A0=A0 // formula from paper: =A0=A0=A0=A0=A0=A0=A0=...
2004 Sep 01
0
Re: [S] [R/S] strange solution
Hi, Erin: A cleaner way is to pass "n2" to "outer" as a "..." argument, as in the following modification of your code: boot1 <- function(y,method="f",p=1) { n1 <- length(y) n2 <- n1*p n3 <- n2 - 1 a <- 0.5*(outer(1:n3,1:n3,function(x,y, n2.){n2. - pmax(x,y)}, n2.=n2)) return(a) } y1...
2004 Sep 02
0
Re: [S] [R/S] question re solution
...lp; s-news at wubios.wustl.edu Subject: [R] Re: [S] [R/S] question re solution <see below> Erin Hodgess wrote: >Dear R and S People: > >First, thank you to so many people for your help to my problem. > >Here is the solution: > >a <- 0.5*(outer(1:n3,1:n3,function(x,y,n2.){n2. - pmax(x,y)},n2.=n2)) > >I have one final pesky question, please: >During my experiments, I tried the following: > >a <- 0.5*(outer(1:n3,1:n3,function(x,y,n2.=n2){n2. - pmax(x,y)})) > > In S-Plus, the function "outer" can't find "n2". I...
2010 Jul 05
2
Function to compute the multinomial beta function?
Dear R-users, Is there an R function to compute the multinomial beta function? That is, the normalizing constant that arises in a Dirichlet distribution. For example, with three parameters the beta function is Beta(n1,n2,n2) = Gamma(n1)*Gamma(n2)*Gamma(n3)/Gamma(n1+n2+n3) Thanks in advance for any assisstance. Regards, Greg [[alternative HTML version deleted]]
2009 Mar 20
4
how to make aggregation in R ?
...uot;, "b1", "b1", "b2", "b2", "b2", "c1", "c2", "c2", "c2", "c3", "d1", "d2", "d3", "d4", "d4"), n1 = 1:20, n2 = 21:40 ) testDF <- orderBy( ~ v1+v2, data = testDF) rownames(testDF) <- NULL > testDF v1 v2 n1 n2 1 a a1 1 21 2 a a1 2 22 3 a a1 3 23 4 a a2 4 24 5 a a3 5 25 6 b b1 6 26 7 b b1 7 27 8 b b2 8 28 9 b b2 9 29 10 b b2 10 30 11 c c1 11 31 12 c c2 12 32 13 c...
2011 Feb 19
2
reading simulations
Hi to all the people (again), I'm doing some simulations with the memisc package of an own function, but I've the problem that I didn't know how to read the result of such simulations. My function is: > Torre<-function(a1,N1,a2,N2) + {Etorre<-(a1*N1)/(1+a1*N1) + Efuera<-(a2*N2)/(1+a2*N2) + if(Etorre>Efuera)Subir=TRUE + if (Etorre<Efuera)Subir=FALSE + result<-list(Subir) + return(result) + } > Torre<-Simulate(Torre(a1,N1,a2,N2),expand.grid(a1=3,N1=0.5,a2=c(0.01,0.02,0.05,0.1),N2=0.1),nsim=1000,seed=10000...
2012 May 20
2
Remus network buffering problem
Hi all, I have a following problem: - Remus network buffering doesn''t work. It seems to be because of no vif is reported by the function server.xend.domain on line 29 of /usr/local/lib/python2.7/dist-packages/xen/remus/vm.py (seen using pdb) : 27 if domid: 28 try: 29 self.dominfo = server.xend.domain(domid, ''all'') > /usr/local/lib/python2.7/dist-packages/xen/remus/vm.py(36)__init__() -> if self.dominfo: (Pdb) print self.domi...
2005 Jul 15
4
Can't get sample function from "An Introduction to R" to work
...R's response when I hit the return key after the penultimate line. I've re-checked and re-typed the code many times to no avail. I wasn't able to find this issue using search options, either. Any help is GREATLY appreciated! > twosam<-function(y1, y2) { + n1<-length(y1);n2 <-length(y2) + yb1<-mean(y1); yb2<-mean(y2) + s1<-var(y1);s2<-var(y2) + s<-((n1-1)*s1 + (n2-1)*s2)/(n1+n2-2) + tst<-(yb1-yb2)/sqrt(s*(1/n1+1/n2)) Error: syntax error David [[alternative text/enriched version deleted]]
2017 Jun 06
2
integrating 2 lists and a data frame in R
> On Jun 6, 2017, at 4:01 AM, Jim Lemon <drjimlemon at gmail.com> wrote: > > Hi Bogdan, > Kinda messy, but: > > N <- data.frame(N=c("n1","n2","n3","n4")) > M <- data.frame(M=c("m1","m2","m3","m4","m5")) > C <- data.frame(n=c("n1","n2","n3"), m=c("m1","m1","m3"), I=c(100,300,400)) > MN<-...
2017 Jun 06
4
integrating 2 lists and a data frame in R
Dear Bert, thank you for your response. here it is the piece of R code : given 3 data frames below --- N <- data.frame(N=c("n1","n2","n3","n4")) M <- data.frame(M=c("m1","m2","m3","m4","m5")) C <- data.frame(n=c("n1","n2","n3"), m=c("m1","m1","m3"), I=c(100,300,400)) how shall I integra...
1998 Mar 03
1
":" (seq) bug -- should not always coerce to integer!
The problem seems that ":" always coerces to integer, but should not.. 9.9:12 ## R: [1] 9 10 11 ## S-plus 3.4: [1] 9.9 10.9 11.9 ## and many more examples.... -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or