Displaying 20 results from an estimated 115 matches for "xvals".
Did you mean:
vals
2011 Jul 25
1
Problem with random number simulation
Hi this is my first post. I am trying to run a simulation for a computer
playing Von Neumann poker and adjusting it's expectation of an opponent's
behavior according to how the opponent plays. This program involves random
generation of "hands" and shifting of parameters. However, when I run the
code, no errors come up, but the program doesn't do anything. Could someone
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
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
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-errbarsT1l...
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,m...
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(er...
2013 Mar 22
1
Trouble embedding functions (e.g., deltaMethod) in other functions
Dear R community,
I've been writing simple functions for the past year and half and have come
across a similar problem several times. The execution of a function within
my own function produces NaN's or fails to execute as intended. My conundrum
is that I can execute the function outside of my function without error, so
it's difficult for me, as a novice functioneer, to figure out
2000 Jan 10
1
'at' parameter in mtext(.., adj=0, outer=T) (PR#396)
Depending on the setting of par()$usr,
the 'at' setting in mtext(.., adj=0, outer=T) may cause the
text to appear in an anomalous position (e. g. in the first
instance below, at the left of the plot region rather than
at 'at=0' in the figure region), or the text may not appear
at all.
If one does not set the 'at' parameter the text appears
(with 'adj=0') on the
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
2009 Sep 24
3
pipe data from plot(). was: ROCR.plot methods, cross validation averaging
All,
I'm trying again with a slightly more generic version of my first question. I can extract the
plotted values from hist(), boxplot(), and even plot.randomForest(). Observe:
# get some data
dat <- rnorm(100)
# grab histogram data
hdat <- hist(dat)
hdat #provides details of the hist output
#grab boxplot data
bdat <- boxplot(dat)
bdat #provides details of the boxplot
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=&q...
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")
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 = TRUE...
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 to...
2007 Mar 01
1
Generating R plots through Perl
Hello,
I am in the process of writing a Perl program to carry out and analyze
large numbers of regressions using R as the regression engine, and I am
using Statistics::R to create the communication bridge between the two
programs. Statistics::R creates a pipe between R and Perl and uses
Rterm.exe (hidden during run-time) to carry out the R commands. This
communication bridge works well for
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
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&qu...
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<-lm...