Displaying 20 results from an estimated 33 matches for "myx".
Did you mean:
my
2009 Jun 03
1
Would like to add this to example for plotmath. Can you help?
...m a program into a single expression is a
difficult task that is not currently exemplified. I believe this is
an instructive example because it combines the use of lines, arrows,
text, and polygons.
Here's the code:
###Set mu and sigma at your pleasure:
mu <- 10.03
sigma <- 12.5786786
myx <- seq( mu - 3.5*sigma, mu+ 3.5*sigma, length.out=500)
myDensity <- dnorm(myx,mean=mu,sd=sigma)
# It is challenging to combine plotmath with values of mu and sigma in
one expression.
# Either bquote or substitute can be used. First use bquote:
myTitle1 <- bquote (paste("x ~ Norm...
2008 Apr 02
1
Trouble combining plotmath, bquote, expressions
...d sigma are replaced with Greek and mymean and
mystd are drawn from program?
### Filename: Normal1_2008.R
### Paul Johnson March 31, 2008
### This code should be available somewhere in
http://pj.freefaculty.org. If it is not
### email me <pauljohn at ku.edu>
mymean <- 0
mystd <- 1.5
myx <- seq( mymean - 3*mystd, mymean+ 3*mystd, length.out=500)
myDensity <- dnorm(myx,mean=mymean,sd=mystd)
## This works
plot(myx, myDensity, type="n", xlab="X", ylab="Probability Density ",
main=expression(mu == 0))
## This works
plot(myx, myDensity, type="...
2005 Jun 16
1
AIC in glm.fit with intercept
Dear R users,
glm.fit() gave me the same AIC's regardless of TRUE or FALSE intercept option.
> myX <- as.matrix(1:10)
> myY <- 3+5*myX
> foo <- glm.fit(x=myX, y=myY, family = gaussian(link = "identity"), intercept=TRUE)
> foo$aic
[1] 38.94657
> foo <- glm.fit(x=myX, y=myY, family = gaussian(link = "identity"), intercept=FALSE)
> foo$aic
[1] 38.94657...
2010 Mar 09
3
Shade area under curve
I want to shade the area under the curve of the standard normal density.
Specifically color to the left of -2 and on. How might i go about doing
this?
Thanks
--
View this message in context: http://n4.nabble.com/Shade-area-under-curve-tp1586439p1586439.html
Sent from the R help mailing list archive at Nabble.com.
2010 Jan 27
1
control of scat1d tick color in plot.Predict?
...e ticks are produced by
scat1d, but after spending a fair bit of time going through documentation,
it still isn't clear to me how to do this in the context of lattice.
Guidance would be greatly appreciated.
Thanks,
Mike Babyak
Duke University Medical Center
My code using R 2.10.1/windows XP
myx<-c(1,2,3,4)
myy<-c(1,2,3,5)
library(rms)
d<-datadist(myx)
options(datadist="d")
myfit<-ols(myy~myx,x=T,y=T)
p1<-Predict(myfit,myx =.)
library(lattice)
#change line to black
line <- trellis.par.get("plot.line")
line$col <- 1
trellis.par.set("plot.l...
2007 Apr 18
5
Problem with ?curve
Dear all R gurus,
I have following syntax:
y = c(1:10)
chippy <- function(x)
{
y[5] = x
sin(cos(t(y)%*%y)*exp(-t(y)%*%y/2))
}
curve(chippy, 1, 20, n=200)
But I am getting error while executing :
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' and 'y' lengths differ
In addition: Warning message:
number of items to
2008 Apr 08
2
plotmath "overstrikes" in output on a Linux system
I've been testing plotmath. But I'm getting some funny output one one
computer. The problem is that characters are 'jumbled' and overstrike
when symbols are introduced.
Sample code:
mu <- 440.0
sigma <- 12.5
myx <- seq( mu - 4*sigma, mu+ 4*sigma, length.out=500)
myDensity <- dnorm(myx,mean=mu,sd=sigma)
# Here's one way to retrieve the values of mu and sigma and insert
them into an expression
t1t2 <- bquote (paste("Normal(", mu== .(mu), ',', sigma== .(sigma),")") )...
2011 Aug 18
1
Where are the ticks on grid.xaxis?
...strategy is that I cannot figure out how to "recover"
the positions of these ticks when you do NOT specify the 'at' argument.
For example:
grid.newpage()
pushViewport(plotViewport(c(5, 4, 2, 2), name = "myvp"))
# This draws a default xaxis
a = grid.xaxis(name = "myX")
# What are the tick marks?
grid.get("myX")$at # NULL
# But if I specify an 'at' argument...
grid.edit("myX", at = seq(0, 1, length = 10))
# ...I can get at the position of the ticks
grid.get("myX")$at
Is it possible to find the tick positions created...
2010 Jul 06
1
plotmath vector problem; full program enclosed
...where all of the
symbols are resolved correctly.
As usual, thanks in advance for your help, sorry if I've made an
obvious mistake or overlooked a manual.
### Filename: plotMathProblem.R
### Paul Johnson July 5, 2010
### email me <pauljohn at ku.edu>
sigma <- 10.0
mu <- 4.0
myx <- seq( mu - 3.5*sigma, mu+ 3.5*sigma, length.out=500)
myDensity <- dnorm(myx,mean=mu,sd=sigma)
### xpd needed to allow writing outside strict box of graph
### Need big bottom margin to add several x axes
par(xpd=TRUE, ps=10, mar=c(18,2,2,2))
plot(myx, myDensity, type="l&qu...
2009 Feb 19
1
Getting the difference between two data frames
Dear R users,
I have the following data:
x <- data.frame( myX = c(1,2,3,4,5,6,7,8,9) )
y <- data.frame( myX = c(1,2,3,4,5,6,7) )
How can I get the difference between data frame x and y? In this case,
I want to get values 8 and 9
I know in SQL we can use minus operator, but I have no idea how to do so in R.
I tried all.equal, diff, and identical, but the...
2008 Dec 31
3
Plotmath with values?
I hope to use the plotmath facility to print titles that mix
math and values of R variables.
The help for "plotmath" has an example, which after repeated
reading, I find baffling. Likewise, I have read the help file
for "substitute" (wqhich seems to be needed) without ever
understanding what it does, other than being used in some magic
incantations.
I would like to do
2002 Mar 08
2
Sys.putenv environment variables disappear (PR#1371)
Environment variables set with Sys.putenv() disappear (i.e. become "")
after a while, especially after heavy-duty I/O. Example:
R> x <- matrix(1., 3000, 3000)
R> save(x, file="myx.RData")
R> Sys.putenv(HOME="/tmp")
R> while (Sys.getenv("HOME") != "") {cat("ok\n"); load("myx.RData")}
The loop prints "ok" twice, then exits because HOME has been destroyed.
I'm running R-1.4.1 (I also saw this in ea...
2006 Nov 24
1
Error in Calling C++ function from R!!!
....so codigoprova.o -L/usr/lib/R/lib -lR
After, I tried to call R from my working directory an Error occurs:
> x<-c(1,4,6,2)
> y<-c(3,2.4,1,9)
> dyn.load("codigoprova.so")
> is.loaded("codigoprova.so")
[1] FALSE
> product<-.C("prodgdot",myx=x,muy=y,myn=NROW(x),myoutput=as.double(0))
Error in .C("prodgdot", myx = x, muy = y, myn = NROW(x), myoutput =
as.double(0)) :
C symbol name "prodgdot" not in load table
>
Does anyone know what is the problem?
Thank's in advance!
Gilberto.
2008 Oct 29
1
How to set read.table variables to vectors?
...gt; plot(xin,yin)
Error in plot(xin, yin) : object "xin" not found
>
> split.screen(c(2,2))
[1] 1 2 3 4
>
> for (k in 0:3){
+
+ screen(k+1)
+ cnt <- 0
+ #grp<- iter * 5
+ for (i in 1:5000 ) {
+ if (iter<-k*5) {
+ cnt = cnt + 1
+ x[cnt] <- myx[i]
+ y[cnt] <- myy[i]
+ }
+ }
+ #p = cbind(x=rnorm(300), y=rnorm(300))
+ #p = cbind(x, y)
+ #tt = delaunayn(p)
+ #trimesh(tt,p,axis=TRUE,box=TRUE)
+ plot(myx,myy)
+ }
>
>
[[alternative HTML version deleted]]
2012 Dec 08
2
C function, double problem
Hi everybody,
here's my problem:
i call a C function which calculates a large number of double values and
puts them into an array which is passed from R as a parameter in the
function (like .C("function", other parameters, result = as.double( c ( 1
: quantity ) ).
When the values come back to R in the result array, they are all truncated
to their integer value (i.e. I lose the
2005 Jul 05
1
Kind of 2 dim histogram - levelplot
...<- 1:4
yb <- 4:7
xble <- length( xb ) - 1
yble <- length( yb ) - 1
# fill data in bins
g <- expand.grid( x=xb[1:xble], y=yb[1:yble] )
g$cnt <- numeric( dim( g )[1] )
g$avg <- numeric( dim( g )[1] )
g$proz <- numeric( dim( g )[1] )
idx <- 1
for (myy in 1:yble) {
for (myx in 1:xble) {
xIdx <- which( ( (x >= xb[myx]) & (x < xb[myx + 1]) ) )
yIdx <- which( ( (y >= yb[myy]) & (y < yb[myy + 1]) ) )
bIdx <- intersect( xIdx, yIdx )
g[idx,3] <- length( bIdx )
g[idx,4] <- sum( val[bIdx] )/g[idx,3]
g[idx,5] <- sum...
2013 Nov 21
2
overlaying 2D grid on randomly distributed points
Hi, I have a cloud of randomly distributed points in 2-dimensional space and want to set up a grid, with a given grid-cell size, that minimizes the distance between my points and the grid nodes. Does anyone know of an R function or toolbox that somehow addresses this problem? This is a problem of optimizing the location of the grid, not a problem of deciding what should be the grid-cell size,
2003 Dec 02
1
setMethod("min", "myclass", ...)
Hello,
I have defined a new class
> setClass("myclass", representation(min = "numeric", max = "numeric"))
and want to write accessor functions, so that for
> foo = new("myclass", min = 0, max = 1)
> min(foo) # prints 0
> max(foo) # prints 1
At first i created a generic function for "min"
> setGeneric("min",
2011 Mar 12
3
pass character vector in instrument field of get.hist.quote function
I am new to R so I apologize if my question is trivial. I have not been able
to figure out whether what I want to do is even possible.
I have a data frame of stock ticker symbols which I store into R space from
a txt file as follows:
tickers <- read.csv("stocks.txt", header=FALSE, sep=",")
tickers <- tickers[1] / the tickers are stored in the first column
>
2003 Jun 17
1
User-defined functions in rpart
This question concerns rpart's facility for user-defined functions that
accomplish splitting.
I was interested in modifying the code so that in each terminal node,
a linear regression is fit to the data.
It seems that from the allowable inputs in the user-defined functions,
that this may not be possible, since they have the form:
function(y, wt, parms) (in the case of the