Re: [R] Optimization failed in fitdistr (Weibull distribution)

2013-10-30 Thread peter dalgaard

On 29 Oct 2013, at 21:35 , Rolf Turner  wrote:

> On 10/29/13 19:44, peter dalgaard wrote:
> 
> 
>
>> There really is no substitute for knowledge and understanding! Did it not 
>> occur to you that the Windspeed column needs to enter into your analysis?
> 
>
> 
> Fortune!

Actually, I felt that that one came out a bit harsher than actually deserved. 

It’s quite interesting though, that the regular busybodies complained about the 
lack of easily reproducible data, but didn’t pick up on the fact that Frequency 
couldn’t be the right thing to analyze...

> 
>cheers,
> 
>Rolf Turner

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Optimization failed in fitdistr (Weibull distribution)

2013-10-30 Thread Carl Witthoft

Which suggests the OP should verify that the data in "...$Frequency" is the
data he expects to be there.


Rui Barradas wrote
> Hello,
> 
> I can't reproduce your error:
> 
> windfreq <-
> c(1351L, 2147L, 3317L, 4378L, 5527L, 6667L, 7865L, 8970L, 9987L,
> 10907L, 11905L, 12642L, 131000L, 14983L, 15847L, 16842L, 17757L,
> 18698L, 19632L, 20626L, 21599L, 22529L, 23325L, 24391L, 25356L,
> 26267L, 27230L, 28223L, 29190L, 30142L, 31124L, 32104L, 3397L,
> 3437L, 3562L, 3646L, 3742L, 3824L, 399L, 4013L, 419L, 425L, 432L
> 
> library(MASS)
> 
> fitdistr(windfreq, "weibull")
> 
> 
> Hope this helps,
> 
> Rui Barradas
> 
> Em 28-10-2013 12:07, kmmoon100 escreveu:
>> Hello everyone,
>>
>> This is Kangmin.
>>
>> I am trying to produce shape and scale of my wind data. My data is based
>> on
>> wind speed frequency with 1km/hr increment. data is described below.
>>
>> Windspeed (km/h)Frequency
>> 1351
>> 2147
>> 3317
>> 4378
>> 5527
>> 6667
>> 7865
>> 8970
>> 9987
>> 10   907
>> 11   905
>> 12   642
>> 13   1000
>> 14   983
>> 15   847
>> 16   842
>> 17   757
>> 18   698
>> 19   632
>> 20   626
>> 21   599
>> 22   529
>> 23   325
>> 24   391
>> 25   356
>> 26   267
>> 27   230
>> 28   223
>> 29   190
>> 30   142
>> 31   124
>> 32   104
>> 33   97
>> 34   37
>> 35   62
>> 36   46
>> 37   42
>> 38   24
>> 39   9
>> 40   13
>> 41   9
>> 42   5
>> 43   2
>>
>> R codes to calculate shape and scale are described below:
>>
>> Pine.windfrequency.4weeks<-read.table("C:/Users/kmoon/Documents/Pine_frequency_4weeks.csv",header=TRUE,sep=",")
>> fitdistr(Pine.windfrequency.4weeks$Frequency, densfun="weibull")
>>
>> I have got an error message when I was using 'fitdistr' function
>>
>> "Error in fitdistr(Pine.windfrequency.4weeks$Frequency, densfun =
>> "weibull")
>> :
>>optimization failed"
>>
>> Please help me calculating shape and scale of weibull distribution.
>>
>> And please understand that I am not an user familiar with R program but I
>> am
>> really trying to make my analysis work on R!
>>
>> Thank you!!!
>>
>> Kangmin.
>>
>>
>>
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/Optimization-failed-in-fitdistr-Weibull-distribution-tp4679167.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> __
>> 

> R-help@

>  mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> __

> R-help@

>  mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.





--
View this message in context: 
http://r.789695.n4.nabble.com/Optimization-failed-in-fitdistr-Weibull-distribution-tp4679178p4679351.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Optimization failed in fitdistr (Weibull distribution)

2013-10-29 Thread Rolf Turner

On 10/29/13 19:44, peter dalgaard wrote:




There really is no substitute for knowledge and understanding! Did it not occur 
to you that the Windspeed column needs to enter into your analysis?




Fortune!

cheers,

Rolf Turner

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Optimization failed in fitdistr (Weibull distribution)

2013-10-28 Thread peter dalgaard

On 28 Oct 2013, at 13:07 , kmmoon100  wrote:

