# [R] How to estimate the parameter for many variable?

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Fri Jul 9 08:14:49 CEST 2021

```Hi Siti,
I think some progress has been made. You have a data set with 888 rows
and 19 columns:

dim(ow2)
[1] 888  19

The values may be parts per million ozone in the atmosphere. The
columns may represent different measuring locations and my guess is
that rows are times of measurement, perhaps in weeks given the name.
If so, you might have run ismev::gev.fit() on all of the columns,
looking for estimated maxima at each location. Is this at all close to
what you are doing?

Jim

On Fri, Jul 9, 2021 at 9:59 AM SITI AISYAH ZAKARIA
<aisyahzakaria using unimap.edu.my> wrote:
>
> Dear all,
>
> Thank you very much for the feedback.
>
>
> Here, I explain again.
>
> I use this package to run my coding.
>
> library(ismev)
> library(mgcv)
> library(nlme)
>
> The purpose of this is I want to get the value of parameter estimation using MLE by applying the GEV distribution.
>
> x <- data.matrix(Ozone_weekly2)                      x refers to my data that consists of 19 variables. I will attach the data together.
> x
> ti = matrix(ncol = 3, nrow = 888)
> ti[,1] = seq(1, 888, 1)
> ti[,2]=sin(2*pi*(ti[,1])/52)
> ti[,3]=cos(2*pi*(ti[,1])/52)
>
> for(i in 1:nrow(x))
>   + { for(j in 1:ncol(x))                            the problem in here, i don't no to create the coding. i target my output will come out in matrix that
>     + {x[i,j] = 1}}                                       show the parameter estimation for 19 variable which have 19 row and 3 column
>                                                               row -- refer to variable (station)  ; column -- refer to parameter estimation for GEV distribution
>
> thank you.
>
> On Thu, 8 Jul 2021 at 18:40, Rui Barradas <ruipbarradas using sapo.pt> wrote:
>>
>> Hello,
>>
>> Also, in the code
>>
>> x <- data.matrix(Ozone_weekly)
>>
>> [...omited...]
>>
>> for(i in 1:nrow(x))
>>    + { for(j in 1:ncol(x))
>>      + {x[i,j] = 1}}
>>
>> not only you rewrite x but the double for loop is equivalent to
>>
>>
>> x[] <- 1
>>
>>
>> courtesy R's vectorised behavior. (The square parenthesis are needed to
>> keep the dimensions, the matrix form.)
>> And, I'm not sure but isn't
>>
>>
>> equivalent to
>>
>>
>> ?
>>
>> Like Jim says, we need more information, can you post Ozone_weekly2 and
>> the code that produced gev.fit? But in the mean time you can revise your
>> code.
>>
>> Hope this helps,
>>
>>
>>
>> Às 11:08 de 08/07/21, Jim Lemon escreveu:
>> > Hi Siti,
>> > idea what "Ozone_weekly2" is and Google is also ignorant. "gev.fit" is
>> > also unknown. The name suggests that it is the output of some
>> > regression or similar. What function produced it, and from what
>> > library? "ti" is known as you have defined it. However, I don't know
>> > what you want to do with it. Finally, as this is a text mailing list,
>> > we don't get any highlighting, so the text to which you refer cannot
>> > be identified. I can see you have a problem, but cannot offer any help
>> > right now.
>> >
>> > Jim
>> >
>> > On Thu, Jul 8, 2021 at 12:06 AM SITI AISYAH ZAKARIA
>> > <aisyahzakaria using unimap.edu.my> wrote:
>> >>
>> >> Dear all,
>> >>
>> >> Can I ask something about programming in marginal distribution for spatial
>> >> extreme?
>> >> I really stuck on my coding to obtain the parameter estimation for
>> >> univariate or marginal distribution for new model in spatial extreme.
>> >>
>> >> I want to run my data in order to get the parameter estimation value for 25
>> >> stations in one table. But I really didn't get the idea of the correct
>> >> coding. Here I attached my coding
>> >>
>> >> x <- data.matrix(Ozone_weekly2)
>> >> x
>> >> ti = matrix(ncol = 3, nrow = 888)
>> >> ti[,1] = seq(1, 888, 1)
>> >> ti[,2]=sin(2*pi*(ti[,1])/52)
>> >> ti[,3]=cos(2*pi*(ti[,1])/52)
>> >> for(i in 1:nrow(x))
>> >>    + { for(j in 1:ncol(x))
>> >>      + {x[i,j] = 1}}
>> >>
>> >> My problem is highlighted in red color.
>> >> And if are not hesitate to all. Can someone share with me the procedure,
>> >> how can I map my data using spatial extreme.
>> >> For example:
>> >> After I finish my marginal distribution, what the next procedure. It is I
>> >> need to get the spatial independent value.
>> >>
>> >> That's all
>> >> Thank you.
>> >>
>> >> --
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> "..Millions of trees are used to make papers, only to be thrown away
>> >> after a couple of minutes reading from them. Our planet is at stake. Please
>> >> be considerate. THINK TWICE BEFORE PRINTING THIS.."
>> >>
>> >> DISCLAIMER: This email \ and any files transmitte...{{dropped:24}}
>> >>
>> >> ______________________________________________
>> >> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> >> https://stat.ethz.ch/mailman/listinfo/r-help
>> >> and provide commented, minimal, self-contained, reproducible code.
>> >
>> > ______________________________________________
>> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > and provide commented, minimal, self-contained, reproducible code.
>> >
>
>
>
> "..Millions of trees are used to make papers, only to be thrown away after a couple of minutes reading from them. Our planet is at stake. Please be considerate. THINK TWICE BEFORE PRINTING THIS.."
>
> DISCLAIMER: This email and any files transmitted with it are confidential and intended solely for the use of the individual orentity to whom they are addressed. If you have received this email in error please notify the UniMAP's Email Administrator. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the university. Finally, the recipient should check this email and any attachments for the presence of viruses.The university accepts no liability for any damage caused by any virus transmitted by this email.
>
> Universiti Malaysia Perlis (UniMAP) | Digital Management & Development Centre (DMDC), Universiti Malaysia Perlis (UniMAP), Pauh Putra Campus, 02600 Arau, Perlis, MALAYSIA | www.unimap.edu.my

```