search for: w2

Displaying 20 results from an estimated 309 matches for "w2".

Did you mean: w2k
2013 Jan 09
2
Using objects within functions in formulas
...the following example will illustrate: library(lme4) y1 = rnorm(10) x1 = data.frame(x11=rnorm(10), x12=rnorm(10), x13=rnorm(10)) x1 = data.matrix(x1) w1 = data.frame(w11=sample(1:3,10, replace=TRUE), w12=sample(1:3,10, replace=TRUE), w13=sample(1:3,10, replace=TRUE)) test1 <- function(x2, y2, w2) { print(str(w2)) form = as.formula(paste("y2 ~ x2 +" ,paste("(1|w2$", names(w2), ")", collapse=" + ", sep=""))) m1 = glmer(form) return(m1) } model1 = test1(x2=x1, y2=y1, w2=w1) As can be seen from the print statement within the function, th...
2024 Aug 06
1
[PATCH] Add SM3 secure hash algorithm
...50f3b, 0x29ea1e76, 0x53d43cec, + 0xa7a879d8, 0x4f50f3b1, 0x9ea1e762, 0x3d43cec5 +}; + +/* + * Transform the message X which consists of 16 32-bit-words. See + * GM/T 004-2012 for details. + */ +#define ROTL(x, n) ((x << n) | (x >> (32 - n))) +#define R(i, a, b, c, d, e, f, g, h, t, w1, w2) \ + do { \ + ss1 = ROTL((ROTL((a), 12) + (e) + (t)), 7); \ + ss2 = ss1 ^ ROTL((a), 12); \ + d += FF_ ## i(a, b, c) + ss2 + ((w1) ^ (w2)); \ + h += GG_ ## i(e, f, g) + ss1 + (w1); \ + b = ROTL((b), 9); \ + f = ROTL((f), 19); \ + h = P0((h)); \ + } while (0) + +#...
2024 Aug 07
1
[PATCH] Add SM3 secure hash algorithm
...9d8, 0x4f50f3b1, 0x9ea1e762, 0x3d43cec5 > +}; > + > +/* > + * Transform the message X which consists of 16 32-bit-words. See > + * GM/T 004-2012 for details. > + */ > +#define ROTL(x, n) ((x << n) | (x >> (32 - n))) > +#define R(i, a, b, c, d, e, f, g, h, t, w1, w2) \ > + do { \ > + ss1 = ROTL((ROTL((a), 12) + (e) + (t)), 7); \ > + ss2 = ss1 ^ ROTL((a), 12); \ > + d += FF_ ## i(a, b, c) + ss2 + ((w1) ^ (w2)); \ > + h += GG_ ## i(e, f, g) + ss1 + (w1); \ > + b = ROTL((b), 9); \ > + f = ROTL((f), 19); \ > +...
2006 Aug 24
0
[Rd] reshape scaling with large numbers of times/rows
...gl(m*n, 1), Y = gl(m, n), Z = letters[1:25]) > > > > Zn <- as.numeric(DF$Z) > > > > system.time(w1 <- reshape(DF, timevar = "X", idvar = "Y", dir = "wide")) > > > > system.time({Zn <- as.numeric(DF$Z) > > > > w2 <- xtabs(Zn ~ Y + X, DF) > > > > w2[w2 > 0] <- levels(DF$Z)[w2] > > > > w2[w2 == 0] <- NA > > > > }) > > > > > > This is pretty slick, thanks. It looks like it works for me. For the > > > archives, this is how I got...
2020 May 05
2
"Earlyclobber" but for a subset of the inputs
...p NN and > widen-op WN, you model exactly what you want. > > What am I missing? > we are using different opcodes for widen-op NN and widen-op WN. My understanding is that not setting earlyclobber to the W, N variant would allow the RegAlloc to do an allocation like this W1 = widen-op W2, N3 but this is not correct in that target because W1 and N3 are of different kind and W1 (being the group of registers N2, N3) overlaps N3. If I understand earlyclobber semantics correctly, earlyclobber would allocate the destination to something that doesn't overlap W2 and also doesn't...
2009 Sep 24
1
unexpected behavior of `[<-` method for class unit.arithmetic
Dear list, Consider the following, library(grid) w = unit.c(unit(1, "in"), unit(2, "in")) w2 = w + unit(1, "mm") w[2] <- 0 w2[2] <- 0 convertUnit(w, "mm") #[1] 25.4mm 0mm convertUnit(w2, "mm") #Error in grid.Call("L_convert", x, as.integer(whatfrom), as.integer(whatto), : # INTEGER() can only be applied to a 'integer', not a 'NU...
2015 Feb 19
2
[LLVMdev] ScheduleDAGInstrs computes deps using IR Values that may be invalid
...4 and BB#15 into BB#16. It's clear that there are 4 common instructions (marked with an *) in BB#14 and BB#15: -------------------------------------------------------------------------------- BB#14: derived from LLVM BB %if.end.1 Live Ins: %X16 %X17 %X18 %X7 %X0 %X6 %X4 %W8 %X15 %X14 %W3 %W2 %X1 %X10 %X11 %X12 %X13 %X9 Predecessors according to CFG: BB#12 %X5<def> = ADDXrr %X16, %X13 * %W19<def> = LDRBBui %X5, 1; mem:LD1[%scevgep95](tbaa=<0x6e02518>) * %W3<def> = MADDWrrr %W2<kill>, %W3<kill>, %WZR * %W2<def> = SUB...
2007 Aug 31
2
memory.size help
...gram I have been writing. It always it cannot allocate a vector of a certain size. I believe the error comes in the code fragement below where I have multiple arrays that could be taking up space. Does anyone know a good way around this? w1 <- outer(xk$xk1, data[,x1], function(y,z) abs(z-y)) w2 <- outer(xk$xk2, data[,x2], function(y,z) abs(z-y)) w1[w1 > d1] <- NA w2[w2 > d2] <- NA i1 <- ifelse(!is.na(w1),yvals[col(w1)],NA) i2 <- ifelse(!is.na(w2),yvals[col(w2)],NA) zk <- numeric(nrow(xk)) #DEFININING AN EMPTY VECTOR TO HOLD ZK VALUES for(x in 1:nrow(xk)) { k...
2010 Oct 13
4
loop
Dear all, I am trying to run a loop in my codes, but the software returns an error: "subscript out of bounds" I dont understand exactly why this is happenning. My codes are the following: rm(list=ls()) #remove almost everything in the memory set.seed(180185) nsim <- 10 mresultx <- matrix(-99, nrow=1000, ncol=nsim) mresultb <- matrix(-99, nrow=1000, ncol=nsim) N
2002 Jan 28
6
Almost a GAM?
...question the other day with the wrong subject heading and couple typos, with no response. So, here I go again, having made those corrections. I would like to estimate, for lack of a better description, a partially additive non-parametric model with the following structure: z~ f(x,y):w1 + g(x,y):w2 + e In other words, I'd like to estimate the marginals with respect to w1 and w2 as nonparametric functions of x and y. I'm not positive, but I think I recall being able to estimate a model like this using Splus gam function a couple years ago (I no longer have Splus). Although, I...
2008 Jun 25
2
Is this sapply behaviour normal?
...tr(dats) List of 5 $ log20:'data.frame': 83 obs. of 5 variables: ..$ DATE : int [1:83] 2001081500 2001081512 2001081600 2001081612 2001081700 2001081712 2001081800 2001081812 2001081900 2001081912 ... ..$ logrho: num [1:83] 1.16 -1.30 -1.30 -1.30 -1.30 ... ..$ w2 : num [1:83] 1.01 1.27 1.24 1.31 1.28 ... ..$ rms : num [1:83] 5.001 0.630 0.616 0.685 0.655 ... ..$ maxi : num [1:83] 8.66 3.39 3.83 3.35 3.23 ... $ log30:'data.frame': 71 obs. of 5 variables: ..$ DATE : int [1:71] 2001081500 2001081512 2001081600 2001081612...
2008 Apr 05
2
How to improve the "OPTIM" results
...a theta0= c(log(2),0,c(0,-.3,.3),log(c(10,.05,.05))) # initial value(In fact, true parameter value) n = length(x) fr2 = function(theta) { a1 = theta[1]; a2 = theta[2] mu1 = theta[3]; mu2 = theta[4]; mu3 = theta[5] g1 = theta[6]; g2 = theta[7]; g3 = theta[8] w1=exp(a1)/(1+exp(a1)+exp(a2)) w2=exp(a2)/(1+exp(a1)+exp(a2)) w3=1-w1-w2 obj =((w1^2)/(2*sqrt(exp(g1)*pi)) + (w2^2)/(2*sqrt(exp(g2)*pi)) + (w3^2)/(2*sqrt(exp(g2)*pi)) + 2*w1*w2*dnorm((mu1-mu2)/sqrt(exp(g1)+exp(g2)))/sqrt(exp(g1)+exp(g2)) + 2*w1*w3*dnorm((mu1-mu3)/sqrt(exp(g1)+exp(g3)))/sqrt(exp...
2008 Apr 05
2
How to improve the "OPTIM" results
...a theta0= c(log(2),0,c(0,-.3,.3),log(c(10,.05,.05))) # initial value(In fact, true parameter value) n = length(x) fr2 = function(theta) { a1 = theta[1]; a2 = theta[2] mu1 = theta[3]; mu2 = theta[4]; mu3 = theta[5] g1 = theta[6]; g2 = theta[7]; g3 = theta[8] w1=exp(a1)/(1+exp(a1)+exp(a2)) w2=exp(a2)/(1+exp(a1)+exp(a2)) w3=1-w1-w2 obj =((w1^2)/(2*sqrt(exp(g1)*pi)) + (w2^2)/(2*sqrt(exp(g2)*pi)) + (w3^2)/(2*sqrt(exp(g2)*pi)) + 2*w1*w2*dnorm((mu1-mu2)/sqrt(exp(g1)+exp(g2)))/sqrt(exp(g1)+exp(g2)) + 2*w1*w3*dnorm((mu1-mu3)/sqrt(exp(g1)+exp(g3)))/sqrt(exp...
2008 Jan 29
2
Using Predict and GLM
...on using predict with GLM. However, while my issue is similar to previous posts (cannot get it to predict using new data), none of the suggested fixes are working. The important bits of my code: set.seed(644) n0=200 #number of observations W1=rnorm(n0,mean=2,sd=2) #Use rnorm to generate W1 W2=rnorm(n0,mean=3,sd=8) #Use rnorm to generate W1 Aprob=matrix(.2, nrow=n0, ncol=1) #generating the probability of A #generating probability of A dependant on W1 for(i in 1:n0){ if (W1[i]>1.5) {Aprob[i]=0.4} } A=matrix(rbinom(n0, 1, Aprob), nrow=n0, ncol=1) #generating the 0/1 exposure Yprob=1/(...
2008 Mar 22
1
Simulating Conditional Distributions
Dear R-Help List, I'm trying to simulate data from a conditional distribution, and haven't been able to modify my existing code to do so. I searched the archives, but didn't find any previous post that matched my question. n=10000 pop = data.frame(W1 = rbinom(n, 1, .2), W2 = runif(n, min = 3, max = 8), W3 = rnorm(n, mean=0, sd=2)) pop = transform(pop, A = rbinom(n, 1, .5)) pop = transform(pop, Y = rbinom(n, 1, 1/(1+exp(-(1.5*A-.05*W1-2*W2-2*W3+2*A*W1))))) In this population the probability of being "diseased" (Y=1) is approx 0.030. What I want to...
2009 Sep 03
0
wireframe - different axes on each panel
...ating my plot. Assistance is greatly appreciated. Kim # code to generate the data set, runs quickly n<-c(2,5,10) p<-2 lims<-c(4.5,2.5,2) dat<-NULL for (j in 1:length(n)) { f2<-NULL f1<-NULL i1<-seq(from=-lims[j],to=lims[j],by=0.1) W<-as.matrix(expand.grid(w1=i1,w2=i1)) for (i in 1:nrow(W)) { wtw<-t(W[i,])%*%W[i,] psi<-(1+W[i,1]^2)/((1+wtw)^((p-1)/2)) f1i<-gamma((n[j]+1)/2)/(pi^(p/2)*gamma((n[j]+1-p)/2)*(1+wtw)^((n[j]+1)/2)) f2<-c(f2,f1i/psi) f1<-c(f1,f1i) } dat<-rbind(dat,cbind(W,f1,rep("h1",nrow(W)),rep(...
1997 Jul 18
0
Samba 1.9.16pl11: dropping connections between Solaris 2.5.1 and WinNT4SP3
...separately. This drastically diminishes the utility of samba. The relevant samba.log file fragment is below. Christopher Dutchyn cdutchyn@aec.ca AECWest SA <last successful file open for write> switch message SMBopenX (pid 2206) Skipping become_user - already user unix_clean_name [./w2/Install/Fixes/ASP.DLL] reduce_name [w2/Install/Fixes/ASP.DLL] [/export/LogArch] chdir to w2/Install/Fixes chdir to /export/LogArch reduced to w2/Install/Fixes/ASP.DLL calling open_file with flags=0x1 flags2=0x300 mode=0664 Allocated new file_fd_struct 0, dev = ffffffff, inode = ffffffff 07/1...
2012 May 29
2
Wilcoxon-Mann-Whitney U value: outcomes from different stat packages
...for first sample sum.rank.a <- sum(rank(c(a,b))[1:29]) #sum of ranks assigned to the group a W1<- sum.rank.a - (length(a)*(length(a)+1)) / 2 W1 U1 <- length(a)*length(b)/2-W1 U1 #sum of ranks for second sample sum.rank.b <-sum(rank(c(a,b))[30:58]) #sum of ranks assigned to the group b W2 <- sum.rank.b - (length(b)*(length(b)+1)) / 2 W2 U2 <- length(a)*length(b)/2-W2 U2 #end code And given the fact that: - in the note of R Wilcox.test is clearly stated: ? The literature is not unanimous about the definitions of the Wilcoxon rank sum and Mann-Whitney tests. The two most co...
2002 Jan 30
1
Hi,
Hi, Sorry for the confusion. I would like to estimate a model wherein the marginals of z with respect to w1 and w2 are smooth functions of x and y. I have data on z, x, y, w1 and w2. so E[dz/dw1] = f(x,y) and E[dz/dw2] = g(x,y) and I would like to estimate f(x,y) and g(x,y) I suppose I could try to fit something more general using projection pursuit, but the nature of the problem suggests the above struc...
2012 Nov 28
1
Help setting optimization problem to include more constraints
...ation 1; 200 from point 2 to destination 2 and so on, and the cost of this distribution plan is $1150. However, I would like to add the following two constraints: # 1. weighted sums by column # w is a vector of known constants, i.e., w = c(1.2, .9, .7, 2.3) # r is also known, i.e., r = 4 w1*x11 + w2*x21 + w3*x21 + w4*x41 == r # col 1 w1*x12 + w2*x22 + w3*x32 + w4*x42 == r # col 2 w1*x13 + w2*x23 + w3*x33 + w4*x43 == r # col 3 # 2. By column, the number of X's greater than zero should be two or greater. In this small example, this condition is satisfied, but I would like to...