R Under development (unstable) (2024-11-07 r87302 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > #""""""""""""""""""""""""Detecting periodicity > install.packages("expm", repos = "https://cran.r-project.org") Installing package into 'D:/temp/2024_11_08_21_50_02/Rtmpmi2Xat/RLIBS_2b62c1c375cdf' (as 'lib' is unspecified) trying URL 'https://cran.r-project.org/bin/windows/contrib/4.5/expm_1.0-0.zip' Content type 'application/zip' length 222243 bytes (217 KB) ================================================== downloaded 217 KB package 'expm' successfully unpacked and MD5 sums checked The downloaded binary packages are in D:\temp\2024_11_08_21_50_02\RtmpAHZi0y\downloaded_packages > install.packages("sn", repos = "https://cran.r-project.org") Installing package into 'D:/temp/2024_11_08_21_50_02/Rtmpmi2Xat/RLIBS_2b62c1c375cdf' (as 'lib' is unspecified) trying URL 'https://cran.r-project.org/bin/windows/contrib/4.5/sn_2.1.1.zip' Content type 'application/zip' length 1844589 bytes (1.8 MB) ================================================== downloaded 1.8 MB package 'sn' successfully unpacked and MD5 sums checked The downloaded binary packages are in D:\temp\2024_11_08_21_50_02\RtmpAHZi0y\downloaded_packages > install.packages("readxl", repos = "https://cran.r-project.org") Installing package into 'D:/temp/2024_11_08_21_50_02/Rtmpmi2Xat/RLIBS_2b62c1c375cdf' (as 'lib' is unspecified) trying URL 'https://cran.r-project.org/bin/windows/contrib/4.5/readxl_1.4.3.zip' Content type 'application/zip' length 1203719 bytes (1.1 MB) ================================================== downloaded 1.1 MB package 'readxl' successfully unpacked and MD5 sums checked The downloaded binary packages are in D:\temp\2024_11_08_21_50_02\RtmpAHZi0y\downloaded_packages > > #install.packages("expm") > #install.packages("sn") > #install.packages("readxl") > > > library(PerRegMod) > library(expm) Loading required package: Matrix Attaching package: 'expm' The following object is masked from 'package:Matrix': expm > library(readxl) > library(sn)# for skew normal density Loading required package: stats4 Attaching package: 'sn' The following object is masked from 'package:stats': sd > > n=200 > s=2 > x1=rnorm(n,0,1) > x2=rnorm(n,0,2) > x3=rnorm(n,0,3) > x4=rnorm(n,0,2.7) > y=rnorm(n,0,2.5) > x=list(x1,x2,x3,x4) > model=lm(y~x1+x2+x3+x4) > z=model$residuals > check_periodicity(x,y,s) Chi-squared test for detecting periodicity of coefficients Chi-squared statistic: 14.72439 on df= 6 , p-value: 0.0225121294524752> > ####""""""""""""""""""""""""" LSE method > set.seed(4) > s=2 > n=200 > m=n/s > p=3 > mu=c(2,6) > beta1=c(3,5) > beta2=c(1,2.5) > beta3=c(-2,1) > x1=runif(n,0,5) > x2=runif(n,0,10) > x3=runif(n,0,15) > y=rep(0,n) > for (i in 1:s) { + q=seq(i,n,s) + y[q]=mu[i] + beta1[i] * x1[q] + beta2[i] * x2[q] + beta3[i] * x3[q] + rnorm(m,0,1) + } > x=list(x1,x2,x3) > lm_per(x,y,s) Residuals: 0% 25% 50% 75% 100% -2.549633 -0.626857 0.024333 0.639637 2.920669 Coefficients: intercept x...1... X...2... X...3... sd s= 1 2.0178 3.0710 1.0052 -2.04169 0.96313 s= 2 5.7531 5.1528 2.4795 0.98718 0.97588 Root mean square error: 0.9499377> > > ##""""""""""""""""""""""" AE > set.seed(4) > s=2 > n=200 > m=n/s > p=3 > mu=c(2,6) > beta1=c(3,5) > beta2=c(1,2.5) > beta3=c(-2,1) > x1=runif(n,0,5) > x2=runif(n,0,10) > x3=runif(n,0,15) > y=rep(0,n) > for (i in 1:s) { + q=seq(i,n,s) + y[q]=mu[i] + beta1[i] * x1[q] + beta2[i] * x2[q] + beta3[i] * x3[q] + rsn(m,alpha = 10) + } > x=list(x1,x2,x3) > lm_per_AE(x,y,s) Residuals: 0% 25% 50% 75% 100% -0.47063 0.14000 0.48720 0.92105 2.65079 Coefficients: intercept x...1... X...2... X...3... SD s= 1 2.1250 2.9693 0.98514 -1.96983 0.46734 s= 2 6.2427 4.9575 2.51490 0.99866 0.38663 Root mean square error: 0.8224663> > ######"""""""""""""""""""""""""" real data examples > #####" > #Data <- system.file("data", "weather_data_casablanca-settat.xlsx", package = "PerRegMod") > #load("~/PerRegMod_4.4.1/PerRegMod/data/weather_data_casablanca_settat.RData") > #Data=weather_data_casablanca_settat > > #file_path <- system.file("data", "weather_data_casablanca_settat.xlsx", package = "PerRegMod") > #Data <- readxl::read_excel(file_path) > #file_path <- system.file("inst/extdata", "weather_data_casablanca_settat.xlsx", package = "PerRegMod") > #Data <- readxl::read_excel(file_path) > Data=read_xlsx("~/PerRegMod_4.4.1/PerRegMod/inst/extdata/weather_data_casablanca_settat.xlsx") Error: `path` does not exist: '~/PerRegMod_4.4.1/PerRegMod/inst/extdata/weather_data_casablanca_settat.xlsx' Execution halted