[R] help pleaseeeeeeeee

2007-11-23 Thread Clara Cordeiro
Dears Sirs

During my computational work I encountered unexpected behavior when calling
"ar" function, namely
# time series
x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))

# ar function
res.ar<-ar(x,aic=TRUE,demean=F)

# call "ar" again and 
res.ar<-ar(x,aic=TRUE,demean=F)
Error in if (order > 0) coefs[order, 1:order] else numeric(0) :
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In log(var.pred) : NaNs produced
2: In if (order > 0) coefs[order, 1:order] else numeric(0) :
  the condition has length > 1 and only the first element will be used

For me it is mysterious why sometimes it works and others it does not,
perhaps I am doing something wrong and stupid :-(

If anyone had already had this problem could you please tell me how you have
solved it?

Thank you for your time.

Best Regards,

Clara Cordeiro

[[alternative HTML version deleted]]

__
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] help pleaseeeeeeeee

2007-11-23 Thread jim holtman
When I tried it on my Windows system,  I executed the script at least
4 times in succession before I got the error:

> # time series
> x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
+ 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))
>
> # ar function
> res.ar<-ar(x,aic=TRUE,demean=F)
>
> # call "ar" again and 
> res.ar<-ar(x,aic=TRUE,demean=F)
>
> res.ar<-ar(x,aic=TRUE,demean=F)
> res.ar

Call:
ar(x = x, aic = TRUE, demean = F)


Order selected 0  sigma^2 estimated as  1.482
> # time series
> x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
+ 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))
>
> # ar function
> res.ar<-ar(x,aic=TRUE,demean=F)
Error in if (order > 0) coefs[order, 1:order] else numeric(0) :
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In log(var.pred) : NaNs produced
2: In if (order > 0) coefs[order, 1:order] else numeric(0) :
  the condition has length > 1 and only the first element will be used
>
> # call "ar" again and 
> res.ar<-ar(x,aic=TRUE,demean=F)
>
> res.ar<-ar(x,aic=TRUE,demean=F)
> res.ar

Call:
ar(x = x, aic = TRUE, demean = F)


Order selected 0  sigma^2 estimated as  1.482
>

Maybe it has something to do with random numbers that might be used in
the computation.


On Nov 23, 2007 4:13 PM, Steven McKinney <[EMAIL PROTECTED]> wrote:
> Hi Clara,
>
> Your example works fine on my Apple Mac running
> R 2.6.0.
>
> You should include the output of
> sessionInfo()
> so others will know what platorm you are working on.
>
> > # time series
> > x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
> + 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))
> >
> > # ar function
> > res.ar<-ar(x,aic=TRUE,demean=F)
> >
> > # call "ar" again and 
> > res.ar<-ar(x,aic=TRUE,demean=F)
> >
> > res.ar<-ar(x,aic=TRUE,demean=F)
> > res.ar
>
> Call:
> ar(x = x, aic = TRUE, demean = F)
>
>
> Order selected 0  sigma^2 estimated as  1.482
> > res.ar<-ar(x,aic=TRUE,demean=F)
> > res.ar
>
> Call:
> ar(x = x, aic = TRUE, demean = F)
>
>
> Order selected 0  sigma^2 estimated as  1.482
> > summary(res.ar)
>   Length Class  Mode
> order   1 -none- numeric
> ar  0 -none- numeric
> var.pred1 -none- numeric
> x.mean  1 -none- numeric
> aic10 -none- numeric
> n.used  1 -none- numeric
> order.max   1 -none- numeric
> partialacf  9 -none- numeric
> resid   9 ts numeric
> method  1 -none- character
> series  1 -none- character
> frequency   1 -none- numeric
> call4 -none- call
> > sessionInfo()
> R version 2.6.0 (2007-10-03)
> powerpc-apple-darwin8.10.1
>
> locale:
> en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
>
> attached base packages:
> [1] splines   stats graphics  grDevices utils datasets  methods   base
>
> other attached packages:
> [1] survival_2.34
>
> loaded via a namespace (and not attached):
> [1] tools_2.6.0
> >
>
>
>
> Steven McKinney
>
> Statistician
> Molecular Oncology and Breast Cancer Program
> British Columbia Cancer Research Centre
>
> email: smckinney +at+ bccrc +dot+ ca
>
> tel: 604-675-8000 x7561
>
> BCCRC
> Molecular Oncology
> 675 West 10th Ave, Floor 4
> Vancouver B.C.
> V5Z 1L3
> Canada
>
>
>
>
> -Original Message-
> From: [EMAIL PROTECTED] on behalf of Clara Cordeiro
> Sent: Fri 11/23/2007 7:38 AM
> To: [EMAIL PROTECTED]
> Subject: [R] help please
>
> Dears Sirs
>
> During my computational work I encountered unexpected behavior when calling
> "ar" function, namely
> # time series
> x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
> 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))
>
> # ar function
> res.ar<-ar(x,aic=TRUE,demean=F)
>
> # call "ar" again and 
> res.ar<-ar(x,aic=TRUE,demean=F)
> Error in if (order > 0) coefs[order, 1:order] else numeric(0) :
>  missing value where TRUE/FALSE needed
> In addition: Warning messages:
> 1: In log(var.pred) : NaNs produced
> 2: In if (order > 0) coefs[order, 1:order] else numeric(0) :
>  the condition has length > 1 and only the first element will be used
>
> For me it is mysterious why sometimes it works and others it does not,
> perhaps I a

