Displaying 20 results from an estimated 6000 matches similar to: "[Fwd: RE: maximum likelihood problem]"
2010 Oct 01
3
maximum likelihood problem
I am trying to figure out how to run maximum likelihood in R. Here is my
situation:
I have the following equation:
equation<-(1/LR-(exp(-k*T)*LM)*(1-exp(-k)))
LR, T, and LM are vectors of data. I want to R to change the value of k
to maximize the value of equation.
My attempts at optim and optimize have been unsuccessful. Are these the
recommended functions that I should use to maximize
2010 Oct 01
4
cleaning up a vector
I calculated a large vector. Unfortunately, I have some measurement error
in my data and some of the values in the vector are erroneous. I ended up
wih some Infs and NaNs in the vector. I would like to filter out the Inf
and NaN values and only keep the values in my vector that range from 1 to
20. Is there a way to filter out Infs and NaNs in R and end up with a
clean vector?
Mike
2010 Sep 29
2
repeat a function
I have R randomly sampling my array made up of 2 columns of data. Here is
my code randomly sampling 5 different rows from my dataset to create a new
dataset of 8 rows of data:
testdat<-growth[sample(5,8,replace=T),]
Now I want to tell R to repeat this function 50 times and give me the
output. I have been searching the internet and have been unable to figure
this out. Any advice
2010 Sep 29
2
need help with ramdomly sampling some data
I am trying to get R to randomly select values from my dataset (i.e.
bootstrapping) with replacement. However, my attempts at this have been
unsuccessful. Here is a basic example of what I am doing:
I have a data vector of 8 values (i.e. data= 2,5,9,4,5,6,7,8). I used the
sample function and it worked. However, it only repeated my values in the
exact same order as the dataset. It did not
2010 Oct 01
0
[Fwd: Re: cleaning up a vector]
It turns out I didn't have to filter out the 1-20 values.
The code of x[is.finite(x)] did the trick.
Thanks!!!
Mike
---------------------------- Original Message ----------------------------
Subject: Re: [R] cleaning up a vector
From: "Henrique Dallazuanna" <wwwhsd at gmail.com>
Date: Fri, October 1, 2010 1:55 pm
To: mlarkin at rsmas.miami.edu
Cc: r-help
2010 Sep 29
2
resampling issue
I am trying to get R to resample my dataset of two columns of age and length
data for fish. I got it to work, but it is not resampling every replicate.
Instead, it resamples my data once and then repeated it 5 times.
Here is my dataset of 9 fish samples with an age and length for each one:
Age Length
2 200
5 450
6 600
7 702
8 798
5 453
4 399
1 120
2 202
Here is my code which resamples my
2010 Sep 28
1
ramdom sampling from a dataset
I am trying to get R to pick random integers from my dataset (i.e.
bootstrapping) with replacement. However, my attempts at this have been
unsuccessful. Here is a basic example of what I am doing:
I have a data vector of 8 integers (data= 2,5,9,4,5,6,7,8). I used the
sample function and it worked but it only repeated my values in the exact
same order. It did not randomly sample them. Here
2010 Sep 29
1
next step in randomly sampling
Thanks to the people on this list I was able to fix my code for randomly
sampling. Thanks.
Now, I am moving on to the next step and I ran into another snag. I have a
large dataset but I am starting with a small made-up dataset until I figure
it out. I have two columns of data (age and length). I got R to read my
data called growth which is the age and length for 10 fish:
>
2010 Aug 02
1
Confidence Bands in nonlinear regression using optim and maximum likelihood
Hello,
I am trying to plot confidence bands on the mean and prediction bands for the following
nonlinear regression, using maximum likelihood via optim. A toy example with data and
code of what I am trying to accomplish is:
VOL<-c(0.01591475, 1.19147935 ,6.34102460, 53.68809287, 91.90143074, 116.21397007,
146.41843056, 215.64535337, 256.53149673, 315.73609232)
Age <-c(1.622222, 2.833333
2010 Sep 29
2
fitting model to resampled data
I apologize if this comes across as confusing. I will try to explain my
situation as best I can.
I have R bootstrapping my growth data for fish. It's resampling my database
of age and length data and then produces several new datasets for me. In
this case, it's resampling my data to create three new datasets of age and
length data. Here is my code with my original data called
2012 Apr 05
4
Appropriate method for sharing data across functions
In trying to streamline various optimization functions, I would like to have a scratch pad
of working data that is shared across a number of functions. These can be called from
different levels within some wrapper functions for maximum likelihood and other such
computations. I'm sure there are other applications that could benefit from this.
Below are two approaches. One uses the <<-
2008 Aug 12
2
Maximum likelihood estimation
Hello,
I am struggling for some time now to estimate AR(1) process for commodity price time series. I did it in STATA but cannot get a result in R.
The equation I want to estimate is: p(t)=a+b*p(t-1)+error
Using STATA I get 0.92 for a, and 0.73 for b.
Code that I use in R is:
p<-matrix(data$p) # price at time t
lp<-cbind(1,data$lp) # price at time t-1
2003 Mar 12
0
job opportunity
The University of Miami's Rosenstiel School of Marine and Atmospheric
Sciences (RSMAS) is seeking a research associate to work with
hydrographic data. The objective of the project is to develop
statistical models for estimating salinity and density from
observations of temperature together with knowledge of location and
time. Because the relationship between salinity and temperature can
be
2003 Mar 12
0
job opportunity
The University of Miami's Rosenstiel School of Marine and Atmospheric
Sciences (RSMAS) is seeking a research associate to work with
hydrographic data. The objective of the project is to develop
statistical models for estimating salinity and density from
observations of temperature together with knowledge of location and
time. Because the relationship between salinity and temperature can
be
2009 Nov 02
2
a prolem with constrOptim
Hi,
I apologize for the long message but the problem I encountered can't be stated in a few lines.
I am having some problems with the function constrOptim. My goal is to maximize the likelihood of product of K multinomials, each with four catagories under linear constraints on the parameter values. I have found that the function does not work for many data configurations.
#The likelihood
2008 Mar 23
2
scaling problems in "optim"
Dear R users,
I am trying to figure out the control parameter in "optim," especially,
"fnscale" and "parscale."
In the R docu.,
------------------------------------------------------
fnscale
An overall scaling to be applied to the value of fn and gr during
optimization. If negative, turns the problem into a maximization problem.
Optimization is performed on
2004 Sep 29
2
optim "a log-likelihood function"
Hello,
i know that i have to use optim, but i'm confused how its
possible maximize the sum over all l[i] and get the optimized
max(LL), r and alpha?
LL <- function(trans,time){
for(i in 1:length(trans){
l[i] <- log(lgamma(r+trans[i] -
gamma(r+1)*(alpha/alpha+t[i]))**r)*(t[i]/alpha+t[i]))**trans[i]
}
return(sum(l))
}
i'm confused how i have to set r and alpha
and i
2011 Sep 23
0
Error message when using 'optim' for numerical maximum likelihood
Hello All,
I am trying to estimate the parameters of a stochastic differential equation
(SDE) using quasi-maximum likelihood methods but I am having trouble with
the 'optim' function that I am using to optimise the log-likelihood
function.
After simulating the SDE I generated samples of the simulated data of
varying size (I want to see what effect adding more observations has on the
2011 Nov 16
0
Maximum likelihood for censored geometric distribution
Hi all,
I need to check for a difference between treatment groups in the
parameter of the geometric distribution, but with a cut-off (i.e. right
censored). In my experiment I stimulated animals to see whether I got a
response, and stopped stimulating if the animal responded OR if I had
stimulated 10 times. Since the response could only be to a stimulation,
the distribution of response times
2001 Nov 08
3
Problem with optim (method L-BFGS-B)
Hello,
I've just a little problem using the function optim.
Here is the function I want to optimize :
test_function(x){(exp(-0.06751 + 0.25473*((x[1]-350)/150) +
0.04455*((x[2]-40)/20) + 0.09399*((x[3]-400)/100) -
0.17238*((x[4]-250)/50)-
0.45984*((x[5]-550)/150)-0.39508*((x[1]-350)/150)* ((x[1]-350)/150) -
0.05116*((x[2]-40)/20)* ((x[2]-40)/20) -
0.27735*((x[3]-400)/100)*((x[3]-400)/100) -