[R] cleaning up a vector

2010-10-01 Thread mlarkin
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 2

[R] [Fwd: Re: cleaning up a vector]

2010-10-01 Thread mlarkin
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" Date:Fri, October 1, 2010

[R] maximum likelihood problem

2010-10-01 Thread mlarkin
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 opt

[R] [Fwd: RE: maximum likelihood problem]

2010-10-01 Thread mlarkin
I forgot to add that I first gave a starting value for K. Nonlinear least squares won't work because my errors are not normally distributed. Any advide on my maximum likelihood function would be greatly appreciated. Original Message Subj