> On 9 Apr 2024, at 14:54, peter dalgaard <pda...@gmail.com> wrote:
> 
> Hi, Adelchi,
> 
> Depends on what you want help with... 
> 
> The proximate cause would seem to be that the code ought to have "is.null(A) 
> || any(is.NA(A))", which I presume you could fairly easily fix for yourself 
> in the package sources or even locally in an R session. Vector-valued 
> logicals in flow control constructions have gone through an elborate 
> deprecation process before getting turned into errors.

Thanks, Peter. This has actually solved the problem.
I should have thought about this fix.

It surprises me that problems of this sort are not caught by the extensive 
automatic checks which a package goes through when is submitted to CRAN. 
Probably it happens because the only example within the CEoptim documentation 
is quite basic, while the more substantial examples are in the accompanying 
paper, but these are not checked by CRAN.

Best regards,

Adelchi

> 
> If the problem is how to activate a dormant maintainer and fix the issue for 
> everyone, I don't really have a clue,  but you might consider cantacting the 
> CRAN team.
> 
> Best,
> Peter D.
> 
>> On 9 Apr 2024, at 12:04 , Adelchi Azzalini <azzal...@stat.unipd.it> wrote:
>> 
>> In the attempt to explore the usage of package CEoptim, I have run the code 
>> listed at the end of this message. This code is nothing but the one 
>> associated to example 5.7 in the main reference of the package, available at 
>> https://www.jstatsoft.org/article/view/v076i08
>> and is included in the associated file  v76i08.R
>> 
>> Unfortunately, the call to CEoptim stops with error message 
>> 
>> Error in is.null(A) || is.na(A) : 
>> 'length = 18' in coercion to 'logical(1)’
>> 
>> On 2024–04-03, I have written about this problem to 
>> Maintainer: Benoit Liquet <b.liq...@uq.edu.au>
>> but so far no reply has reached me. 
>> 
>> Could anyone help?
>> 
>> Best regards,
>> 
>> Adelchi Azzalini
>> http://azzalini.stat.unipd.it
>> 
>> ////////////////////////////////////////////////////////////////////////
>> 
>> library(CEoptim)
>> ## 5.7 AR(1) Model with Regime Switching
>> set.seed(123)
>> 
>> sumsqrs <- function(theta, rm1, x) {
>> N <- length(x)  #without x[0]
>> r <- 1 + sort(rm1)  # internal end points of regimes
>> if (r[1] == r[2]) {
>>   # test for dupes -> invalid regime
>>   return(Inf)
>> }
>>    thetas <- rep(theta, times = c(r, N) - c(1, r + 1) + 1)
>> xhat <- c(0, head(x, -1)) * thetas
>> ## Compute sum of squared errors
>> sum((x - xhat)^2)
>> }
>> 
>> ## Read the data from CEoptim package
>> data("yt", package = "CEoptim")
>> xt <- yt - c(0, yt[-300])
>> A <- rbind(diag(3), -diag(3))
>> b <- rep(1, 6)
>> 
>> res <- CEoptim(sumsqrs, f.arg = list(xt), continuous = list(mean = c(0, 0, 
>> 0), sd = rep(1,    3), conMat = A, conVec = b), discrete = list(categories = 
>> c(298L, 298L), smoothProb = 0.5),    N = 10000, rho = 0.001)
>> 
>> Error in is.null(A) || is.na(A) : 
>> 'length = 18' in coercion to 'logical(1)'
>> 
>> R> sessionInfo()
>> R version 4.3.3 (2024-02-29)
>> Platform: aarch64-apple-darwin20 (64-bit)
>> Running under: macOS Ventura 13.0
>> 
>> Matrix products: default
>> BLAS:   
>> /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib
>>  
>> LAPACK: 
>> /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;
>>   LAPACK version 3.11.0
>> 
>> locale:
>> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>> 
>> time zone: Europe/Rome
>> tzcode source: internal
>> 
>> attached base packages:
>> [1] stats     utils     datasets  grDevices graphics  methods   base     
>> 
>> other attached packages:
>> [1] CEoptim_1.3          sna_2.7-2            network_1.18.2       
>> statnet.common_4.9.0
>> [5] msm_1.7.1            MASS_7.3-60.0.1     
>> 
>> loaded via a namespace (and not attached):
>> [1] vctrs_0.6.2        cli_3.6.1          rlang_1.1.1        generics_0.1.3  
>>   
>> [5] jsonlite_1.8.4     glue_1.6.2         colorspace_2.1-0   scales_1.2.1    
>>   
>> [9] fansi_1.0.4        dlstats_0.1.7      grid_4.3.3         expm_0.999-9    
>>   
>> [13] munsell_0.5.0      tibble_3.2.1       mvtnorm_1.1-3      
>> lifecycle_1.0.3   
>> [17] compiler_4.3.3     dplyr_1.1.2        coda_0.19-4.1      
>> RColorBrewer_1.1-3
>> [21] pkgconfig_2.0.3    lattice_0.22-5     R6_2.5.1           
>> tidyselect_1.2.0  
>> [25] utf8_1.2.3         splines_4.3.3      pillar_1.9.0       magrittr_2.0.3 
>>    
>> [29] Matrix_1.6-5       tools_4.3.3        gtable_0.3.3       survival_3.5-8 
>>    
>> [33] ggplot2_3.4.2     
>> R> 
>> 
>> ______________________________________________
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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
> Office: A 4.23
> Email: pd....@cbs.dk  Priv: pda...@gmail.com
> 

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to