> Hello everyone,
> 
> This is Kangmin.
> 
> I am trying to produce shape and scale of my wind data. My data is based on
> wind speed frequency with 1km/hr increment. data is described below.
> 
> Windspeed (km/h)Frequency
> 1 351
> 2 147
> 3 317
> 4 378
> 5 527
> 6 667
> 7 865
> 8 970
> 9 987
> 10907
> 11905
> 12642
> 131000
> 14983
> 15847
> 16842
> 17757
> 18698
> 19632
> 20626
> 21599
> 22529
> 23325
> 24391
> 25356
> 26267
> 27230
> 28223
> 29190
> 30142
> 31124
> 32104
> 3397
> 3437
> 3562
> 3646
> 3742
> 3824
> 399
> 4013
> 419
> 425
> 432
> 
> R codes to calculate shape and scale are described below:
> 
> Pine.windfrequency.4weeks<-read.table("C:/Users/kmoon/Documents/Pine_frequency_4weeks.csv",header=TRUE,sep=",")
> fitdistr(Pine.windfrequency.4weeks$Frequency, densfun="weibull")
> 
> I have got an error message when I was using 'fitdistr' function
> 
> "Error in fitdistr(Pine.windfrequency.4weeks$Frequency, densfun = "weibull")
> : 
>  optimization failed"
> 
> Please help me calculating shape and scale of weibull distribution.
> 
> And please understand that I am not an user familiar with R program but I am
> really trying to make my analysis work on R!

There really is no substitute for knowledge and understanding! Did it not occur 
to you that the Windspeed column needs to enter into your analysis? 

I suppose you wanted the following:

> tt<-read.delim("/tmp/foo")
> summary(tt)
 Windspeed..km.h.   Frequency 
 Min.   : 1.0 Min.   :   2.0  
 1st Qu.:11.5 1st Qu.: 100.5  
 Median :22.0 Median : 351.0  
 Mean   :22.0 Mean   : 415.7  
 3rd Qu.:32.5 3rd Qu.: 682.5  
 Max.   :43.0 Max.   :1000.0  
> x <- rep(tt$Windspeed..km.h., tt$Frequency)
> library(MASS) 
> fitdistr(x, densfun="weibull")
  shape scale   
   1.99900495   16.43640142 
 ( 0.01174133) ( 0.06468371)
Warning messages:
1: In densfun(x, parm[1], parm[2], ...) : NaNs produced
2: In densfun(x, parm[1], parm[2], ...) : NaNs produced
3: In densfun(x, parm[1], parm[2], ...) : NaNs produced
4: In densfun(x, parm[1], parm[2], ...)


> 
> Thank you!!!
> 
> Kangmin.
> 
> 
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Optimization-failed-in-fitdistr-Weibull-distribution-tp4679167.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Optimization failed in fitdistr (Weibull distribution)

2013-10-28 Thread Berend Hasselman

On 29-10-2013, at 00:35, kmmoon100  wrote:

> Hi Berend,
> 
> Thank you for your reply.
> How can I use dput function for this type of data?
> I looked up the description of the function but I still can't understand how
> to use it for solving my error.
> 

You don't use dput() to solve your error.
You use dput to get a plain text representation of your data.

Select the output in any editor, copy and paste it in a mail to the list.
If the output is huge then of course you can do dput(head(….,…)) to create a 
reproducible example.
And then maybe people on the list can suggest solutions.

Berend

> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Optimization-failed-in-fitdistr-Weibull-distribution-tp4679178p4679232.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Optimization failed in fitdistr (Weibull distribution)

2013-10-28 Thread kmmoon100
Hi Berend,

Thank you for your reply.
How can I use dput function for this type of data?
I looked up the description of the function but I still can't understand how
to use it for solving my error.

Regards,

Kangmin.



--
View this message in context: 
http://r.789695.n4.nabble.com/Optimization-failed-in-fitdistr-Weibull-distribution-tp4679178p4679232.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Optimization failed in fitdistr (Weibull distribution)

2013-10-28 Thread Berend Hasselman

On 28-10-2013, at 16:07, Rui Barradas  wrote:

