[R] If Statement

2011-03-08 Thread dpender
Hi, I am having some problems using the if statement correctly. I have used it many times previously so I dona't know what is different with this case. Here is my problem: I have a 1X10 matrix of values as follows: H.MC [,1] [1,] 4.257669 [2,] 7.023242 [3,] 4.949857 [4,]

[R] MLE

2011-02-23 Thread dpender
Hi, I am having problems carrying out a mle for 3 parameters in a non-homogenous poisson process. I am trying to use the optim function to minimise the -ve log-likelihood. When I use assumed values of my three parameters (20,1,1) the -ve log-likelihood function returns a value of 1309122 but I

[R] mle

2011-02-22 Thread dpender
Hi, I am looking for some help regarding the use of the mle function. I am trying to get mle for 3 parameters (theta0, theta1 and theta2) that have been defined in the the log-likelihood equation as theta0=theta[1], theta1=theta[2] and theta2=theta[3]. My R code for mle is: mle(Poisson.lik,

[R] mle

2011-02-22 Thread dpender
Hi, I am looking for some help regarding the use of the mle function. I am trying to get mle for 3 parameters (theta0, theta1 and theta2) that have been defined in the the log-likelihood equation as theta0=theta[1], theta1=theta[2] and theta2=theta[3]. My R code for mle is: mle(Poisson.lik,

[R] Function within functions and MLE

2011-02-21 Thread dpender
Hi, I am trying to determine the MLE of the following function: http://r.789695.n4.nabble.com/file/n3317341/untitled.bmp I have defined both parts of the equation as separate functions and looped over the t and G values to get summations of each part. The lamda function has 3 unknowns

Re: [R] uniroot

2011-02-07 Thread dpender
Thanks for your advice. There was an error in the equation that is was copying. Doug -- View this message in context: http://r.789695.n4.nabble.com/uniroot-tp3260090p3264288.html Sent from the R help mailing list archive at Nabble.com. __

[R] uniroot

2011-02-04 Thread dpender
Hi, I am using the uniroot function in order to carry out a bivariate Monte Carlo simulation using the logistics model. I have defined the function as: BV.FV - function(x,y,a,A) (((x^(-a^-1)+y^(-a^-1))^(a-1))*(y^(a-1/a))*(exp(-((1^(-a^-1)+y^(-a^-1))^a)+y^-1)))-A and the procedure is as

[R] Storm Clustering using clusters in evd

2011-01-21 Thread dpender
Hi, I am using the clusters function in the evd package in order to determine storm events from a wave time series. So far I have the code working as I want it for wave height on its own but I would now like to include the period as well. The input data is in the form of: H t H t H t so

[R] clusters in evd package

2010-11-17 Thread dpender
Hi, I am using the clusters function in the evd package and was wondering if anyone knew how to set the row names as date/time objects. My data has 1 column of date and time and another of wave height (H). My two options are: 1 - When in import the data using read.table make sure that the

[R] clusters in evd package

2010-11-13 Thread dpender
Hi, I am using the clusters function in the evd package and was wondering if anyone knew how to set the row names as date/time objects. My data has 1 column of date and time and another of wave height (H). My two options are: 1 - When in import the data using read.table make sure that the

Re: [R] Plot Axes

2010-11-11 Thread dpender
Thanks Jim, The next issue is how i get the RP lines to cut the axes. The lines either cut the x axis at D=35 or the y axis at H=4.5. How do I set the axes so that the lines start and end on the axes? http://r.789695.n4.nabble.com/file/n3037496/plot.jpeg -- View this message in context:

[R] Plot Axes

2010-11-10 Thread dpender
R community, I am creating a bivariate return level plot by adding calculated return period values as lines onto an existing plot using the following code with the points representing the return periods. plot(H2,D2,pch=+,axes=TRUE) points(H.10,D.10, type=l,col=blue) points(H.20,D.20,

Re: [R] Plot Axes

2010-11-10 Thread dpender
http://r.789695.n4.nabble.com/file/n3036574/plot.jpeg -- View this message in context: http://r.789695.n4.nabble.com/Plot-Axes-tp3036571p3036574.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Clustering

2010-10-30 Thread dpender
David Winsemius wrote: On Oct 29, 2010, at 12:08 PM, David Winsemius wrote: On Oct 29, 2010, at 11:37 AM, dpender wrote: Apologies for being vague, The structure of the output is as follows: Still no code? I am using the Clusters function from the evd package $ cluster1

Re: [R] Clustering

2010-10-29 Thread dpender
That's helpful but the reason I'm using clusters in evd is that I need to specify a time condition to ensure independence. I therefore have an output in the form Cluster[[i]][j-k] where i is the cluster number and j-k is the range of values above the threshold taking account of the time

Re: [R] Clustering

2010-10-29 Thread dpender
Apologies for being vague, The structure of the output is as follows: $ cluster1 : Named num [1:131] 3.05 2.71 3.26 2.91 2.88 3.11 3.21 -1 2.97 3.39 ... ..- attr(*, names)= chr [1:131] 6667 6668 6669 6670 ... With 613 clusters. What I require is abstracting the first and last value of

[R] Clustering

2010-10-28 Thread dpender
I am looking to use R in order to determine the number of extreme events for a high frequency (20 minutes) dataset of wave heights that spans 25 years (657,432) data points. I require the number, spacing and duration of the extreme events as an output. I have briefly used the clusters function

[R] datetime objects

2010-10-26 Thread dpender
I am trying to create an array of date time objects using the strptime function. The first entry is in the form 1/1/1981 0:00 and U use; strptime(datetime, %m/%d/%Y %H:%M) which gives 1981-01-01 EST. How do I alter this to give me 1981-01-01 0:00 EST? Thanks in advance, Doug -- View this

[R] difftime error

2010-10-25 Thread dpender
R community, I am trying to create an array of the time differences between datapoints for a very large set. For some reason for 4 of the values the difference has been calculated as NA. Looking at the individual points two of them are 1981-03-29 01:40:00 and 1981-03-29 02:00:00 This is the

Re: [R] difftime error

2010-10-25 Thread dpender
That's it exactly. Do you know how to specify the timezone for Sydney, Australia? -- View this message in context: http://r.789695.n4.nabble.com/difftime-error-tp3010105p3010175.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Create Arrays

2010-10-15 Thread dpender
Hi Gerrit, Almost it but I need to insert M[,i] as well as (matrix( -1, nrow( M), CN[i]) when CN[i] = 0 I know this is not correct but can something like the following be done? HH - c(0.88, 0.72, 0.89, 0.93, 1.23, 0.86, 0.98, 0.85, 1.23) TT - c(7.14, 7.14, 7.49, 8.14, 7.14, 7.32, 7.14, 7.14,

[R] Create Arrays

2010-10-15 Thread dpender
Hi, For this example: O - c(0 0 0 2 0 0 2 0) I want to create an array every time O[i] 0. The array should be in the form; R[j] - array(-1, dim=c(2,O[i])) i.e. if O[i] 0 4 times I want 4 R arrays. Does anyone have any suggestions? Thanks, Doug -- View this message in context:

Re: [R] Create Arrays

2010-10-15 Thread dpender
Barry, Gerrit, That was what I am after but unfortunately only the starting point. I am now trying to amend a function that inserts the R matrices into a dataset in the correct places: i.e. H - c(0.88, 0.72, 0.89, 0.93, 1.23, 0.86, 0.98, 0.85, 1.23) T - c(7.14, 7.14, 7.49, 8.14, 7.14, 7.32,

Re: [R] Data Gaps

2010-10-14 Thread dpender
Thanks Dennis. One more thing if you don't mind. How to I abstract the individual H and T “arrays” from f(m,o,l) so as I can combine them with a date/time array and write to a file? Sorry if it’s a simple question but I’m completely new to R. Cheers, Doug -- View this message

Re: [R] Building ragged dataframe (was Re: Data Gaps)

2010-10-14 Thread dpender
The H and T values come form the same recording so the gaps that require filling in H are the same as those in T. Therefore the lists will never be of unequal lengths and I can abstract the list to an array using array(unlist(H)) which is a lot simpler. My fault for not clarifying!

[R] Data Gaps

2010-10-13 Thread dpender
R community, I am trying to write a code that fills in data gaps in a time series. I have no R or statistics background at all but the use of R is proving to be a large portion of my PhD research. So far my code identifies where and the number of new entries required but I do not know how to

[R] Date Time Objects

2010-10-13 Thread dpender
I am trying to convert an array from numeric values back to date and time format. The code I have used is as follows; for (i in 0:(length(DateTime3)-1)) { DateTime3[i] - (strptime(start, %m/%d/%Y %H:%M)+ i*interval) where start - [1] 1/1/1981 00:00 However the created array

Re: [R] Data Gaps

2010-10-13 Thread dpender
, Dennis On Wed, Oct 13, 2010 at 1:24 AM, dpender d.pen...@civil.gla.ac.uk wrote: R community, I am trying to write a code that fills in data gaps in a time series. I have no R or statistics background at all but the use of R is proving to be a large portion of my PhD research. So far

Re: [R] Date Time Objects

2010-10-13 Thread dpender
Thanks Henrique, Do you have any idea why the first entry doesn't have the time as the start specified is 1/1/1981 00:00? Is it something to do with being at midnight? Doug -- View this message in context: http://r.789695.n4.nabble.com/Date-Time-Objects-tp2993524p2993640.html Sent from the

Re: [R] Date Time Objects

2010-10-13 Thread dpender
Perfect. Thanks -- View this message in context: http://r.789695.n4.nabble.com/Date-Time-Objects-tp2993524p2993663.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list