Displaying 20 results from an estimated 52 matches for "trapezoidal".
2002 Aug 06
1
Questions about lexical scope
...function name from "integrate" to "bv.integrate".
To integrate f(x,y)=sin(x + y) over the unit square,
it works:
> bv.integrate(function(x, y) sin(x + y), c(0,0), c(1,1))
[1] 0.773651
(compare with .7736445 calculated from 2sin(1)*(1 - cos(1)))
Then I write a function using trapezoidal rule as follows:
trapezoidal <- function(f, a, b, n=100) {
h <- (b - a)/n
i <- 1:n
sum(f(a + (i - 1)*h), f(a + i*h))*h/2
}
I checked with
> trapezoidal(sin, 0, 1)
[1] 0.4596939
> 1 - cos(1)
[1] 0.4596977
and
> trapezoidal(dnorm, -3, 3)
[1] 0.9972922
> diff(pnorm(...
2010 Oct 08
1
Trapezoid Rule
Dear R Users,
I've never used R before and my professor has asked us to do some
pretty intense programming (or it's intense to me at least). Here is
the question: Modify the function myquadrature inside the script so
that it returns the quadrature of descrete data using the trapezoidal
rule. Modify the call to the function at the bottom of the script so
that is uses your modifies routine to compute the total volume flux
through a transect using descrete observations of bathymetry and
vertically-averaged velocity.
The professor supplied us with some sample code and i'm prett...
2009 Sep 10
1
Friday 11th: Aswath Rao: "Trapezoidal VoIP is Evil" on VoIP Users Conference at Noon EDT
Hi,
We're pleased have a 25-year telephony veteran with us tomorrow,
Aswath Rao. Aswath maintains that "Trapezoidal VoIP is Evil".
Join us and ask questions, make comments, argue about geeky details...
and maybe win a Gigaset S675IP SIP/DECT g722-capable phone with an
additional handset. Those of us who have these phones like them a lot.
All dial in info is here: http://VUC.me - we have a g722 bridge you...
2010 Oct 11
1
MATLAB vrs. R
...d(size(f));
nint = npts -1; %number of intervals
if(npts <=1)
error('need at least two points to integrate')
end;
% set the grid spacing
if(b <=a)
error('something wrong with the interval, b should be greater than a')
else
dx = b/real(nint);
end;
npts = prod(size(f));
% trapezoidal rule
% can code in line, hint: sum of f is sum(f)
% last value of f is f(end), first value is f(1)
% code below
int=0;
for i=1:(nint)
%F(i)=dx*((f(i)+f(i+1))/2);
int=int+dx*((f(i)+f(i+1))/2);
end
%int=sum(F);
Then to call "myquadrature" I did:
% example function call test the u...
2009 Oct 22
5
How to calculate the area under the curve
Hi all,
I would like to calculate the area under the ROC curve for my predictive
model. I have managed to plot points giving me the ROC curve. However, I do
not know how to get the value of the area under.
Does anybody know of a function that would give the result I want using an
array of specificity and an array of sensitivity as input?
Thanks,
Olivier
--
View this message in context:
2012 Sep 08
3
Apply a function to columns of a matrix
Dear All,
as a follow up to my previous e-mail (I think I am getting closer...):
I am trying to apply the trapezoidal functions to a matric column by column. I have the following code:
a <-matrix(c(1:100),ncol=10)
b <-matrix(c(2,4,6,8,10,12,14,16,18,20))
apply(a,2,function(b,a) sum(diff(b)*(a[-1]+a[-length(a)]))/2)
for some reason i get an error message:
Error in FUN(newX[[, i], ...): argument "a&...
2012 Sep 13
2
Shading in prediction intervals
I have the following code for the minimum and maximum of my prediction interval
> y.down=lines(x[x.order], set1.pred[,2][x.order], col=109)
> y.up=lines(x[x.order], set1.pred[,3][x.order], col=109)
domain=min(x):max(x)
polygon(c(domain,rev(domain)),c(y.up,rev(y.down)),col=109)
It doesnt seem to shade the right region, it gives me a trapezoid.
Any help? Thanks!
2013 Feb 20
0
[ANNOUNCE] xf86-video-intel 2.21.3
Release 2.21.3 (2013-02-20)
===========================
A few minor bugfixes, another point release.
* Fix tracking of DRI pixmaps and their backing bo across reparenting. If
we tried to execute a SwapBuffers after a Window was reparented, but
before the DRI client has updated its references, then we would end up
manipulating an exported pixmap without a flush flag set. In the worst
2007 Dec 17
3
integration
Dear All,
I need to perform a numerical integration of one dimensional
fucntions. The extrems of integration are both finite and the functions
I'm working on are quite complicated. I have already tried both area()
and integrate(), but they do not perform well: area() is very slow and
integrate() does not converge. Are in R other functions for numerical
integration of one dimentional
2007 Feb 15
4
integrate over polygon
Hi there,
I want to integrate a function over an irregular polygon. Is there
any function which can implement this easily? Otherwise, I am
thinking of divide the polygon into very small rectangles and use
"adapt" to approximate it. Do you have any suggestions to get the
fine division? Any advice is appreciated.
Haiyong
2005 Sep 28
1
Fast AUC computation
...r Curve (AUC) for many parameter combinations. I am using the ROC
library and the following commands to generate each AUC:
rocobj=rocdemo.sca(truth = ymis, data = model$fitted.values, rule =
dxrule.sca) #generation of observed ROC object
aucobj=AUC(rocobj) #pulling out just the observed AUC - trapezoidal not
integrated
but they are pretty slow.
Does anyone know of a faster way to get the AUC?
Thanks,
Nina
[[alternative HTML version deleted]]
2011 Aug 22
0
CRAN packages maintained by you
It is A Good Thing to regularize Authors and Maintainers of packages,
particularly for citation()
and toBibTex().
Could I add a suggested TODO item for the maintainer of package.skeleton
and friends to
help reinforce this for new packages:
- Please add appropriate templates for Author at R in the skeleton
DESCRIPTION file generated,
indicating the proper format as well as the use of role= to
2013 Feb 05
1
Predictions from the Segmented Package
Hi,
I would like to calculate the area under segmented regression lines (single breakpoints). I had thought that I could do this using the predict() function to ascertain some key x y values in order to determine the dimensions for two trapezoids (under each segment of my regression). However, I've not had any success with this and have just read online that the predict function does not work
2011 Mar 24
2
[Bug 35630] New: NV31: PFIFO_DMA_PUSHER while running x11perf
https://bugs.freedesktop.org/show_bug.cgi?id=35630
Summary: NV31: PFIFO_DMA_PUSHER while running x11perf
Product: xorg
Version: git
Platform: x86 (IA32)
OS/Version: All
Status: NEW
Severity: normal
Priority: medium
Component: Driver/nouveau
AssignedTo: nouveau at lists.freedesktop.org
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
2004 Oct 26
2
integration problem
Dear R users,
I have spectral data (say, wavelength vs. extinction coefficient) for
which I??d like to calculate an integral (i.e. the area underneath the
curve).
Suppose the (artificial) dataset is
lambda E
1 2
2 4
3 5
4 8
5 1
6 5
7 4
8 9
9 8
10 2
How can I calculate an integral for these values using R?
Many thanks for any help!
Regards
Christoph
2011 Aug 02
2
Help with aggregate syntax for a multi-column function please.
Dear R-experts:
I am using a function called AUC whose arguments are data, time, id, and
dv.
data is the name of the dataframe,
time is the independent variable column name,
id is the subject id and
dv is the dependent variable.
The function computes area under the curve by trapezoidal rule, for each
subject id.
I would like to embed this in aggregate to further subset by each Cycle,
DoseDayNominal and Drug, but I can't seem to get the aggregate syntax
correct. All the examples I can find use single column function such as
mean, whereas this AUC function requires four argu...
2013 Feb 01
0
[ANNOUNCE] xf86-video-intel 2.21.0
Release 2.21.0 (2013-02-01)
===========================
A few new features:
* Enable render acceleration for Haswell GT1/GT2.
* Enable multi-threaded rasterisation of trapezoids and fallback composition
* Utilile a new kernel interface (v3.9) for processing relocations
along with a few older features from the 2.20.x series:
* PRIME support for hotplug GPUs and hybrid systems
* Support
2006 Jan 18
2
Display an Image on a Plane
Hi,
I am new to R and I would like to display an image on a plane in a 3D plot,
i.e. I would like to be able to specify a theta and a phi parameters like in
the function persp to display a 2D image on an inclined plane.
Regards,
vincent
[[alternative HTML version deleted]]
2006 Jan 18
2
Display an Image on a Plane
Hi,
I am new to R and I would like to display an image on a plane in a 3D plot,
i.e. I would like to be able to specify a theta and a phi parameters like in
the function persp to display a 2D image on an inclined plane.
Regards,
vincent
[[alternative HTML version deleted]]