Displaying 20 results from an estimated 1000 matches similar to: "Trapezoid Rule"
2010 Oct 11
1
MATLAB vrs. R
I need to find the area under a trapezoid for a research-related project. I was able to find the area under the trapezoid in MATLAB using the code:
function [int] = myquadrature(f,a,b)
% user-defined quadrature function
% integrate data f from x=a to x=b assuming f is equally spaced over the interval
% use type
% determine number of data points
npts = prod(size(f));
nint = npts -1; %number of
2018 Jan 17
1
mgcv::gam is it possible to have a 'simple' product of 1-d smooths?
I am trying to test out several mgcv::gam models in a scalar-on-function regression analysis.
The following is the 'hierarchy' of models I would like to test:
(1) Y_i = a + integral[ X_i(t)*Beta(t) dt ]
(2) Y_i = a + integral[ F{X_i(t)}*Beta(t) dt ]
(3) Y_i = a + integral[ F{X_i(t),t} dt ]
equivalents for discrete data might be:
1) Y_i = a + sum_t[ L_t * X_it * Beta_t ]
(2) Y_i
2006 Jan 08
1
confint/nls
I have found some "issues" (bugs?) with nls confidence intervals ...
some with the relatively new "port" algorithm, others more general
(but possibly in the "well, don't do that" category). I have
corresponded some with Prof. Ripley about them, but I thought I
would just report how far I've gotten in case anyone else has
thoughts. (I'm finding the code
2005 Jan 12
4
Finding seasonal peaks in a time series....
I have a seasonal time series. I want to calculate the annual mean
value of the time series at its peak
(say the mean of the three values before the peak, the peak, and the
three values after the peak).
The peak of the time series might change cycle slightly from year to year.
# E.g.,
nPts <- 254
foo <- sin((2 * pi * 1/24) * 1:nPts)
foo <- foo + rnorm(nPts, 0, 0.05)
bar <- ts(foo,
2006 Jan 23
1
too-large notches in boxplot (PR #7690)
PR #7690 points out that if the confidence intervals (+/-1.58
IQR/sqrt(n)) in a boxplot with notch=TRUE are larger than the
hinges -- which is most likely to happen for small n and asymmetric
distributions -- the resulting plot is ugly, e.g.:
set.seed(1001)
npts <- 5
X <- rnorm(2*npts,rep(3:4,each=npts),sd=1)
f <- factor(rep(1:2,each=npts))
boxplot(X~f)
boxplot(X~f,notch=TRUE)
I can
2006 Jan 19
1
nls profiling with algorithm="port" may violate bounds (PR#8508)
[posted to R-devel, no discussion:
resubmitting it as a bug, just so it gets
logged appropriately]
Sorry to report further difficulties with
nls and profiling and constraints ... the problem
this time (which I didn't check for in my last
round of testing) is that the nls profiler doesn't
seem to respect constraints that have been
set when using the port algorithm.
See test code
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 -
2012 Feb 13
1
comment lines sometimes removed from a function on exit from internal R editor
Dear All -
The problem: comment lines in an R function (lines beginning with # ) are *sometimes* removed on leaving the R default editor (same with notepad).
I'm working on a Windows machine with R version 2.14.1.
An example is below. Couldn't find anything that seemed to relate to this in the Changelog. I don't recall encountering this behavior with previous versions of R. Any
2002 Aug 06
1
Questions about lexical scope
Dear R-users,
The numerical integration example given in Gentleman and 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,
2007 Jun 24
2
matlab/gauss code in R
Hi all!
I would like to import a matlab or gauss code to R.
Could you help me?
Bye,
Sebasti?n.
2007/6/23, r-help-request en stat.math.ethz.ch <r-help-request en stat.math.ethz.ch>:
> Send R-help mailing list submissions to
> r-help en stat.math.ethz.ch
>
> To subscribe or unsubscribe via the World Wide Web, visit
>
2013 Jan 26
2
confidence / prediction ellipse
Hi,
I'm using the R library(car) to draw confidence/prediction ellipses in a
scatterplot.
>From what i understood the ellipse() function return an ellipse based
parameters: shape, center, radius .
If i read dataEllipse() function i can see how these parameters are
calculated for a confidence ellipse.
ibrary(car)
a=c(12,12,4,5,63,63,23)
b=c(13,15,7,10,73,83,43)
v <-
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!
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:
2005 Jun 25
2
optimization problem in R ... can this be done?
Im trying to ascertain whether or not the facilities of R are sufficient for solving an optimization problem I've come accross. Because of my limited experience with R, I would greatly appreciate some feedback from more frequent users.
The problem can be delineated as such:
A utility function, we shall call g is a function of x, n ... g(x,n). g has the properties: n > 0, x lies on the
2001 Feb 28
2
Automating the job?
Hi!
I just started to use R recently, and would like to ask a help about
automating the job.
I need to use "kmeans" function with my own 300 data files, and wonder if
it's possible to do it automatically. For example,
> library (mva)
> mydata <- read.table ("data1")
> cl <- kmeans(mydata, 5, 20)
and I just need to save "cl" info (i.e. the center
2006 Oct 09
1
boxplot, notches, etc.
Sorry to repost this, but it looks like it's getting
buried in r-help (originally posted October 5: my experience
says that if it hasn't been answered by then it won't be).
I wouldn't bother, but I'm worried that r-devel might be
better, *and* a previous e-mail of mine on the subject in
January also seemed to get buried.
Synopsis: boxplot notches look weird when notches
are
2006 Oct 05
1
unexpected behavior of boxplot(x, notch=TRUE, log="y")
A function I've been using for a while returned a surprising [to me,
given the data] error recently:
Error in plot.window(xlim, ylim, log, asp, ...) :
Logarithmic axis must have positive limits
After some digging I realized what was going on:
x <- c(10460.97, 10808.67, 29499.98, 1, 35818.62, 48535.59, 1, 1,
42512.1, 1627.39, 1, 7571.06, 21479.69, 25, 1, 16143.85, 12736.96,
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],
2006 Jan 17
0
nls profile with port/constraints
Sorry to report further difficulties with
nls and profiling and constraints ... the problem
this time (which I didn't check for in my last
round of testing) is that the nls profiler doesn't
seem to respect constraints that have been
set when using the port algorithm.
See test code below ...
If I can I will try to hack the code, but I will
probably start by redefining my function with
2011 Jul 13
3
Colors in R
HI everyone,
I''m trying to assign colors to multiple lines in a graph. Problem is I don''t want to type in as many colors as there are lines....is there a way around this? In brief, I''m plotting the logratio for up to 60 samples and want a different color for each sample. Here is the code I''m using now..
Any help is greatly appreciated..
Best
LT
data <-