Re: [R] help pleaseeeeeeeee

2007-11-23 Thread Steven McKinney
Hi Jim,

Yes indeed, after several more attempts
at executing the example, I did also
eventually trip the error (on the
11th execution of res.ar<-ar(x,aic=TRUE,demean=F)):

> res.ar$x.mean
[1] 0
> res.ar$resid
   Qtr1   Qtr2   Qtr3   Qtr4
1978   -0.2052083 -0.3764986
1979 -0.3762448  0.3740089  0.2737568  2.8235722
1980 -1.7783313  0.2728676 -0.3273164   
> res.ar<-ar(x,aic=TRUE,demean=F)
> res.ar$resid
   Qtr1   Qtr2   Qtr3   Qtr4
1978   -0.2052083 -0.3764986
1979 -0.3762448  0.3740089  0.2737568  2.8235722
1980 -1.7783313  0.2728676 -0.3273164   
> x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))
> res.ar<-ar(x,aic=TRUE,demean=F)
> res.ar$resid
   Qtr1   Qtr2   Qtr3   Qtr4
1978   -0.2052083 -0.3764986
1979 -0.3762448  0.3740089  0.2737568  2.8235722
1980 -1.7783313  0.2728676 -0.3273164   
> res.ar<-ar(x,aic=TRUE,demean=F)
Error in if (order > 0) coefs[order, 1:order] else numeric(0) : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In if (order > 0) coefs[order, 1:order] else numeric(0) :
  the condition has length > 1 and only the first element will be used
> sessionInfo()
R version 2.6.0 (2007-10-03) 
powerpc-apple-darwin8.10.1 

locale:
en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] splines   stats graphics  grDevices utils datasets  methods   base  
   

other attached packages:
[1] survival_2.34

loaded via a namespace (and not attached):
[1] tools_2.6.0


Steven McKinney

Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre

email: smckinney +at+ bccrc +dot+ ca

tel: 604-675-8000 x7561

BCCRC
Molecular Oncology
675 West 10th Ave, Floor 4
Vancouver B.C. 
V5Z 1L3
Canada




-Original Message-
From: jim holtman [mailto:[EMAIL PROTECTED]
Sent: Fri 11/23/2007 1:24 PM
To: Steven McKinney
Cc: Clara Cordeiro; [EMAIL PROTECTED]
Subject: Re: [R] help please
 
When I tried it on my Windows system,  I executed the script at least
4 times in succession before I got the error:

> # time series
> x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
+ 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))
>
> # ar function
> res.ar<-ar(x,aic=TRUE,demean=F)
>
> # call "ar" again and 
> res.ar<-ar(x,aic=TRUE,demean=F)
>
> res.ar<-ar(x,aic=TRUE,demean=F)
> res.ar

Call:
ar(x = x, aic = TRUE, demean = F)


Order selected 0  sigma^2 estimated as  1.482
> # time series
> x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
+ 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))
>
> # ar function
> res.ar<-ar(x,aic=TRUE,demean=F)
Error in if (order > 0) coefs[order, 1:order] else numeric(0) :
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In log(var.pred) : NaNs produced
2: In if (order > 0) coefs[order, 1:order] else numeric(0) :
  the condition has length > 1 and only the first element will be used
>
> # call "ar" again and 
> res.ar<-ar(x,aic=TRUE,demean=F)
>
> res.ar<-ar(x,aic=TRUE,demean=F)
> res.ar

Call:
ar(x = x, aic = TRUE, demean = F)


Order selected 0  sigma^2 estimated as  1.482
>

Maybe it has something to do with random numbers that might be used in
the computation.


