Displaying 20 results from an estimated 6000 matches similar to: "Numerical integration problem"
2009 Aug 06
2
Convert dataframe to table with counts where column names become row names
Can anyone explain how best to go from a dataframe to a table (or better yet
a new dataframe) of counts, where the row names in the new table (or
dataframe) are the column names of the original df.
start w/
DF1 =
Pos1 Pos2 Pos3 ....
oligo1 G C A
oligo2 U U A
oligo3 G C C
oligo4 C G U
oligo5 A A G
.....
End with
DF2 =
2001 Nov 29
2
plotting (a) confidence intervals (b) standard error
Hi all,
I'm building a plot of the values in tmeant (below) against positions 1 to
5, using matplot.
tmeant looks like this:
case1 case2
pos1 861.8466 818.5909
pos2 961.2841 976.3466
pos3 878.6080 1262.8523
pos4 950.8011 1129.6080
pos5 968.1080 1063.3920
I also have lower (object tl) and upper (object tu) bounds on the
confidence intervals as follows:
tl:
pos1
2010 May 04
1
Avoiding for-loop for splitting vector into subvectors based on positions
Dear all,
I'm trying to optimize code and want to avoid for-loops as much as possible.
I'm applying a calculation on subvectors from a big one, and I get the
subvectors by using a vector of starting positions:
x <- 1:10
pos <- c(1,4,7)
n <- length(x)
I try to do something like this :
pos2 <- c(pos, n+1)
out <- c()
for(i in 1:n){
tmp <- x[pos2[i]:pos2[i+1]]
2007 Jan 19
3
integrate and quadratic forms
Hi all.
I'm trying to numerically invert the characteristic function
of a quadratic form following Imhof's (1961, Biometrika 48)
procedure.
The parameters are:
lambda=c(.6,.3,.1)
h=c(2,2,2)
sigma=c(0,0,0)
q=3
I've implemented Imhof's procedure two ways that, for me,
should give the same answer:
#more legible
integral1 = function(u) {
2010 Jul 06
1
plotmath vector problem; full program enclosed
Here's another example of my plotmath whipping boy, the Normal distribution.
A colleague asks for a Normal plotted above a series of axes that
represent various other distributions (T, etc).
I want to use vectors of equations in plotmath to do this, but have
run into trouble. Now I've isolated the problem down to a relatively
small piece of working example code (below). If you would
2005 May 16
1
branch cuts of atan()
Hi
the following gave me a shock:
> atan(2)
[1] 1.107149
> atan(2+0i)
[1] -0.4636476+0i
>
or, perhaps more of a gotcha:
> atan(1.0001+0i)
[1] -0.7853482+0i
> atan(0.9999+0i)
[1] 0.7853482+0i
>
evidently atan()'s branch cuts aren't where I thought they were.
Where do I look for documentation on this?
--
Robin Hankin
Uncertainty Analyst
National
2004 Dec 16
3
Qyery on bark equation in floor0 code
Hi All,
I need some clarifications regarding the mismatch I found in the code
and the specification.
(a) In the specification, the bark(x) equation is given as:
bark(x) = 13.1 atan(.00074x) + 2.24 atan(.0000000158(x^2)) + .0001x
whereas in the code it is given as:
#define toBARK(n)
(13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
Which one of these is the proper one ?
(b)
2001 Aug 12
3
gam() and library( modreg )
Hi,
I'm just wonder if there is an R equivalent function of gam() - which
exist in Splus.
Also does anyone know if the library( modreg ), which comes with the
installation file of R 1.3.0 (Windows version), exists in the previous
versions of R (again, Windows version)? Or does one need to install the
library into the previous versions of R explicitly?
Thanks,
Ko-Kang Wang
2000 Nov 26
2
References for the BARK/MEL stuff
Could someone point me to the BARK/MEL tables that these macros (from vorbis/scales.h) are trying to approximate?
#define toBARK(f) (13.1*atan(.00074*(f))+2.24*atan((f)*(f)*1.85e-8)+1e-4*(f))
#define fromBARK(z) (102.*(z)-2.*pow(z,2.)+.4*pow(z,3)+pow(1.46,z)-1.)
#define toMEL(f) (log(1.+(f)*.001)*1442.695)
#define fromMEL(m) (1000.*exp((m)/1442.695)-1000.)
I was wondering if I could come
2006 Mar 28
2
atan2(1,1i)
Hi
?atan2 says that atan2(y,x)=atan(y/x) for x and y numeric or complex
vectors.
Well, I would expect atan2(1,1i) to be equal to atan(-1i), but
> atan2(1,1i)
Error in atan2(y, x) : Non-numeric argument to mathematical function
> R.version
_
platform powerpc-apple-darwin8.5.0
arch powerpc
os darwin8.5.0
system powerpc, darwin8.5.0
2006 Mar 28
2
atan2(1,1i)
Hi
?atan2 says that atan2(y,x)=atan(y/x) for x and y numeric or complex
vectors.
Well, I would expect atan2(1,1i) to be equal to atan(-1i), but
> atan2(1,1i)
Error in atan2(y, x) : Non-numeric argument to mathematical function
> R.version
_
platform powerpc-apple-darwin8.5.0
arch powerpc
os darwin8.5.0
system powerpc, darwin8.5.0
2004 Jan 21
2
derivative of atan(x) and similar functions
Dear R experts.
'D()' function recognizes some of the analitical functions, such as
sin, cos, etc. But I'd like to take analytical derivatives from asin,
atan etc. functions. Are there any R packages providing that features?
Thanks.
--
Timur.
2006 Apr 04
2
ogg + theora + seeking
Hi all,
I'm actually learning how to use ogg, theora and vorbis. My idea is to create
a small program running, that is able to concatenate ogg video+audio files.
However I have some small questions. Here I will start with the first one:
I read the following for seeking in ogg for a theora key-frame:
---- snipp (http://www.xiph.org/ogg/doc/ogg-multiplex.html) ----
[...]The third point
2005 Apr 14
1
Strange behavior of atan2
Dear all,
I've got a problem with the function atan2. For a couple of coordinates
x and y,
This function returns the angle between the vector of coordinates (x, y)
and the
abscissa axis, i.e. it is the same as atan(y/x) (as indicated on the
help page).
If we consider the vector with coordinates x = 0 and y = 0, we have
the following result:
> atan(0/0)
[1] NaN
This is expected.
2005 Aug 17
1
GLM/GAM and unobserved heterogeneity
Hello,
I'm interested in correcting for and measuring unobserved
heterogeneity ("missing variables") using R. In particular, I'm
searching for a simple way to measure the amount of unobserved
heterogeneity remaining in a series of increasingly complex models
(adding additional variables to each new model) on the same data.
I have a static database of 400,000 or
2014 Mar 20
2
BARK implementation (or specification) error
Hi,
In the course of some work which I describe below, I have found a very significant difference between the BARK function described in the Vorbis specification and its implementation in libvorbis.
In the specificationhttp://xiph.org/vorbis/doc/Vorbis_I_spec.pdf
bark(x) = 13.1arctan(.00074x) + 2.24arctan(.0000000185x**2 + .0001x)
In the libvorbis code
2004 Apr 11
3
pcauchy precision (PR#6756)
Full_Name: Morten Welinder
Version: snapshot
OS:
Submission from: (NULL) (65.213.85.129)
Two things are wrong.
1. There is nan test outside IEEE_754.
2. The meat part of the function should really be something like...
if (!lower_tail)
x = -x;
if (fabs (x) > 1) {
double temp = atan (1 / x) / M_PI;
return (x > 0) ? R_D_Clog (temp) : R_D_val (-temp);
} else
2008 Feb 06
2
kinship package: drawing pedigree error
Hi
Im using the kinship package to draw a pedigree. On my data set this works fine but when i add indivudals to the pedigree i keep getting an error i hope someone can help me!
This is the code im using:
Data<-read.table("Tree.txt", header=T, sep=",")
attach(Data)
ped<-pedigree(id, dadid, momid, sex, aff)
par(xpd=T)
plot.pedigree(ped)
This is my data looks like
2009 Aug 27
2
setting par(srt) according to plot aspect ratio
How can I look up the aspect ratio of a plot, so I can use that to correctly
adjust the angle of text which is supposed to be parallel to a line in the
plot?
The following example code works for a 1:1 aspect ratio, but puts the text
at the wrong angle if the plot region is short and wide or tall and narrow.
I can't find a par() component containing the plot aspect ratio. It will
be for
2008 May 27
5
Rotated text on a regression line
Dear all,
I stumbled over a problem recently when trying to use srt with text() on a
windows device.
What I intended to do was to plot a simple regression line, and to rotate
a piece of text such that the text has the same angle as the regression
line.
However, the text is always plotted in a slightly wrong angle:
####
x=1:10 #create arbitrary x and y values
y=x*2-rnorm(1:10)