search for: yval

Displaying 20 results from an estimated 91 matches for "yval".

Did you mean: val
2011 Jul 25
1
Problem with random number simulation
...ation: After each round, an uneven coin (90/10 probability) is flipped to see if the game continues (hence the while loop). And every 10 hands, the noncomputer player changes strategy (hence the if...modulus 20 statement) Thanks lambda=0.8 game=1 count=0 a=0.1 b=0.7 x=numeric() y=numeric() xval=x yval=y while(game==1) { count=count+1 x[count]=runif(1,0,1) y[count]=runif(1,0,1) if ((count%%20)<10) { if (x[count] > 0.15 & x[count]< 0.65) { if(x[count]>y[count]) {...
2005 Jul 28
2
problem with an IF statement?
...ronly around the 'if' statement and gives me a directory listing. Thanks in advance Tom N.B. datan is an invented dataset xvals<-c(1,0.4,0.2) datan<-data.frame(s1=c(3,4,5),s2=c(5,5,5),s3=c(21,55,34),s4=c(5,3,2)) datan$sint<-NA datan$sgrad<-NA for(icount in 1:dim(datan)[1]) { yvals<-c(datan[icount,4],datan[icount,3],datan[icount,2]) if((is.na(yvals[1]) + is.na(yvals[2]) + is.na(yvals[3]))<2) { g<-lm(yvals~xvals) datan$sint[icount]<-g$coef[1] datan$sgrad[icount]<-g$coef[2] } }
2006 Mar 27
0
not a problem: a submission (PR#8714)
...NULL) (139.133.7.38) I think you should have better examples on the ?plot man page, if you don't mind me saying. Can I suggest something like this, which would probably stop so many emails to the R help about how to put on error bars Cheers, Toby M ****************************** xvalsT1=1:3 yvalsT1=c(10,20,30) errplusT1=c(2,3,4) errminusT1=c(9,8,7) xvalsT2=1:3 yvalsT2=c(30,35,40) errplusT2=c(12,13,14) errminusT2=c(1,2,3) treatment=c(rep("T1",times=length(xvalsT1)),rep("T2",times=length(xvalsT2))) xvals=c(xvalsT1,xvalsT2) yvals=c(yvalsT1,yvalsT2) errplus=c(errplusT1,err...
2005 Sep 24
1
rpart Error in yval[, 1] : incorrect number of dimensions
I tried using rpart, as below, and got this error message "rpart Error in yval[, 1] : incorrect number of dimensions". Thinking it might somehow be related to the large number of missing values, I tried using complete data, but with the same result. Does anyone know what may be going on, and how to fix it? I have traced two similar error messages in the Archive, but fol...
2008 May 27
5
Rotated text on a regression line
...such that the text has the same angle as the regression line. However, the text is always plotted in a slightly wrong angle: #### x=1:10 #create arbitrary x and y values y=x*2-rnorm(1:10) plot(x,y,pch=16,xlim=c(0,10)) #create the graph abline(lm(y~x)) #calculate the y coordinate of the text: yval=predict(lm(y~x),list(x=rep(2,length(x))))[1] #calculate the slope: slope=as.numeric(lm(y~x)[[1]][2]) text(2,yval,"Regression",srt=180/pi*atan(slope),adj=0) #### What am I doing wrong here? Many thanks in advance for any help! Best wishes Christoph (using R 2.6.1 on Windows XP)
2007 Feb 20
1
text.rpart for the "class" method doesn't act on label="yprob"
Hello All, Am I misreading the documentation? The text.rpart documentation says: "label a column name of x$frame; values of this will label the nodes. For the "class" method, label="yval" results in the factor levels being used, "yprob" results in the probability of the winning factor level being used, and ?specific yval level? results in the probability of that factor level." However, yprob doesn't seem to do this: > pred = rep(letters[1:6],5) > resp...
2003 Jul 12
2
help with bivariate density plot question
...nd corresponding plots as follows: new.data.normal<-data.normal[!is.na(data.normal[,2]),] x<-new.data.normal[,2] y<-new.data.normal[,3] op <- KernSur(x,y, xgridsize=50, ygridsize=50, correlation=0.4968023, xbandwidth=1, ybandwidth=1) #3D density plot persp(op$xvals, op$yvals, op$zden, theta=30,phi=10,expand=0.5,ltheta=120, xlab="TECH3661.A",ylab="TECH3661.B",zlab="Prob",col="pink", , main="3D DENSITY PLOT-TECH3661 ", sub=" TECH3661.A AND TECH3661.B", box = T, axes = TRUE,ticktype...
2000 Dec 15
1
resolution of windows metafiles
...ay)? Maybe metafiles have a coarse underlying resolution? The following code produces the problem (along with a postscript plot just to show that a smooth representation is possible): # PlotTest.R # 12/15/2000 # # Demonstrate some curiosities with windows metafiles xvals <- seq(0,1,length=101) yvals <- xvals^3 win.metafile(file="test.wmf",width=4,height=3.5, pointsize=12) plot(xvals,yvals,type="l") dev.off() postscript(file="test.eps",horizontal=FALSE,width=4,height=3.5, pointsize=12) plot(xvals,yvals,type="l") dev.off() windows...
2007 Mar 01
1
Generating R plots through Perl
...a is not getting passed to the file). It seems that the pipe connection created via Statistics::R cannot produce a graphics device window to save. A very simple version of the commands that I am using in my Perl program are as follows: $R->send(qq (xVal <- c(1,2,3,4,5,6))); $R->send(qq (yVal <- c(3,5,2,6,1,5))); $R->send(qq (pdf("C:/Test Environment/R/perlPlotTest.pdf"))); $R->send(qq (plot(xVal, yVal))); $R->send(qq (graphics.off())); As the code indicates, I am using R's pdf function to create a pdf file containing the plot of xVal and yVal. I am using t...
2004 Dec 20
1
evaluate expression on several dataframe columns
Hi R-users, I have a collection of dataframes and know how to build a string that refers to it, in this example, name_infra_alg_inc. Then, I have a character string yval, which the user can select from a drop down list. It contains the column names of the dataframes. assign(paste(name_infra_alg_inc, "ci", sep="."), ci(get(name_infra_alg_inc)[[yval]], confidence=0.95)) My problem is that I sometimes want to combine columns. For example, if th...
2005 Mar 15
0
need help with plot.rpart and text.rpart
...and need help with rpart. I am trying to create a classification tree using rpart. In order to plot the reults I use the plot function and the text function to label the plot of the tree dendrogram with text. The documentation of text.rpart says : "For the "class" method, label="yval" results in the factor levels being used, "yprob" results in the probability of the winning factor level being used, and 'specific yval level' results in the probability of that factor level" . However, neither the label="yprob" option nor the label='speci...
2004 Jun 11
1
Error when I try to build / plot a tree using rpart()
...ith data on a previous project. However, when attampting to build a tree on a project I am working on, I seem to be getting the error shown below: > nhg3.rp <- rpart(profitresp ~., nhg3, method="class") > plot(nhg3.rp, branch=0.4, uniform=T); text(nhg3.rp, digits=3) Error in yval[, 1] : incorrect number of dimensions The distribution of my binary dependent variable is: > table(nhg$profitresp) 0 1 3703 4360 I am using 105 potential predictor variables. I am trying to come up with a decision rule to identify profitable responders from non-responders to a mailin...
2010 Sep 29
2
R crashes when loading rgl package before minqa package
Hej, Calling newuoa (from the minqa package) makes R crash when the package rgl is loaded first. This however only on certain selected data. The data used for testing (saved to 'bugs.R'): xvals = c(1,2,4,5,7,8,9,10,11,12,14,15,16,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36) yvals = c(857.7597,975.8624,978.2655,979.3034,965.5919,983.8946,992.2512,992.1178,979.5379,974.4269,968.4113,991.5210,977.3361,985.7800,975.5220,974.6880,973.8102,980.7295,982.0034,984.7993,978.4948,970.4351,969.0718,983.7892,976.3637,980.7833,987.1665,976.6000,975.1332,971.0757,989.4693) initpar = c(-...
2007 Aug 31
2
memory.size help
...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 <- intersect(i1[x,], i2[x,]) zk[x] <- mean(unlist(k), na.rm = TRUE) } xk$zk <- zk data <- na.omit(xk) -- View this messag...
2002 Aug 28
0
user defined function in rpart
...ft+rt) #dir[x==i]<-1 } list(goodness=gd , direction=) } else{ list(goodness= , direction = ) } } tst.init<-function(y, offset, parms, wt){ browser() if (!is.null(offset)) y <- y-offset list(y=y, parms=0, numresp=2, numy=2, summary= function(yval, dev, wt, ylevel, digits ) { paste(" mean=", format(signif(yval, digits)), ", MSE=" , format(signif(dev/wt, digits)), sep='') }, text= function(yval, dev, wt, ylevel, digits, n, use.n ) { if(use.n) {paste(formatg(yval,digits),"\nn="...
2006 Oct 21
0
tcltk: multiple listboxes, selection
...=1, to=length(xvals), by=2)) { tkinsert(tl.x, "end", xvals[[i]]) } tkselection.set(tl.x, 0) tkgrid(tl.x, sticky="news") # Y values frame.y <- tkwidget(tt, "labelframe", text = "Y value(s)") tl.y <- tklistbox(frame.y, height = 20, #length(yvals) / yvals.field.count, yscrollcommand=function(...) tkset(scr.y,...), width = 50, selectmode = "extended", background = "white") scr.y <- tkscrollbar(frame.y, repeatinterval = 5, command = function(...) tkyview(tl.y, ...)) for(i in seq(...
2007 Jun 15
2
method of rpart when response variable is binary?
...and change it to a factor before calling glm(y~x,data=dat,family=binomail). I try to use rpart. As y is binary, I use "class" method and get the following result. > rpart(y~x,data=dat,method="class") n=778 (22 observations deleted due to missingness) node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 778 67 0 (0.91388175 0.08611825) * If with the default method, I get such a result. > rpart(y~x,data=dat) n=778 (22 observations deleted due to missingness) node), split, n, deviance, yval * denotes terminal node 1) root 778 61.230080 0....
2008 Oct 27
0
Displaying number of Y/N affected by tree in rule form RE: R question/request on rules from rpart
Hi Prof. Williams, thanks for your suggestion. The updated code is below. It turns out it was a matter of displaying the second column in yval to get the number of N and subtracting it from the n column in the frame to get the number of Y remaining in a binary example. once this is added now the function returns the rules along with Y and N count affected by the resulting rule. I am ccing the r-help post in case anyone wants to reuse...
2006 Oct 17
1
Some questions on Rpart algorithm
Hello: I am using rpart and would like more background on how the splits are made and how to interpret results - also how to properly use text(.rpart). I have looked through Venables and Ripley and through the rpart help and still have some questions. If there is a source (say, Breiman et al) on decision trees that would clear this all up, please let me know. The questions below pertain to a
2004 Sep 24
5
AW: How to improve the quality of curve/line plots?
...chnique before plotiing in order to get a curve instead of a line connecting the observations. But that's not the solution for my main problem with the "unclean" line plot. In order to show my problem let's take this simple example: > xval <- c(1, 2, 3, 4, 5, 6, 7, 8) > yval <- c(10, 30, 40, 50, 70, 90, 100, 110) > plot (xval, yval, type="l") If you look to the result in the graphic window you will see that the line seems to exist of many points between the observations; e. g. between xval=1 and xval=2 the line contains 8 or more sublines. Perhaps, you...