Displaying 20 results from an estimated 10000 matches similar to: "Error reporting in R"
2008 Oct 24
3
Computational problems in R
Dear all,
I would be grateful if anyone can help me with the following:
My aim is to compute explicitely the sum S=A+B where A=sum(exp(c_i/d)),
i=1,...,n;
B, c_i, and d are real numbers with -Inf<B,c_i<+Inf; and d>0.
The problem is that when c_i/d >710 (for some i) R is setting
exp(c_i/d) to be equal to +Inf and hence the whole summation S.
So in simple cases where for example c_i=8
2011 Apr 26
1
Running Fortran code from R
Dear R users,
I have a Fortran code that I would like to compile and call from R later.
I have never worked with Fortran before. Does anyone know the steps to create Fortran DLLs for R on a Windows PC.
Is anyone aware of a manual (or does anyone know how to) that explains:
- What tools and software I need to download for that
- How to set the paths in my PC
- What
2009 Dec 11
2
Regularized gamma function/ incomplete gamma function
Dear all,
I would be very grateful if you could help me with:
Given the regularized gamma function Reg=int_0^r (x^(k-1)e^(-x))dx/int_0^Inf (x^(k-1)e^(-x))dx ; 0<r<Inf (which is eventually the ratio of the
Incomplete gamma function by the gamma function), does anyone know of a package in R that would evaluate the derivative of the inverse of Reg with respect to k? I am aware that the
2009 Apr 08
3
MLE for bimodal distribution
Hello everyone,
I'm trying to use mle from package stats4 to fit a bi/multi-modal
distribution to some data, but I have some problems with it.
Here's what I'm doing (for a bimodal distribution):
# Build some fake binormally distributed data, the procedure fails also with
real data, so the problem isn't here
data = c(rnorm(1000, 3, 0.5), rnorm(500, 5, 0.3))
# Just to check
2005 Sep 06
2
fitting distributions with R
Dear all
I've got the dataset
data:2743;4678;21427;6194;10286;1505;12811;2161;6853;2625;14542;694;11491;
?? ?? ?? ?? ?? 14924;28640;17097;2136;5308;3477;91301;11488;3860;64114;14334
I know from other testing that it should be possible to fit the data with the
exponentialdistribution. I tried to get parameterestimates for the
exponentialdistribution with R, but as the values
of the parameter
2007 Apr 09
1
R:Maximum likelihood estimation using BHHH and BFGS
Dear R users,
I am new to R. I would like to find *maximum likelihood estimators for psi
and alpha* based on the following *log likelihood function*, c is
consumption data comprising 148 entries:
fn<-function(c,psi,alpha)
{
s1<-sum(for(i in 1:n){(c[i]-(psi^(-1/alpha)*(lag(c[i],-1))))^2*
(lag(c[i],-1)^((-2)*(alpha+1))
)});
s2<- sum(for(m in 1:n){log(lag(c[m],-1)^(((2)*alpha)+2))});
2008 Mar 11
1
messages from mle function
Dears useRs,
I am using the mle function but this gives me the follow erros that I
don't understand. Perhaps there is someone that can help me.
thank you for you atention.
Bernardo.
> erizo <- read.csv("Datos_Stokes_1.csv", header = TRUE)
> head(erizo)
EDAD TALLA
1 0 7.7
2 1 14.5
3 1 16.9
4 1 13.2
5 1 24.4
6 1 22.5
> TAN <-
2008 Oct 09
2
Help MLE
Dear,
I'm starting on R language. I would like some help to implement a MLE
function.
I wish to obtain the variables values (alpha12, w_g12, w_u12) that maximize
the function LL = Y*ln(alpha12 + g*w_g12 + u*w_u12).
Following the code:
rm(list=ls())
ls()
library(stats4)
Model = function(alpha12,w_g12,w_u12)
{
Y = 1
u = 0.5
g = -1
Y*log(alpha12 + g*w_g12 + u*w_u12)
}
res =
2011 Jun 14
1
Using MLE Method to Estimate Regression Coefficients
Good Afternoon,
I am relatively new to R and have been trying to figure out how to estimate regression coefficients using the MLE method. Some background: I am trying to examine scenarios in which certain estimators might be preferred to others, starting with MLE. I understand that MLE will (should) produce the same results as Ordinary Least Squares if the assumption of normality holds. That
2008 Oct 23
1
distribution fitting
Dear R-help readers,
I am writing to you in order to ask you a few questions about distribution
fitting in R.
I am trying to find out whether the set of event interarrival times that I
am currently analyzing is distributed with a Gamma or General Pareto
distribution. The event arrival granularity is in minutes and interarrival
times are in seconds, so the values I have are 0, 60, 120, 180, and
2008 Oct 20
2
R Newbie Question
Hello list,
I just started R today and tried something quite simple. I wanted to
create a colored plot and eventually after hours of fiddling around got
it working. However, my solution seems very suboptimal and I'd really
appreciate your hints on how to improve. I believe that R already offers
many functions I coded (e.g. distance between two vectors, vector
length, vector normalization and
2008 Jun 24
2
L-BFGS-B needs finite values of 'fn'
Hi,
When I run the following code,
r <- c(3,4,4,3,5,4,5,9,8,11,12,13)
n <- rep(15,12)
x <- c(0, 1.1, 1.3, 2.0, 2.2, 2.8, 3.7, 3.9, 4.4, 4.8, 5.9, 6.8)
x <- log10(x)
fr <- function(c, alpha, beta) {
P <- c + (1-c) * pnorm(alpha + beta * x)
P <- pmax(pmin(P,1),0)
-(sum(log(choose(n,r))) + sum(r * log(P)) + sum((n -r)* log(1-P)))
}
fit <- mle((fr), start = list(c
2011 Sep 27
2
Error in optim function.
I'm trying to calculate the maximum likelihood estimate for a binomial
distribution. Here is my code:
y <- c(2, 4, 2, 4, 5, 3)
n <- length(y)
binomial.ll <- function (pi, y, n) { ## define log-likelihood
output <- y*log(pi)+(n-y)*(log(1-pi))
return(output)
}
binomial.mle <- optim(0.01, ## starting value
binomial.ll,
2006 Mar 14
1
Ordered logistic regression in R vs in SAS
I tried the following ordered logistic regression in R:
mod1 <- polr(altitude~sp + wind_dir + wind_speed + hr, data=altioot)
But when I asked The summary of my regression I got the folloing error message:
> summary (mod1)
Re-fitting to get Hessian
Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) :
the initial value of 'vmin' is not
2007 Aug 29
5
Round Robin trafic shapping
I have this problem:
I have an Internet line input with variable speed. I have a max speed and a
min speed: Vmax and Vmin.
The speed is always changing between Vmax and Vmin. I want to share the
actual bandwidth (you don''t not how much, you only know the speed is between
Vmax and Vmin) for N clients. The bandwidth should be shared so nobody can
get more bandwidth than the others.
2013 Apr 09
5
Error when using fitdist function in R
Hello everyone,
I was trying to do some distribution fitting with a numerical field called
Tolls. The sample size = 999 rows.
Basically I assigned the Toll data to a new variable K by doing:
k<-dtest$Toll
After that, tried to fit a gamma distribution by doing: fitG<-fitdist(k,
"gamma")
Then the following messages showed (oh and I checked for empty rows before
doing this):
2010 Jul 08
2
Using nlm or optim
Hello,
I am trying to use nlm to estimate the parameters that minimize the
following function:
Predict<-function(M,c,z){
+ v = c*M^z
+ return(v)
+ }
M is a variable and c and z are parameters to be estimated.
I then write the negative loglikelihood function assuming normal errors:
nll<-function(M,V,c,z,s){
n<-length(Mean)
logl<- -.5*n*log(2*pi) -.5*n*log(s) -
2012 May 08
1
optim question
Hello,
I used optim to find the MLE estimates of some parameters. See the code
below. It works for data1(x). but It did not work for data2 and the error
says" L-BFGS-B needs finite values of 'fn' ".
data2: c(x, 32) that is, if I added the number 32 at the end of data1.
The error appears "non-finite function value" etc.
Any comments or suggestions?
Thanks!
2019 Feb 19
1
mle (stat4) crashing due to singular Hessian in covariance matrix calculation
Hi, R developers.
when running mle inside a loop I found a nasty behavior. From time to
time, my model had a degenerate minimum and the loop just crashed. I
tracked it down to "vcov <- if (length(coef)) solve(oout$hessian)" line,
being the hessian singular.
Note that the minimum reached was good, it just did not make sense to
calculate the covariance matrix as the inverse of a
2006 Feb 02
2
how to use mle?
>Y
[,1] [,2] [,3]
[1,] 0 1 0
[2,] 0 1 0
[3,] 0 0 1
[4,] 1 0 0
[5,] 0 0 1
[6,] 0 0 1
[7,] 1 0 0
[8,] 1 0 0
[9,] 0 0 1
[10,] 1 0 0
>X
pri82 pan82
1 0 0
2 0 0
3 1 0
4 1 0
5 0 1
6 0 0
7 1 0
8 1 0
9 0 0
10