search for: xval

Displaying 20 results from an estimated 115 matches for "xval".

Did you mean: val
2011 Jul 25
1
Problem with random number simulation
...larification: 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])...
2013 Nov 27
1
Conditional error bars
...e example below) or 'error.bars', to draw only upper error bar (upper CI) if the bar value (mean) is positive and the lower error bar (lower CI) if bar value is negative? CI.plot <- function(mean, se,length, ylim=c(-5, max(CI.H)), ...) { CI.H <- mean+se CI.L <- mean-se xvals <- barplot(mean, ylim=ylim, ...) # Plot bars arrows(xvals, mean, xvals, CI.H, angle=90,length=length) arrows(xvals, mean, xvals, CI.L, angle=90,length=length) } CI.plot(D,SE,0.01) thanks, -- \m/ [[alternative HTML version deleted]]
2010 Mar 12
1
using xval in mvpart to specify cross validation groups
Dear R's I'm trying to use specific rather than random cross-validation groups in mvpart. The man page says: xval Number of cross-validations or vector defining cross-validation groups. And I found this reply to the list by Terry Therneau from 2006 The rpart function allows one to give the cross-validation groups explicitly. So if the number of observations was 10, you could use > rpart( y ~ x1 + x2,...
2009 Jun 09
3
rpart - the xval argument in rpart.control and in xpred.rpart
Dear R users, I'm working with the rpart package and want to evaluate the performance of user defined split functions. I have some problems in understanding the meaning of the xval argument in the two functions rpart.control and xpred.rpart. In the former it is defined as the number of cross-validations while in the latter it is defined as the number of cross-validation groups. If I am correct this means that for xpred.rpart, xval denots the number V of one V-fold cross v...
2006 Mar 27
2
A plotting question - how to get error bars?
...I need (see code below), but 2 things I can't get: 1. How to get "Jan","Feb","Mar" on the x=axis instead of 1:3? 2. How to get "T"s on the end of my error bars like you have in standard scientific plots? Any comments gratefully received! Thanks, Toby xvals=1:3 #couldn't get it to be "Jan, Feb, Mar" on the x-axis rgrT1=c(10,20,30) errbarsT1lo=c(0.5830952,0.3741657,0.8944272) errbarsT1up=errbarsT1lo rgrT2=c(25,30,35) errbarsT2lo=c(1.356466,3.535534,1.140175) errbarsT2up=errbarsT2lo minx=min(xvals);maxx=max(xvals) miny=min(rgrT1-errbarsT1...
2007 Oct 23
1
How to avoid the NaN errors in dnbinom?
...r this in my code to avoid it. I appreciate the help. Thanks. Below is the reproducible code: mixnbinom=function(y,k1,mu1,k2,mu2,prob,eps= 1/100000){ new.parms=c(k1,mu1,k2,mu2,prob) err=1 iter=1 maxiter=100 hist(y,probability=T,nclass=30,col="lightgrey",main="The EM algorithm") xvals=seq(min(y),max(y),1) lines(xvals,prob*dnbinom(xvals,size=k1,mu=mu1)+ (1-prob)*dnbinom(xvals,size=k2,mu=mu2),col="green") while(err>eps){ if(iter<=maxiter){ lines(xvals,prob*dnbinom(xvals,size=k1,mu=mu1)+ (1-prob)*dnbinom(xvals,size=k2,mu=mu2),lty=3) } bayes=(prob*dnbinom(y,size=k1,...
2006 Mar 27
0
not a problem: a submission (PR#8714)
...sion from: (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(e...
2013 Mar 22
1
Trouble embedding functions (e.g., deltaMethod) in other functions
...t <- c(0.00000, 26.24551, 61.78180, 86.88254, 221.75480) m <- c(48.591707, 15.655895, 12.284635, 5.758547, 0.000000) dat <- data.frame(t = t, m = m) m0 <- m[1] t0 <- t[5] nlls <- nls(m ~ (m0^(1/lambda) - (t * m0/t0)^(1/lambda))^lambda, start = list(lambda = 1), data = dat) xVal <- seq(0, t0, length = 10) mod.SE <- list() for(i in 1:length(xVal)){ z <- xVal[i] mod.SE[[i]] <- deltaMethod(nlls, "(m0^(1/lambda) - (z * m0/t0)^(1/lambda))^lambda")$SE } mod.SE This code executes deltaMethod() flawlessly (NOTE: [[1]] and [[10]] are supposed to be NaN'...
2000 Jan 10
1
'at' parameter in mtext(.., adj=0, outer=T) (PR#396)
...If one does not set the 'at' parameter the text appears (with 'adj=0') on the far left of the plot region. I assume this is also anomalous; at all events it is the behaviour that I wished to circumvent. The function plot.test() demonstrates the behaviour: plot.test <- function(xval=0:4, pos=NULL){ oldpar<-par(oma=c(2,0,0,0)) on.exit(par(oldpar)) plot(xval,xval) if(is.null(pos))pos<-min(xval) print(pos) print(par()$usr) mtext(side=1,line=3.5,"Marginal text",adj=0,at=pos) mtext(side=1,line=0.5,"Outer text",outer=T, adj=0,at=min(xval)) } > plot.test...
2004 Sep 24
5
AW: How to improve the quality of curve/line plots?
Thanks for the tip using a smoothing technique 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...
2009 Sep 24
3
pipe data from plot(). was: ROCR.plot methods, cross validation averaging
...ot(dat) bdat #provides details of the boxplot output # the same works for randomForest library(randomForest) data(mtcars) RFdat <- plot(randomForest(mpg ~ ., mtcars, keep.forest=FALSE, ntree=100), log="y") RFdat ##But, I can't use this method in ROCR library(ROCR) data(ROCR.xval) RCdat <- plot(perf, avg="threshold") RCdat ## output: NULL Does anyone have any tricks for piping or extracting these data? Or, perhaps for steering me in another direction? Thanks, Tim From: "Tim Howard" <tghoward at gw.dec.state.ny.us> Subject: [R] ROCR.plot...
2000 Dec 15
1
resolution of windows metafiles
...for Windows are available, anyway)? 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=&...
2009 Jul 25
4
ROCR package question
I use ROCR to plot multiple runs' performance. Using the sample code as example: # plot ROC curves for several cross-validation runs (dotted # in grey), overlaid by the vertical average curve and boxplots # showing the vertical spread around the average. data(ROCR.xval) pred <- prediction(ROCR.xval$predictions, ROCR.xval$labels) perf <- performance(pred,"tpr","fpr") plot(perf,col="grey82",lty=3) plot(perf,lwd=3,avg="vertical",spread.estimate="boxplot",add=TRUE) I can follow the code and plot without any pro...
2003 Jul 12
2
help with bivariate density plot question
...density and 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 = TRU...
2003 Sep 23
1
AW: Rank and extract data from a series
...something that would retain the > > adaptability of integrate(). > > Yesterday, I've suggested to use approxfun(). Did you consider my > suggestion? Below is an example. > > N <- 500 > x <- rexp(N) > y <- rank(x)/(N+1) > empCDF <- approxfun(x,y) > xvals <- seq(0,4,.01) > plot(xvals,empCDF(xvals),type="l", > xlab="Quantile",ylab="Cumulative Distribution Function") > lines(xvals,pexp(xvals),lty=2) > legend(2,.4,c("Empirical CDF","Exact CDF"),lty=1:2) > > > It's possible t...
2007 Mar 01
1
Generating R plots through Perl
...ce a pdf file with no data (i.e. the plot data 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 contai...
1999 Nov 22
1
variance?,...
hi I'm learning R and making some examples. One of them is that for given distribution I show density function, distribution function expected value and variance(?). I know EX <- function(xval,xprob) sum( (xval*xprob) ); where xval is vector of values and xprob vector of probabalities, but DX <- function(xval,xprob) EX((xval^2),xprob) - (EX(xval,xprob))^2; doesn't work as I thought. I've looked intto FAQs and archives but my question is probably too simple. Can somebody tell...
1999 Aug 26
1
error bars on barplots
Hello again I'm trying to put error bars onto a barplot. I've tried something that Bill Simpson suggested a while ago, ie: x<-c(1,2,3,4,5) y<-c(1.1, 2.3, 3.0, 3.9, 5.1) ucl<-c(1.3, 2.4, 3.5, 4.1, 5.3) lcl<-c(.9, 1.8, 2.7, 3.8, 5.0) plot(x,y, ylim=range(c(lcl,ucl))) arrows(x,ucl,x,lcl,length=.05,angle=90,code=3) #or segments(x,ucl,x,lcl) but I can't get it to work on a
2011 Jun 21
2
par code help
...;) >barplot2(meanapAprilactivity, names.arg=speciesnames, col=columncolor, xlab="Species", ylab="Soil acid phosphatase activity (nmol/h/g)", ylim=c(0,1000), plot.ci=T, ci.l=apAprilminusordered, ci.u=apAprilplusordered, cex.lab=1.5)#FinalGraphs>aPApril_Genus.pdf >xvals<-barplot2(meanapAprilactivity, col=columncolor, xlab="Species", ylab="Soil acid phosphatase activity (nmol/h/g)", ylim=c(0,1000), plot.ci=T, ci.l=apAprilminusordered, ci.u=apAprilplusordered, cex.lab=1.5)#FinalGraphs>aPApril_Genus.pdf >text(xvals,par("usr&q...
2005 Jul 28
2
problem with an IF statement?
Can somebody please take a look at this and tell me whats going wrong? It seems to be parsing wronly 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<-l...