Displaying 20 results from an estimated 6000 matches similar to: "fitting a hyperbole"
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
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 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 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 Oct 20
5
Staging area for data before read into R
I am wondering if there is a better alternative than Excel for data
storage that does not require database knowledge (I will eventually
have to learn this, but it is not on my immediate todo list). I need
something that is not limited to 256 columns... I don't need any of
the built in functions in excel just a spreadsheet like program with
cells that hold data in a data.frame format for a
2008 Sep 24
2
lattice xyplot symbols instead of colors and legend matching plot symbols or colors
I would like to use the data below where the plots are close to what I
want. Instead of color I would like to use different symbols, and
have the symbols in the legend match the graphs. I am also going to
add a regression line to these I know about the type="r" (which is
fine for these particular graphs) argument, but it fits the subsets
instead of the entire data set-- should I use a
2008 Sep 15
4
getting data into correct format for summarizing ... reshape, aggregate, or...
I would like to reformat this data frame into something that I can
produce some descriptive statistics. I have been playing around with
the reshape package and maybe this is not the best way to proceed. I
would like to use RiverMile and constituent as the grouping variables
to get the summary statistics:
198a 198b
mean mean
sd sd
... ...
etc. for all of these.
I have tried
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 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 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,
2008 Oct 10
2
ggplot adding points
I would like to do the following in ggplot:
what am I missing?
River.Mile <-c(202, 198, 190, 185, 179, 148, 119, 61)
TSS <- c(1:8)
DOC <- seq(2, by= 0.6, length.out=8)
z <- data.frame(River.Mile, TSS, DOC)
xyplot(TSS+DOC~River.Mile, data=z, auto.key=TRUE)
thanks
--
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy
Let's not spend our time and resources