Displaying 20 results from an estimated 7000 matches similar to: "plotmath help with expression"
2005 Jun 28
2
Producing character "given" i.e. "| " with plotmath
Hello!
Does someone know how to produce
L(y|mu)
with plotmath?
Some code with unsuccessfull results:
plot(dnorm(x = seq(from = -4, to = 4, by = 0.1)), type = "l")
## Not what I want
legend(legend = c(expression(L(y:mu))), x = "topright")
## Strange, is this a bug?
legend(legend = c(expression(L(y|mu))), x = "top")
## Group produces an error
legend(legend =
2024 Jul 16
2
Automatic Knot selection in Piecewise linear splines
>>>>> Anupam Tyagi
>>>>> on Tue, 9 Jul 2024 16:16:43 +0530 writes:
> How can I do automatic knot selection while fitting piecewise linear
> splines to two variables x and y? Which package to use to do it simply? I
> also want to visualize the splines (and the scatter plot) with a graph.
> Anupam
NB: linear splines, i.e. piecewise
2008 Sep 20
1
fitting a hyperbole
I have got a data set that is Gross Primary Productivity ~ Total
Suspended Solids it is a hyperbola just like:
plot(1/c(1:1000))
how do I model this relationship so that I can get all of the neat
things that lm gives residuals etc. etc. so that I can see if my
eyeball model stands up. Thanks for any help, pointers, or good
things to read.
--
Stephen Sefick
Research Scientist
Southeastern
2008 Aug 28
1
abline of an lm fit not correct
mac osx 10.5.4
R 2.7.1
I have fit a model
d<-lm(y~x)
with an R^2 of 0.963
but when I issue the command
abline(d)
the line is below where it ought to be. Looks like the right slope,
but not the right intercept.
thanks
--
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy
Let's not spend our time and resources thinking about things that are
so little or so large
2008 Oct 23
1
Reversing xlim qplot
I would like to be able to reverse the xlim on qplot
this is the code that I am using
qplot(a[,"River.Mile"], a[,26]
,ylab=colnames(a)[26], xlab="RiverMile", xlim=rev(c(60,
216)))+geom_smooth()+scale_x_continuous(breaks=c(215,202,198,190,185,179,148,119,61),
2008 Oct 29
1
Macro stuff to work on up through august 2007
Title says it all remember cast() with sum as the aggregation function
--
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy
Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being
2007 Jun 08
2
legend + expression
Dear all;
A simple? question.
I'm having a problem with a math expression in the legend of a plot
and I haven't found the way to get this to work, so any help will be
appreciate. Basically I want to include in the plot is the R-squared
and its numerical value, so I tried this:
R2c<-0.82879 # R-squared of calibration model
plot(1:10,1:10)
legend("topleft",
2008 Nov 09
1
maptools sunrise sunset function
##This is a function that I am trying to write to calculate sunrise
and sunset and works "mostly", but returns nonsensical values. What
am I #missing? Thanks in advance.
###remember to include maptools as dependence###
library(maptools)
sunrise.set <- function(lat, long, date, timezone="UTC", num.days=1){
#this needs to be long lat#
lat.long <- matrix(c(long, lat),
2008 Oct 22
1
plotting matrix
a <- c(1:26)
b <- rnorm(25)
e <- rnorm(25)
f <- rnorm(25)
g <- data.frame(b,e, a,f)
I would like to plot a agianst all possibilities and then shoot it out
to a pdf one graph per page. I think it would be okay to have this as
a lattice plot or a ggplot with many graphs per page. I can figure
all of that out I think, but I need something like
r <- as.matrix(g)
plot(.~a, data=r)
2008 Sep 06
1
plot a list
i have a list of 6 each containing a dataframe of 96 observations as a
zoo object. Is there a way to plot these in one frame
par(mfrow=c(3,2))
this is what I tried
lapply(d, FUN=plot)
I can provide data, list is large.
thanks
--
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy
Let's not spend our time and resources thinking about things that are
so little or so
2008 Oct 06
1
easier way to do this without a loop? (successive euclidean distances between points)
a <- c(1:10)
b <- c(.5, .6, .9, 10, .4, 3, 4, 9, 0, 11)
d <- c(21:30)
z <- data.frame(a,b,d)
library(fields)
results <- c()
for(i in 1:(length(rownames(z))-1)){
results[i] <- rdist(z[i,], z[(i+1),])
}
results.1 <- data.frame(results)
f <- rownames(z)
r <- f[-1]
rownames(results.1) <- r
colnames(results.1) <- f[1]
this does what I want it to do - is
2008 Oct 19
1
zoo in ggplot2
library(zoo)
d<-(structure(c(1.39981554315924, 0.89196314359498, 0.407816250252697,
0.823496839063978, 1.14429021220358, 1.23971035967413, 0.960868900583432,
0.927685306209829, 1.22072345292821, 0.249842897450642, 1.00879641624694,
0.925372139878243, 0.317259909172362, 0.382677149697482), index =
structure(c(11808,
11869, 11961, 11992, 12084, 12173, 12265, 12418, 12600, 12631,
12753, 12996,
2008 Nov 10
1
how to vectorize a for loop
#Is there a way to vectorize the for loop
#maybe a fancy indexing trick?
#thanks
d=0.5
L=20
x=seq(20, by=1, length.out=20)
reflecting <- function(pre, d, L){
r=L-1
x=rep(0, L)
for(j in 2:r){
x[j]=((1-(2*d))*pre[j])+(d*pre[(j+1)])+(d*pre[(j-1)])
}
x[1]=((1-d)*pre[1])+(d*pre[2])
x[L]=((1-d)*pre[L])+(d*pre[(L-1)])
y=x
}
f = reflecting(x, d, L)
--
Stephen Sefick
Research Scientist
2008 Oct 13
1
ggplot faceting like lattice | variable
I would like to be able to do the xyplot in ggplot below. I read in
the archive that Hadley was working on this for the next release, and
I can not find the documentation (Aug. 23rd).
River.Mile <- c(215 ,202, 198, 190, 185, 179, 148, 119, 61)
Cu <- rnorm(9)
Fe <- rnorm(9)
Mg <- rnorm(9)
Ti <- rnorm(9)
Ir <- rnorm(9)
r <- data.frame(River.Mile, Cu, Fe, Mg, Ti, Ir)
z <-
2008 Aug 29
2
non-parametric Anova and tukeyHSD
I have insect data from twelve sites and like most environmental data
it is non-normal mostly. I would like to preform an anova and a means
seperation like tukey's HSD in a nonparametric sense (on some sort of
central tendency measure - median?). I am searching around at this
time on the internet. Any suggestions, books, etc. would be greatly
appreciated.
--
Stephen Sefick
Research
2008 Sep 03
1
many correlations
I have one hundred and six independent variable that I would like to
preform a correlation analysis on. Is there anyway to only get the
values that are abolute value 0.6 or greater.
thanks
--
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy
Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is
2008 Sep 22
1
as.day() Function (zoo question)
I am was going to look at the as.yearmon function in the zoo package
and write a as.day function to aggregate a time series of 96
observations per day into the mean for each day, but I don't know how
to look at the code so that I can convert it into something I can use.
On top of that I believe that it is probably an S3 method and I
haven't quite gotten that far in my programming
2008 Oct 31
1
reshape bug?
Hadley et al.,
I was using the cast function to reshape some data (aggregate a melted
data frame) and I did not put in the fill and for the most part the
values that came out were fine, but there were value great than an
order of magnitude from the actual value. When I put in the fill
argument everything is okay. I don't provide a reproducible example
because the data set is to large to post
2008 Nov 04
2
Zoo seems to be running slow in R 2.8.0 windows
R version 2.8.0 (2008-10-20)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] StreamMetabolism_0.01 chron_2.3-24 zoo_1.5-4
loaded
2008 Oct 02
1
extracting diagonal from dist()
h <- structure(list(V1 = c(-0.351714766, 0.188298251, 0.042951816,
-0.072490327, -0.691885485, -0.816169763, -0.7066502, -0.856286332,
-0.839723411, -0.427242353, -0.372911996, 0.326707494, 0.07847893,
0.687447841, 0.516105863, 0.267076547, 0.727867663, 0.432699191,
0.258610632), V2 = c(0.256636068, -0.824072121, -0.149185618,
0.153280492, 0.01649528, 0.409410528, 0.286015324, 0.366323539,