similar to: Error in integrate(integrand, 0, Inf) : non-finite function value

Displaying 20 results from an estimated 600 matches similar to: "Error in integrate(integrand, 0, Inf) : non-finite function value"

2012 Oct 19
2
likelihood function involving integration, error in nlm
Dear R users, I am trying to find the mle that involves integration. I am using the following code and get an error when I use the nlm function d<-matrix(c(1,1,0,0,0,0,0,0,2,1,0,0,1,1,0,1,2,2,1,0),nrow=10,ncol=2) h<-matrix(runif(20,0,1),10) integ<-matrix(c(0),nrow=10, ncol=2) ll<-function(p){ for (k in 1:2){ for(s in 1:10){ integrand<-function(x)
2012 Oct 17
1
for loop output
Dear R users, In the code below, I am trying to print the result of my loop function. The output first gives me the result for k=1, and then for k=1 and k=2. I only want the last output which is [,1] [,2] [1,] 0.1700065 0.5002659 [2,] 0.3080273 0.4954731 [3,] 0.4844886 0.4544306 [4,] 0.5062987 0.1868154 [5,] 0.5846982 0.4353522 [6,] 0.4332621 0.2202922 [7,] 0.4391985
2014 Sep 23
1
Replication Failure
I have 2 DCs running 4.1.12 that have stopped replicating and are producing these error messages: from dc1: Failed to commit objects: WERR_GENERAL_FAILURE/NT_STATUS_INVALID_NETWORK_RESPONSE [2014/09/23 10:43:35.530000, 0] ../source4/rpc_server/drsuapi/getncchanges.c:1646(dcesrv_drsuapi_DsGetNCChanges) ../source4/rpc_server/drsuapi/getncchanges.c:1646: DsGetNCChanges 2nd replication on
2011 May 30
1
Error in minimizing an integrand using optim
Hi, Am not sure if my code itself is correct. Here's what am trying to do: Minimize integration of a function of gaussian distributed variable 'x' over the interval qnorm(0.999) to Inf by changing value of parameter 'mu'. mu is the shift in mean of 'x'. Code: # x follows gaussian distribution # fx2 to be minimized by changing values of mu # integration to be done over
2011 May 03
2
adaptIntegrate - how to pass additional parameters to the integrand
Hello, I am trying to use adaptIntegrate function but I need to pass on a few additional parameters to the integrand. However, this function seems not to have the flexibility of passing on such additional parameters. Am I missing something or this is a known limitation. Is there a good alternative to such restrictions, if there at all are? Many thanks for your time. HC -- View this message in
2009 Feb 09
2
R equivalent of SAS Cochran-Mantel-Haenszel tests?
In SAS, for a two-way (or 3-way, stratified) table, the CMH option in SAS PROC FREQ gives 3 tests that take ordinality of the factors into account, for both variables, just the column variable or neither. Is there an equivalent in R? The mantelhaen.test in stats gives something quite different (a test of conditional independence for *nominal* factors in a 3-way table). e.g. I'd like to
2007 Apr 15
1
Expression for pedices
I know that this maybe a trivial question. I am not able to plot pedices in graph axes. Instead I am able to plot different math symbols : XLABEL <- expression(paste(cmH,lim(f(x), x %->% 0),"O PEEP")) works well XLABEL <- expression(paste(cmH,[2],"O PEEP")) is considered a wrong expression. Thanks
2012 Aug 09
1
any recommendation for software about prediction analysis of gene expression data
Dear R users, I have a microRNA (similar to microarray) data set with gene expressions and group variables. I'd like to perform (class) prediction analysis to see which genes or gene sets predict the group variable well. I'm at the beginner level. Is there any free software in R or in point/click format that is commonly used and highly recommended? I googled this topic and found
2012 Mar 29
1
How to create arbitrary number of loops in R
Dear R users, I'm wondering how I can generate an arbitrary number of loops in R. For instance, I can generate two "for" loops to get ICC among any two-way combination among 10 variables. Here is the code n<-10 for (i in 1:(n-1)) { for (j in (i+1):n) { icc(cbind(DATA[,i],DATA[,j])) } } If I need three-way combination, then a code with three "for" loops will be:
2003 Dec 11
2
Cochran-Mantel-Haenszel problem
Hello, I've tried to analyze some data with a CMH test. My 3 dimensional contingency tables are 2x2xN where N is usually between 10 and 100. The problem is that there may be 2 strata with opposite counts (the 2x2 contigency table for these are reversed), producing opposite odds ratios that cancle out in the overall statistics. These opposite counts are very important for my analysis, since
2012 Mar 28
2
How to create arbitrary number of loops
Dear R users, I'm wondering how I can generate an arbitrary number of loops in R. For instance, I can generate two "for" loops to get ICC among any two-way combination among 10 variables. Here is the code n<-10 for (i in 1:(n-1)) { for (j in (i+1):n) { icc(cbind(DATA[,i],DATA[,j])) } } If I need three-way combination, then a code with three "for" loops will be:
2008 Apr 19
1
Mantel-Haenszel for 2x2
Hi all, Does anyone know if an R function for the Mantel-Haenszel chi-square for a 2x2 table exists? I’ve also seen it called the randomization Q statistic. Note that I’m not looking for the Cochran-Mantel-Haenszel…I did see that out there as cmh.test. Thanks in advance, Jeff Internal Virus Database is out-of-date. Checked by AVG Free Edition. 11:27 AM [[alternative HTML version
2008 Aug 26
2
Problem with Integrate for NEF-HS distribution
I need to calcuate the cumulative probability for the Natural Exponential Family - Hyperbolic secant distribution with a parameter theta between -pi/2 and pi/2. The integration should be between 0 and 1 as it is a probability. The function "integrate" works fine when the absolute value of theta is not too large. That is, the NEF-HS distribution is not too skewed. However, once the
2010 Dec 22
3
How to integrate a function with additional argument being a vector or matrix?
Dear expeRts, I somehow don't see why the following does not work: integrand <- function(x, vec, mat, val) 1 # dummy return value A <- matrix(runif(16), ncol = 4) u <- c(0.4, 0.1, 0.2, 0.3) integrand(0.3, u, A, 4) integrate(integrand, lower = 0, upper = 1, vec = u, mat = A, val = 4) I would like to integrate a function ("integrand") which gets an "x" value (the
2013 Feb 12
2
integrate function
Hi All, Can any one help to explain why min and max function couldn't work in the integrate function directly. For example, if issue following into R: integrand <- function(x) {min(1-x, x^2)} integrate(integrand, lower = 0, upper = 1) it will return this: Error in integrate(integrand, lower = 0, upper = 1) : evaluation of function gave a result of wrong length However, as min(U,V) =
2011 Nov 10
2
performance of adaptIntegrate vs. integrate
Dear list, [cross-posting from Stack Overflow where this question has remained unanswered for two weeks] I'd like to perform a numerical integration in one dimension, I = int_a^b f(x) dx where the integrand f: x in IR -> f(x) in IR^p is vector-valued. integrate() only allows scalar integrands, thus I would need to call it many (p=200 typically) times, which sounds suboptimal. The
2004 May 05
4
Discontinuities in a simple graph (machine precision?)
Hi, I've got an ugly but fairly simple function: mdevstdev <- function(a){ l <- dnorm(a)/(1-pnorm(a)) integrand <- function(z)(abs(z-l)*dnorm(z)) inted <- integrate(integrand, a, Inf) inted[[1]]/((1- pnorm(a))*sqrt((1 + a*l - l^2))) } I wanted to quickly produce a graph of this over the range [-3,3] so I used: plotit <-function(x=seq(-3,3,0.01),...){
2002 Jun 28
1
integrate function fails! (PR#1718)
Full_Name: José Enrique Chacón Version: 1.5.0 and 1.3.1 OS: Windows Millenium Submission from: (NULL) (158.49.28.155) Dear reader: I was trying to evaluate the L2 error produced when estimating the density function N(0,1) from a sample of size 100 using a kernel density estimate. It produced a strange value. You can reproduce the process by typing samp<-rnorm(100)
2011 Jun 25
1
integration function
Hi all, Can anyone please take a look at the following two functions. The answer does not seem to be right. Thank you very much! f1 <- function(x) {integrand <- function (x, mu){ dnorm(x, mean=mu, sd=1)*dnorm(mu, mean=2, sd=1) } integrate(integrand, -Inf, Inf,x)$val } f2 <- function(x) {integrand <- function (x, mu){
2012 Jan 17
4
Problema para integrar una funcion ajustada a un conjunto de datos con la instruccion sm.density(x)
Estimada comunidad, nuevamente con algo que no se como hacer en R, pero aprendiendo .... El problema es el siguiente: 1. tengo un conjunto de 10 mil datos (n) cuyo valor va entre 0 y 10.000 a los que aplico una funcion sm.density() para obtener una especie de histograma pero con una curva que parece continua. 2. Una vez que obtengo esa curva necesito calcular el area bajo la curva en ciertos