Displaying 20 results from an estimated 192 matches for "midpoint".
2009 Nov 08
3
Obtaining midpoints of class intervals produced by cut and table
Hello list:
I am using "cut" and "table" to obtain a frequency table from a numeric sample vector. The idea is to calculate mean and standard deviation on grouped data. However, I can't extract the midpoints of the class intervals, which seem to be strings treated as factors. How do i extract the midpoint?
Thanks,
jose loreto
[[alternative HTML version deleted]]
2009 Jun 26
1
predicted values after fitting gamma2 function
...uency counts using the following:
Max.brks <- pretty(range(Max.Spread$Distance), 100)
Max.f<-hist(x=Max.Spread$Distance,
breaks=Max.brks,plot=FALSE )
Max.cnt<-as.data.frame(cbind(sim,Max.f$mids,Max.f$counts))
colnames(Max.cnt)<-c("Simulation","MidPoint","Count")
then I fit this to a gamma distribution function:
modl<-
vglm
(Count
~
MidPoint
,gamma2
,data
=subset(Max.cnt,select=(simulation,MidPoint,Count),trace=TRUE,crit="c")
print(coef(modl2,matrix=TRUE))
print(summary(modl2))
This produces the output...
1999 Nov 13
1
image()
May I raise the issue of the behaviour of image()? In image() dim(z) is
supposed to be c(length(x), length(y)). This suggests that the user is
supplying the midpoints of the rectangles. For all but the outer
rectangles this is true. The outer rectangles, however, are only
displayed in half width. So it is not possible to show correctly an image
plot of equally-spaced abscissa. I would hazard a guess that these kinds
of plots make up the bulk of calls to ima...
2005 Nov 02
1
x/y coordinates of dendrogram branches
...own (the heights of the agglomeration), but how can I
get the x-values?
> mydata <- c(1,2,3,4,5)
> hc <- hclust(dist(mydata), method="average")
> hc$height # these are the y-coordinates
[1] 1.0 1.0 1.5 2.5
I experimented with the dendrogram object because it gives the midpoints:
> dend <- as.dendrogram(hc)
> attributes(dend[[1]])$midpoint
[1] 0.5
Perhaps I could loop over all possible branches and get the midpoints if
I knew how to convert them to x-values.
The manual says that midpoint is the "numeric horizontal distance of the
node from the left bor...
2012 May 23
3
applying cbind (or any function) across all components in a list
#If I have two lists as follows
a1<- array(1:6, dim=c(2,3))
a2<- array(7:12, dim=c(2,3))
l1<- list(a1,a2)
a3<- array(1:4, dim=c(2,2))
a4<- array(5:8, dim=c(2,2))
l2<- list(a3,a4)
#how can I create a new list with the mean across all arrays within the
list, so all components are included? As an example for [[1]];
cbind((l1[[1]][,1]+l2[[1]][,1])/2,
2010 Jul 23
1
Midpoint between coordinates
Dear R users,
I need to find the coordinates for the point (midpoint) located half
way between two pairs of coordinates (lon1,lat1 and lon2,lat2)
assuming a straight line between them. What would be the best way? I
tried to find an answer in the help archives but without success. I
would greatly appreciate any help.
df<- data.frame(lon1=c(-4.568,-4.3980), lat1=c...
2008 Jan 28
1
Grouping data via an index
Hello r-help,
I have a lengthy vector of data (with values anywhere from 1-200), and
another index vector of 'groups' representing values 0-2, 3-5, 6-8, ...
of length 67. The index vector has the structure (1, 4, 7, ... , 196,
199), where each value is the midpoint of each respective group.
I'm trying to convert the data vector such that values falling into each
group are changed to the 'number' of that group. That is, the position
of the midpoint of that group in the index vector. For example, 4 or 5
would become a 2; 6 would become 3; 9 or 10...
2007 Mar 20
2
Problem adjusting x-labels with bargraphCI
Hello:
I'm having quite a bit of difficulty adjusting the x-labels using bargraphCI. I've tried using text and srt=45 to rotate the labels or mtext for 2 lines to break up the labels. However, using either method, I cannot line up the labels with the midpoints of the bars (they line up with some sort of tick mark that is off the midpoint of the bars). Any suggestions would be greatly appreciated.
Regards
Pedro L. Vera, Ph.D.
University of South Florida, Dept of Surgery
[[alternative HTML version deleted]]
2009 Dec 01
2
Cut intervals (character) to numeric midpoint; regex problem
Starting with the head of a 499 element matrix whose column names are
now the labels trom a cut() operation, I needed to get to a vector of
midpoints to serve as the basis for plotting a calibration curve
( exp(linear predictor) vs. :
> dput(head(dimnames(mtcal)[2][[1]])) # was starting point
testvec <- c("(-8.616,-3.084]", "(-3.084,-2.876]", "(-2.876,-2.756]",
"(-2.756,-2.668]",
"(-2....
2002 Aug 06
1
Questions about lexical scope
...nd Ihaka (2000),
"Lexical Scope and Statistical Computing," JCGS, 9, 491-508,
is very interesting and helpful in understanding how lexical scope
is about.
However, I got some questions that I just can't figure out.
First all, allow me to copy the two functions given by the authors:
midpoint <- function(f, a, b, n=100) {
h <- (b - a)/n
(b - a)*mean(sapply(seq(a + h/2, b - h/2, length=n), f))
}
bv.integrate <- function(f, a, b, n=100, rule=midpoint) {
g <- function(y) {
fx <- function(x) f(x, y)
rule(fx, a[2], b[2], n)
}
rule(g, a[1],...
2005 Aug 22
2
problem building dendrograms to use with heatmap()
.... Thanks in advance.
-Ben
########################### begin code ###################################
version
dendro.leaf <- function(label) {
ans <- list()
attr(ans, 'members') <- 1
attr(ans, 'height') <- 0
attr(ans, 'leaf') <- T
attr(ans, 'midpoint') <- 0
attr(ans, 'label') <- label
attr(ans, 'class') <- 'dendrogram'
ans
}
dendro.merge <- function(d1, d2, height) {
ans <- list(d1, d2)
members <- attr(d1, 'members') + attr(d2, 'members')
attr(ans, 'members') <...
2009 Jun 01
3
exporting data to csv file -problem with column names
I have a data.frame with three columns + the row number
Sample MidPoint Count
[1,] 1 0.025 1
[2,] 1 0.075 3
[3,] 1 0.125 15
[4,] 1 0.175 12
[5,] 1 0.225 5
[6,] 1 0.275 8
When I export the data to a csv the column names are shifted because
the row numbers are being exported as wel...
2011 Mar 08
4
minimum distance between line segments
...ce between line segments. For instance,
consider 20 random line segments:
x1 <- runif(20)
y1 <- runif(20)
x2 <- runif(20)
y2 <- runif(20)
plot(x1, y1, type = "n")
segments(x1, y1, x2, y2)
Inititally I thought the solution to this problem was to work out the
distance between midpoints (it quickly became apparent that this is
totally wrong when looking at the plot). So, I thought that perhaps
finding the minimum distance between each of the lines endpoints AND
their midpoints would be a good proxy for this, so I set up a loop
that uses pythagoras to work out these 9 distances an...
2003 Feb 03
4
Overlaying a moving average curve on top of a barplot
I''m using standard barplot (Windows version 1.6.2 of R) to represent a certain weekly metric "v" and I would like to properly overlay on top of it its moving average "mean.8" (window of 8 weeks). I must be doing something wrong since the moving average (using "lines") doesn''t overlay properly, i.e., both x-scales do not match!
...
2009 Jun 05
2
p-values from VGAM function vglm
Anyone know how to get p-values for the t-values from the coefficients
produced in vglm?
Attached is the code and output ? see comment added to output to show
where I need p-values
+ print(paste("********** Using VGAM function gamma2 **********"))
+ modl2<-
vglm(MidPoint~Count,gamma2,data=modl.subset,trace=TRUE,crit="c")
+ print(coef(modl2,matrix=TRUE))
+ print(summary(modl2))
[1] "********** Using VGAM function gamma2 **********"
VGLM linear loop 1 : coefficients =
0.408464609241, 3.255887520104, -0.000220585671
VGLM line...
2012 Dec 16
1
average X value of specific Y
Hello
I have a table describing butterfly range traits.
It is composed of three columns as below
Species name range size (X) latitude of range midpoint (Y)
There are 11 kinds of butterflies.
Each has its range size, and the latitude of each range midpoint ranges
from 9 to 19.
I would like to have the average range size of every degree of latitude.
For example, the average range size of latitude degree 10 (10.0-10.99:
Butterfly A2, B1, B2)
P...
2011 Dec 01
3
[LLVMdev] anchoring explicit template instantiations
...}
and
--- a/lib/Support/APInt.cpp
+++ b/lib/Support/APInt.cpp
@@ -1440,16 +1440,14 @@ APInt APInt::sqrt() const {
APInt nextSquare((x_old + 1) * (x_old +1));
if (this->ult(square))
return x_old;
- else if (this->ule(nextSquare)) {
+ if (this->ule(nextSquare)) {
APInt midpoint((nextSquare - square).udiv(two));
APInt offset(*this - square);
if (offset.ult(midpoint))
return x_old;
- else
- return x_old + 1;
- } else
- llvm_unreachable("Error in APInt::sqrt computation");
- return x_old + 1;
+ return x_old + 1;
+ }
+ llvm_unreach...
2008 May 29
3
Manipulating DataSets
Hello R-Users,
I am new to R and trying my best however I need help with this simple task.
I have a dataset, YM1207.
X.Symbol Date Time Exchange TickType
ReferenceNumber Price Size
12491 3:YMZ7.EC 12/03/2007 08:32:50 EC B
85985770 13379 7
12492 3:YMZ7.EC 12/03/2007 08:32:50 EC A
85985771 13380 4
12493
2018 Nov 14
2
Los puntos no tapen el mapa hecho ggplot
...))+
theme(axis.ticks = element_blank())+xlab("") + ylab("")+
geom_point(data=Data,aes(x=lon,y=lat,color=
value),size=1.5) +
scale_colour_gradient2(low = "white", mid =
"blue",high = "red", midpoint = 175,
guide="colourbar",limits=c(0,350))+
labs(title = "Depth of changes"))
.
--
Dr Manuel Mendoza
Department of Biogeography and Global Change
National Museum of Natural History (MNCN)
Spanish Scientific Council...
2003 Jul 11
1
3d plot with different levels done in different colors
I would like a 3d plot of a matrix such that individual trapezoids
that make up the surface are colored according to the z-value of that
point (or preferably the midpoint of its four corners, or something
similar). MS Excel has something like that.
I know that persp can have an nx by ny matrix its "col" argument, I
just don't know how to generate that matrix. To calculate the midpoint
of the tiles for the matrix z, I could use something like
zz <-...