On Nov 23, 2007 4:13 PM, Steven McKinney <[EMAIL PROTECTED]> wrote:
> Hi Clara,
>
> Your example works fine on my Apple Mac running
> R 2.6.0.
>
> You should include the output of
> sessionInfo()
> so others will know what platorm you are working on.
>
> > # time series
> > x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
> + 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))
> >
> > # ar function
> > res.ar<-ar(x,aic=TRUE,demean=F)
> >
> > # call "ar" again and 
> > res.ar<-ar(x,aic=TRUE,demean=F)
> >
> > res.ar<-ar(x,aic=TRUE,demean=F)
> > res.ar
>
> Call:
> ar(x = x, aic = TRUE, demean = F)
>
>
> Order selected 0  sigma^2 estimated as  1.482
> > res.ar<-ar(x,aic=TRUE,demean=F)
> > res.ar
>
> Call:
> ar(x = x, aic = TRUE, demean = F)
>
>
> Order selected 0  sigma^2 estimated as  1.482
> > summary(res.ar)
>   Length Class  Mode
> order   1 -none- numeric
> ar  0 -none- numeric
> var.pred1 -none- numeric
> x.mean  1 -none- numeric
> aic10 -none- numer

Re: [R] help pleaseeeeeeeee

2007-11-23 Thread Steven McKinney
Hi Clara,

Your example works fine on my Apple Mac running
R 2.6.0.

You should include the output of 
sessionInfo()
so others will know what platorm you are working on.

> # time series
> x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
+ 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))
> 
> # ar function
> res.ar<-ar(x,aic=TRUE,demean=F)
> 
> # call "ar" again and 
> res.ar<-ar(x,aic=TRUE,demean=F)
> 
> res.ar<-ar(x,aic=TRUE,demean=F)
> res.ar

Call:
ar(x = x, aic = TRUE, demean = F)


Order selected 0  sigma^2 estimated as  1.482 
> res.ar<-ar(x,aic=TRUE,demean=F)
> res.ar

Call:
ar(x = x, aic = TRUE, demean = F)


Order selected 0  sigma^2 estimated as  1.482 
> summary(res.ar)
   Length Class  Mode 
order   1 -none- numeric  
ar  0 -none- numeric  
var.pred1 -none- numeric  
x.mean  1 -none- numeric  
aic10 -none- numeric  
n.used  1 -none- numeric  
order.max   1 -none- numeric  
partialacf  9 -none- numeric  
resid   9 ts numeric  
method  1 -none- character
series  1 -none- character
frequency   1 -none- numeric  
call4 -none- call 
> sessionInfo()
R version 2.6.0 (2007-10-03) 
powerpc-apple-darwin8.10.1 

locale:
en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] splines   stats graphics  grDevices utils datasets  methods   base  
   

other attached packages:
[1] survival_2.34

loaded via a namespace (and not attached):
[1] tools_2.6.0
> 



Steven McKinney

Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre

email: smckinney +at+ bccrc +dot+ ca

tel: 604-675-8000 x7561

BCCRC
Molecular Oncology
675 West 10th Ave, Floor 4
Vancouver B.C. 
V5Z 1L3
Canada




-Original Message-
From: [EMAIL PROTECTED] on behalf of Clara Cordeiro
Sent: Fri 11/23/2007 7:38 AM
To: [EMAIL PROTECTED]
Subject: [R] help please
 
Dears Sirs

During my computational work I encountered unexpected behavior when calling
"ar" function, namely
# time series
x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))

# ar function
res.ar<-ar(x,aic=TRUE,demean=F)

# call "ar" again and 
res.ar<-ar(x,aic=TRUE,demean=F)
Error in if (order > 0) coefs[order, 1:order] else numeric(0) :
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In log(var.pred) : NaNs produced
2: In if (order > 0) coefs[order, 1:order] else numeric(0) :
  the condition has length > 1 and only the first element will be used

For me it is mysterious why sometimes it works and others it does not,
perhaps I am doing something wrong and stupid :-(

If anyone had already had this problem could you please tell me how you have
solved it?

Thank you for your time.

Best Regards,

Clara Cordeiro

[[alternative HTML version deleted]]

__
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] help pleaseeeeeeeee

2007-11-23 Thread Steven McKinney

Hi Clara,

I suspect your error is happening because your input data
is short (9 observations).  In the help for ar() for
argument "order.max" it states

order.maxMaximum order (or order) of model to fit. Defaults to 
10*log10(N) where N is the number of observations except for method="mle" where 
it is the minimum of this quantity and 12.

so perhaps the problem is 10*log10(9) is smaller than 1 and
isn't being handled properly (this is just a guess).

If I lengthen your data vector to be
x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-1.7783313,0.2728676,-0.3273164,
  
-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1982,3))

I can not trip the error.

I filed a bug report.

You might try specifying order.max in your
function call.  If I specify
order.max = 1
I can not trip the error.

> res.ar<-ar(x,aic=TRUE,demean=F)
> res.ar<-ar(x,aic=TRUE,demean=F)
Error in if (order > 0) coefs[order, 1:order] else numeric(0) : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In if (order > 0) coefs[order, 1:order] else numeric(0) :
  the condition has length > 1 and only the first element will be used
> res.ar<-ar(x,aic=TRUE,demean=F)
Error in if (order > 0) coefs[order, 1:order] else numeric(0) : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In if (order > 0) coefs[order, 1:order] else numeric(0) :
  the condition has length > 1 and only the first element will be used
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)


