similar to: Converting a function from Splus to R

Displaying 20 results from an estimated 300 matches similar to: "Converting a function from Splus to R"

2004 Dec 09
1
System is computationally singular?
Hi all, I was using the Newton-Raphson method to estimate paremeters in the model developed by my supervisor. However, when I interatively computed theta(t+1)=theta(t) - solve(H)*s (where the Hessian matrix and score vector were explicitely derived), I got the error message: Error in solve.default(H) : system is computationally singular: reciprocal condition number = 1.70568e-032. Assume my score
2007 Apr 20
8
Suggestions for statistical computing course
Dear R-helpers, I am planning a course on Statistical Computing and Computational Statistics for the Fall semester, aimed at first year Masters students in Statistics. Among the topics that I would like to cover are linear algebra related to least squares calculations, optimization and root-finding, numerical integration, Monte Carlo methods (possibly including MCMC), bootstrap, smoothing and
2010 Apr 14
2
Gaussian Quadrature Numerical Integration In R
Hi All, I am trying to use A Gaussian quadrature over the interval (-infty,infty) with weighting function W(x)=exp(-(x-mu)^2/sigma) to estimate an integral. Is there a way to do it in R? Is there a function already implemented which uses such weighting function. I have been searching in the statmode package and I found the function "gauss.quad(100, kind="hermite")" which uses
2009 Dec 06
5
optim with constraints
Hi, dear R users I am a newbie in R and I wantto use the method of meximum likelihood to fit a Weibull distribution to my survival data. I use "optim" as follows: optim(c(1, 0.25),weibull.like,mydata=mydata,method="L-BFGS-B",hessian = TRUE) My question is: how do I setup the constraints so that the two parametrs of Weibull to be pisotive? Or should I use other function
2008 Oct 01
2
Bivariate normal
Package mvtnorm provides dmvnorm, pmvnorm that can be used to compute Pr(X=x,Y=y) and Pr(X<x,Y<y) for a bivariate normal. Are there functions that would compute Pr(X<x,Y=y)? I'm currently using "integrate" with dmvnorm but it is too slow.
2011 Nov 06
2
how to use quadrature to integrate some complicated functions
Hello to all, I am having trouble with intregrating a complicated uni-dimensional function of the following form Phi(x-a_1)*Phi(x-a_2)*...*Phi(x-a_{n-1})*phi(x-a_n). Here n is about 5000, Phi is the cumulative distribution function of standard normal, phi is the density function of standard normal, and x ranges over (-infty,infty). My idea is to to use quadrature to handle this integral. But
2006 Oct 02
1
Trig.Rd typo (PR#9269)
Full_Name: Robin Hankin Version: 2.4.0 RC OS: MacOSX 10.4.7 Submission from: (NULL) (139.166.242.29) The first cut line described in Trig.Rd for asin() is incorrect in the ascii version of the manpage. The Rd file reads: For \code{asin()} and \code{acos()}, there are two cuts, both along the real axis: \eqn{\left(-\infty, -1\right]}{\(-Inf, 1\]} and Note the inconsistency between the
2010 Sep 21
3
bivariate vector numerical integration with infinite range
Dear list, I'm seeking some advice regarding a particular numerical integration I wish to perform. The integrand f takes two real arguments x and y and returns a vector of constant length N. The range of integration is [0, infty) for x and [a,b] (finite) for y. Since the integrand has values in R^N I did not find a built-in function to perform numerical quadrature, so I wrote my own after
2012 May 23
1
numerical integration
Greetings, Sorry, the last message was sent by mistake! Here it is again: I encounter a strange problem computing some numerical integrals on [0,oo). Define $$ M_j(x)=exp(-jax) $$ where $a=0.08$. We want to compute the $L^2([0,\infty))$-inner products $$ A_{ij}:=(M_i,M_j)=\int_0^\infty M_i(x)M_j(x)dx $$ Analytically we have $$ A_{ij}=1/(a(i+j)). $$ In the code below we compute the matrix
2008 Mar 12
3
Types of quadrature
Dear R-users I would like to integrate something like \int_k^\infty (1 - F(x)) dx, where F(.) is a cumulative distribution function. As mentioned in the "integrate" help-page: integrate(dnorm,0,20000) ## fails on many systems. This does not happen for an adaptive Simpson or Lobatto quadrature (cf. Matlab). Even though I am hardly familiar with numerical integration the implementation
2006 Nov 18
1
Questions regarding "integrate" function
Hi there. Thanks for your time in advance. I am using R 2.2.0 and OS: Windows XP. My final goal is to calculate 1/2*integral of (f1(x)^1/2-f2(x)^(1/2))^2dx (Latex codes: $\frac{1}{2}\int^{{\infty}}_{\infty} (\sqrt{f_1(x)}-\sqrt{f_2(x)})^2dx $.) where f1(x) and f2(x) are two marginal densities. My problem: I have the following R codes using "adapt" package. Although "adapt"
2011 Mar 16
2
Re; Fitting a Beta distribution
I want to fit some p-values to a beta distribution. But the problem is some of the values have 0s and 1's. I am getting an error if I use the MASS function to do this. Is there anyway to get around this? -- Thanks, Jim. [[alternative HTML version deleted]]
2008 Jan 07
2
chi-squared with zero df (PR#10551)
Full_Name: Jerry W. Lewis Version: 2.6.1 OS: Windows XP Professional Submission from: (NULL) (24.147.191.250) pchisq(0,0,ncp=lambda) returns 0 instead of exp(-lambda/2) pchisq(x,0,ncp=lambda) returns NaN instead of exp(-lambda/2)*(1 + SUM_{r=0}^infty ((lambda/2)^r / r!) pchisq(x, df + 2r)) qchisq(.7,0,ncp=1) returns 1.712252 instead of 0.701297103 qchisq(exp(-1/2),0,ncp=1) returns 1.238938
2008 Mar 26
2
choose fails a fundamental property of binomial coefficients (PR#11035)
Full_Name: Jerry W. Lewis Version: 2.7.0 (2008-03-23 r44847) OS: Windows XP Professional Submission from: (NULL) (71.184.230.48) choose(n,k) = choose(n,n-k) is not satisfied if either 1. n is a negative integer with k a positive integer (due to automatically returning 0 for n-k<0) 2. n is not an integer with k a positive integer (due to rounding n-k to an integer, compounded by
2005 Jan 21
2
[LLVMdev] making cygwin nightly builds available?
Hello, Reid. You wrote Friday, January 21, 2005, 11:14:41 PM: RS> FYI, work progresses on the Win32 native port which you might also find RS> interesting. It might even get done before the cygwin stuff. Jeff Cohen RS> is working on that. Perhaps he can indicate the status of that effort. There is too much work to do native Win32 builds. I've tried to get llvm compiled on mingw32
2002 Dec 01
1
SYSLINUX COM32 example in assembly (NASM)
Hello Where can I get example in assembly, using COM32 API ? I'm trying to make simple "Hello World" using COM32, but this code does not works 8-( org 0x101000 ; this number I get from comboot.doc _start: mov ecx,msge-msg mov ebx,msg mov ah,0x02 .L: mov dl, byte [ebx] inc ebx int 0x21 loop .L .Z: jmp .Z ; \infty loop msg: db "Hello World !" msge:
2003 Sep 16
1
calculation of the p value in ks.test()
Hi, I'm working with the ks.test() function and I have also implemented the test using Conover as the reference. My D value matches that produced by R. However to calculate the p value I am using the code described in Numerical Recipes in C++ (2nd Ed.) pg 631. The p value produced by the NRC code is generally larger than that produced by R by a factor of 10. Currently I am not in a position
2009 Dec 10
1
MLE for a t distribution
Given X1,...,Xn ~ t_k(mu,sigma) student t distribution with k degrees of freedom, mean mu and standard deviation sigma, I want to obtain the MLEs of the three parameters (mu, sigma and k). When I try traditional optimization techniques I don't find the MLEs. Usually I just get k->infty. Does anybody know of any algorithms/functions in R that can help me obtain the MLEs? I am especially
2010 May 10
1
Polylogarithm
I am writing to ask if R has a build- in function to calculate this polylogarithm Li_n(z) function , also known as the Jonqui?re's function defined as Li_n(z)=sum_(k=1)^infty(z^k)/(k^n) Thanks Andy
2006 Jun 04
3
Absolutize URLs in a string
I wonder - do we have some helper/processor/gem to automatically convert all URLs in a passed string to their canonical equivalent - i.e. with the protocol, host and such prepended based on the Rails environment. Super-duper infty for RSS feeds (I hate their requirement for canonical URLs everywhere). -- Julian ''Julik'' Tarkhanov please send all personal mail to me at