search for: w1

Displaying 20 results from an estimated 305 matches for "w1".

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
2020 May 04
2
"Earlyclobber" but for a subset of the inputs
Hi all, I'm working on a target whose registers have equal-sized subregisters and all of those subregisters can be named (or the other way round: registers can be grouped into super registers). So for instance we've got 16 registers W (as in wide) W0..W15 and 32 registers N (as in narrow) N0..N31. This way, W0 is made by grouping N0 and N1, W1 is N2 and N3, W2 is N4 and N5, ..., W15 is N30 and N31. The target has some widening instructions that take a number of N registers and output a W register. Possible combinations are Wdest = widen-op Nsrc1,...
2008 Aug 15
1
Strange error message from geoR´s likfit () lik. max. func.
...ith simulated data. Is it a geoR bug? Does anybody know a solution? Thanks in advance Ruben x <- rnorm(50,5,2) # eastings y <- rnorm(50,25,3) # northings z <- rnorm(50,350,35) # data v <- c(rep(1,25),rep(2,25)) # two different areas w <- data.frame(cbind(x,y,z,v)) # put all together w1 <- subset(w,v == 1) # use data fron one area w1.geo <- as.geodata(w1,coords.col=1:2,data.col=3) # create geodata object summary(w1.geo) # everything looks normal #Number of data points: 25 # #Coordinates summary # x y #min 1.233673 15.82129 #max 8.464283 34.30390 # #Distance...
2005 May 13
2
not deleting from the root
I have a bit of an issue with rsync. I am using to keep directories in sync via another server for backup. Here is the server config [w1] path = /w1 comment = w1 web dir [w2] path = /w2 comment = w2 web dir Now on the client i run this command rsync -avv --delete --force domain.com::w1/ /w1/ It will NOT delete anything that is no on the server anymore.. for example on the server/client there is a /w1/apache/test.txt file if i rem...
2008 Jan 29
2
Using Predict and GLM
...s email, as it seemed there were several threads 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=n...
2000 Sep 19
3
coerce mode list?
Dear R/S users; I'm using S+ version 4 Release 3. and I am trying to do a simple calculation like the following : > X1<-X[1:5] > W1<-W[1:5,1:5] > X1 [1] 1.250000 1.292308 1.176471 0.937500 1.538462 > W1 VAR00003 VAR00004 VAR00005 VAR00006 VAR00007 1 0 1 0 1 0 2 1 0 0 0 1 3 0 0 0 0 1 4 1 0 0...
2007 Aug 31
2
memory.size help
...g the 'memory.size' error message when I run a program 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...
2018 Feb 25
3
include
Thank you Jim, I read the data as you suggested but I could not find K1 in col1. rbind(preval,mydat) Col1 Col2 col3 1 <NA> <NA> <NA> 2 X1 <NA> <NA> 3 Y1 <NA> <NA> 4 K2 <NA> <NA> 5 W1 <NA> <NA> 6 Z1 K1 K2 7 Z2 <NA> <NA> 8 Z3 X1 <NA> 9 Z4 Y1 W1 On Sat, Feb 24, 2018 at 6:18 PM, Jim Lemon <drjimlemon at gmail.com> wrote: > hi Val, > Your problem seems to be that the data are read in as a factor. The > simplest way I...
2018 Feb 25
2
include
HI Jim and all, I want to put one more condition. Include col2 and col3 if they are not in col1. Here is the data mydat <- read.table(textConnection("Col1 Col2 col3 K2 X1 NA Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) The desired out put would be Col1 Col2 col3 1 X1 0 0 2 K1 0 0 3 Y1 0 0 4 W1 0 0 6 K2 X1 0 7 Z1 K1 K2 8 Z2 0 0 9 Z3 X1 0 10 Z4 Y1 W1 K2 is already is already in col1 and should...
2009 Feb 03
3
lapply and aggregate function
...new Var "meanLightFeed" # holding the "Group-Mean" for each combination (eg. A:a = 0.821581) # by(myD$value, list(myD$Light, myD$Feed), mean)[[1]] # Second set.seed(321) myD <- data.frame( Light = sample(LETTERS[1:2], 10, replace=T), value=rnorm(20) ) w1 <- tapply(myD$value, myD$Light, mean) w1 # > w1 # A B # 0.4753412 -0.2108387 myfun <- function(x) (myD$value > w1[x] & myD$value < w1[x] * 1.5) I would like to have a TRUE/FALSE-Variable depend on the constraint in "myfun" for each level in "Ligh...
2018 Feb 25
0
include
Hi Val, My fault - I assumed that the NA would be first in the result produced by "unique": mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) val23<-unique(unlist(mydat[,c("Col2","col3")])) napos<-which(is.na(val23)) preval<-data.frame(Col1=val23[-napos], Col2=NA,col3=NA) mydat<-rbind(preval,mydat) mydat[is.na(mydat)]<-"0" mydat Jim On Sun, Feb 2...
2002 Jan 28
6
Almost a GAM?
...I sent this 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)....
2018 Feb 25
0
include
...remk at gmail.com> wrote: >HI Jim and all, > >I want to put one more condition. Include col2 and col3 if they are >not >in col1. > >Here is the data >mydat <- read.table(textConnection("Col1 Col2 col3 >K2 X1 NA >Z1 K1 K2 >Z2 NA NA >Z3 X1 NA >Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) > >The desired out put would be > > Col1 Col2 col3 >1 X1 0 0 >2 K1 0 0 >3 Y1 0 0 >4 W1 0 0 >6 K2 X1 0 >7 Z1 K1 K2 >8 Z2 0 0 >9 Z3 X1 0 >10 Z4...
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 appr...
2018 Feb 25
2
include
...e question on the original question What does this "[-1] " do? preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE) preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) rbind(unique(preval),mydat) Col1 Col2 col3 1 <NA> <NA> <NA> 2 X1 <NA> <NA> 3 Y1 <NA> <NA> 4 K2 &...
2013 Apr 04
5
Help for bootstrapping‏
...WtVec$solution)} #Opt(OriData+1, 1, 5, 0) ##############################set.seed(4114)bs=1000 ###number of bootstrap samplesRegion<-5 ###Region indecies, check above.lamdaseq<-seq(0,1,.05) ###the lamda sequence. currently from 0 to 1 by .05. x<-numeric(bs*length(lamdaseq)) ###w1<-matrix(x, bs, length(lamdaseq)) ###To initialise the matrices.w5<-matrix(x, bs, length(lamdaseq)) ###1, 5, 10 denote the horizon.w10<-matrix(x, bs, length(lamdaseq)) ### for (i in 1: bs){BSData<-GetBSData(OriData)+1j=1 for (lamda in lamdaseq){ w1[i,j]<-Opt(BSData, 1, Region, lamd...
2011 Mar 10
1
getting percentiles by factor
...data.frame(Ret=seq(-2, 2.5, by=0.5),PE=seq(10,19),Sectors=rep(c("Financial","Industrial"),5)) myExample <- na.omit(myExample) Thanks to Patrick I I managed to put together the following lines which does it for the "Ret" column: myecdf <- function(x, sortAsc) { w1 <- ecdf(x$Ret) w2 <- if (sortAsc) w1(x$Ret) * 100 else abs(w1(x$Ret) * 100 - 100) w3 <- transform(x, myPerc=w2) return(w3) } myExampleEnd <- lapply(split(myExample, myExample$Sectors), myecdf, sortAsc="True") myExampleEnd <- unsplit(myExampleEnd, myExample$Sectors) I need...
2018 Feb 25
0
include
hi Val, Your problem seems to be that the data are read in as a factor. The simplest way I can think of to get around this is: mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) rbind(preval,mydat) mydat[is.na(mydat)]<-"0" Jiim On Sun, Feb 25, 2018 at 11:05 AM, Val <valkremk at gmail.com> wrote: &g...
2008 Apr 05
2
How to improve the "OPTIM" results
...2) # data 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)...
2008 Apr 05
2
How to improve the "OPTIM" results
...2) # data 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)...