> Hello,
> 
> I can't reproduce your error:
> 
> windfreq <-
> c(1351L, 2147L, 3317L, 4378L, 5527L, 6667L, 7865L, 8970L, 9987L,
> 10907L, 11905L, 12642L, 131000L, 14983L, 15847L, 16842L, 17757L,
> 18698L, 19632L, 20626L, 21599L, 22529L, 23325L, 24391L, 25356L,
> 26267L, 27230L, 28223L, 29190L, 30142L, 31124L, 32104L, 3397L,
> 3437L, 3562L, 3646L, 3742L, 3824L, 399L, 4013L, 419L, 425L, 432L
> 
> library(MASS)
> 
> fitdistr(windfreq, "weibull")

You seem to have collapsed the two columns of data into a single column.
That's why it works for you.

The OP should use the dput function to show the data.
If I take the data as presented I get the same error (but I don't use sep="," 
since the data displayed don't contain a ,).
And show the actual code used such as library(MASS).

Berend

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Optimization failed in fitdistr (Weibull distribution)

2013-10-28 Thread Rui Barradas

Hello,

I can't reproduce your error:

windfreq <-
c(1351L, 2147L, 3317L, 4378L, 5527L, 6667L, 7865L, 8970L, 9987L,
10907L, 11905L, 12642L, 131000L, 14983L, 15847L, 16842L, 17757L,
18698L, 19632L, 20626L, 21599L, 22529L, 23325L, 24391L, 25356L,
26267L, 27230L, 28223L, 29190L, 30142L, 31124L, 32104L, 3397L,
3437L, 3562L, 3646L, 3742L, 3824L, 399L, 4013L, 419L, 425L, 432L

library(MASS)

fitdistr(windfreq, "weibull")


Hope this helps,

Rui Barradas

Em 28-10-2013 12:07, kmmoon100 escreveu:

Hello everyone,

This is Kangmin.

I am trying to produce shape and scale of my wind data. My data is based on
wind speed frequency with 1km/hr increment. data is described below.

Windspeed (km/h)Frequency
1   351
2   147
3   317
4   378
5   527
6   667
7   865
8   970
9   987
10  907
11  905
12  642
13  1000
14  983
15  847
16  842
17  757
18  698
19  632
20  626
21  599
22  529
23  325
24  391
25  356
26  267
27  230
28  223
29  190
30  142
31  124
32  104
33  97
34  37
35  62
36  46
37  42
38  24
39  9
40  13
41  9
42  5
43  2

R codes to calculate shape and scale are described below:

Pine.windfrequency.4weeks<-read.table("C:/Users/kmoon/Documents/Pine_frequency_4weeks.csv",header=TRUE,sep=",")
fitdistr(Pine.windfrequency.4weeks$Frequency, densfun="weibull")

I have got an error message when I was using 'fitdistr' function

"Error in fitdistr(Pine.windfrequency.4weeks$Frequency, densfun = "weibull")
:
   optimization failed"

Please help me calculating shape and scale of weibull distribution.

And please understand that I am not an user familiar with R program but I am
really trying to make my analysis work on R!

Thank you!!!

Kangmin.



--
View this message in context: 
http://r.789695.n4.nabble.com/Optimization-failed-in-fitdistr-Weibull-distribution-tp4679167.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Optimization failed in fitdistr (Weibull distribution)

2013-10-28 Thread kmmoon100
Hello everyone,

This is Kangmin.

I am trying to produce shape and scale of my wind data. My data is based on
wind speed frequency with 1km/hr increment. data is described below.

Windspeed (km/h)Frequency
1   351
2   147
3   317
4   378
5   527
6   667
7   865
8   970
9   987
10  907
11  905
12  642
13  1000
14  983
15  847
16  842
17  757
18  698
19  632
20  626
21  599
22  529
23  325
24  391
25  356
26  267
27  230
28  223
29  190
30  142
31  124
32  104
33  97
34  37
35  62
36  46
37  42
38  24
39  9
40  13
41  9
42  5
43  2

R codes to calculate shape and scale are described below:

Pine.windfrequency.4weeks<-read.table("C:/Users/kmoon/Documents/Pine_frequency_4weeks.csv",header=TRUE,sep=",")
fitdistr(Pine.windfrequency.4weeks$Frequency, densfun="weibull")

I have got an error message when I was using 'fitdistr' function

"Error in fitdistr(Pine.windfrequency.4weeks$Frequency, densfun = "weibull")
: 
  optimization failed"

Please help me calculating shape and scale of weibull distribution.

And please understand that I am not an user familiar with R program but I am
really trying to make my analysis work on R!

Thank you!!!

Kangmin.



--
View this message in context: 
http://r.789695.n4.nabble.com/Optimization-failed-in-fitdistr-Weibull-distribution-tp4679167.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.