> sessionInfo()
R version 2.6.0 (2007-10-03) 
powerpc-apple-darwin8.10.1 

locale:
en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] splines   stats graphics  grDevices utils datasets  methods   base  
   

other attached packages:
[1] survival_2.34

loaded via a namespace (and not attached):
[1] tools_2.6.0
> 


Steven McKinney

Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre

email: smckinney +at+ bccrc +dot+ ca

tel: 604-675-8000 x7561

BCCRC
Molecular Oncology
675 West 10th Ave, Floor 4
Vancouver B.C. 
V5Z 1L3
Canada




-Original Message-
From: [EMAIL PROTECTED] on behalf of Clara Cordeiro
Sent: Fri 11/23/2007 7:38 AM
To: [EMAIL PROTECTED]
Subject: [R] help please
 
Dears Sirs

During my computational work I encountered unexpected behavior when calling
"ar" function, namely
# time series
x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-
1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))

# ar function
res.ar<-ar(x,aic=TRUE,demean=F)

# call "ar" again and 
res.ar

Re: [R] help pleaseeeeeeeee

2007-11-26 Thread Clara Cordeiro
 res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar <-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar <-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
> > res.ar<-ar(x,aic=TRUE,demean=F, order.max = 1)
>
>
> > sessionInfo()
> R version 2.6.0 (2007-10-03)
> powerpc-apple-darwin8.10.1
>
> locale:
> en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
>
> attached base packages:
> [1] splines   stats graphics  grDevices utils datasets  methods
> base
>
> other attached packages:
> [1] survival_2.34
>
> loaded via a namespace (and not attached):
> [1] tools_2.6.0
> >
>
>
> Steven McKinney
>
> Statistician
> Molecular Oncology and Breast Cancer Program
> British Columbia Cancer Research Centre
>
> email: smckinney +at+ bccrc +dot+ ca
>
> tel: 604-675-8000 x7561
>
> BCCRC
> Molecular Oncology
> 675 West 10th Ave, Floor 4
> Vancouver B.C.
> V5Z 1L3
> Canada
>
>
>
>
> -Original Message-
> From: [EMAIL PROTECTED] on behalf of Clara Cordeiro
> Sent: Fri 11/23/2007 7:38 AM
> To: [EMAIL PROTECTED]
> Subject: [R] help please
>
> Dears Sirs
>
> During my computational work I encountered unexpected behavior when
> calling
> "ar" function, namely
> # time series
> x<-ts(c(-0.2052083,-0.3764986 ,-0.3762448,0.3740089,0.2737568,2.8235722,-
> 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3))
>
> # ar function
> res.ar<-ar(x,aic=TRUE,demean=F)
>
> # call "ar" again and 
> res.ar<-ar(x,aic=TRUE,demean=F)
> Error in if (order > 0) coefs[order, 1:order] else numeric(0) :
> missing value where TRUE/FALSE needed
> In addition: Warning messages:
> 1: In log(var.pred) : NaNs produced
> 2: In if (order > 0) coefs[order, 1:order] else numeric(0) :
> the condition has length > 1 and only the first element will be used
>
> For me it is mysterious why sometimes it works and others it does not,
> perhaps I am doing something wrong and stupid :-(
>
> If anyone had already had this problem could you please tell me how you
> have
> solved it?
>
> Thank you for your time.
>
> Best Regards,
>
> Clara Cordeiro
>
>[[alternative HTML version deleted]]
>
> __
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
>

[[alternative HTML version deleted]]

__
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] help pleaseeeeeeeee

2007-11-26 Thread Ben Bolker



CCordeiro wrote:
> 
> Hi
> 
> 
> 
> Thank you very much for you interest and help in this "mysterious"
> problem.
> 
> I am going to investigate the random numbers issue. Concerning the
> order.maxit helps but it is not what I have in mind. I think that in
> case
> 

Dear Clara,

  this did actually get investigated, but was continued in a thread
on the R development list:

http://www.nabble.com/Bug-in-package-stats-function-ar%28%29-%28PR-10459%29-tf4864536.html

  The problem is indeed with the "order.max" calculation, which should
not allow order.max to equal the length of the data series (but does
for very short time series).  There are no random numbers involved
in this calculation.

Something like

res.ar<-ar(x,aic=TRUE,demean=F,order.max=length(x)-1) 

  should prevent this particular problem from happening ...

  Ben Bolker

 PS: it was very good of you to give a reproducible example,
and very helpful of you to point out this bug.  In the future,
the other helpful thing you could do is give your message
an informative subject line (e.g. "problem with ar()" rather
than "help pleaseee") ...


-- 
View this message in context: 
http://www.nabble.com/help-please-tf4862400.html#a13948775
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.