Skip to content

Fix S3 functions by passing the right object #74

@moritzpschwarz

Description

@moritzpschwarz

This is not an error but rather a presentation issue:

set.seed(234)
x <- rnorm(100)
is_obj <- isat(x, ar = 2)

# issue that dependent var is structure item
# not an error but not ideal
gets(is_obj)

Here the output looks like this:

GUM mean equation:

       reg.no. keep      coef std.error  t-stat   p-value    
mconst       1    0  0.357993  0.375513  0.9533 0.3428609    
ar2          2    0 -0.243315  0.093682 -2.5973 0.0109077 *  
sis8         3    0 -2.112867  0.619022 -3.4132 0.0009487 ***
sis11        4    0  1.813042  0.500326  3.6237 0.0004710 ***
---
Signif. codes:  0***0.001**0.01*0.05.0.1 ‘ ’ 1


Diagnostics:

                   Chi-sq df p-value
Ljung-Box AR(1)   0.16208  1 0.68725
Ljung-Box ARCH(1) 0.56113  1 0.45380

1 path(s) to search
Searching: 1 

  Path 1: 1 

Terminal models:

                info(sc)     logl  n k
spec 1 (1-cut): 2.597172 -120.384 98 3

Retained regressors (final model):

  ar2   sis8   sis11 

Date: Mon Jul 15 16:35:02 2024 
Dependent var.: structure(c(-1.49920605110092, 1.4712331168047, 1.45913852737207,  0.140139035211714, 0.209184394605135, -3.03608982400775, -0.486934131799972,  -1.08786730804861, 0.0578597068791147, 1.10397550204732, -0.0256169650073917,  0.514846393297498, 0.990056676414481, 0.303454315965962, -0.930072225296335,  0.0840306780356554, 0.52677962527949, 0.0158686153085828, 0.205351836479015,  1.01628334567918, 0.408998965897837, -0.70523546971279, 0.235614331463595,  0.345130033022162, -1.0197995515778, -1.41182225384616, -1.36384225283298,  0.873104933230715, -0.336681598970977, -0.659256041532951, -0.100766982495955,  0.703907834130922, 0.438054879984456, 1.49714789413423, 0.21624438044514,  -1.49533784367189, 0.124994030654034, -1.03809446681621, 0.220422818605093,  -0.438085829074046, 1.47863764573664, -0.556313359962856, -0.435921712725661,  1.05191175997743, -1.02725862138505, 0.0399132738986099, -0.327749726277994,  0.492976415015141, 0.776206252435, -0.63642817523845, -0.443068630917215,  -1.10854500704059, -1.0034363619741, 0.609448332155842, 0.301592567340248,  -0.726529617261133, -0.958138796461654, 0.628063529064452, 0.662587204884996,  0.23178359784619, 0.413281438915735, 0.485260525256912, -0.935684951108486,  0.0791252617406723, 0.580592705860603, -0.0922784371728558, 0.417550529489087,  0.365028713874996, 1.03275341580283, 0.200837445511168, 1.39220605825101,  -0.372000907229848, -0.987258168947263, 0.243921801522475, 2.10734298633766,  -1.43095972513105, -1.09401606375475, 0.234718167044343, 0.341485677501788,  -1.66873749927288, 0.725706803475654, 0.693666146100501, -1.68541051146824,  0.0222088020399635, 1.53085680970446, -1.11054543175816, -0.204529304982341,  -0.405710693056334, -0.446524840539564, -0.939305320978487, 1.37036268454058,  0.364774319919463, 1.01924381287398, 0.143191429713686, 1.08109610495029,  1.15925350214756, -0.273037600145984, 0.869982996850915), dim = c(98L,  1L), dimnames = list(NULL, "y")) 
Method: Ordinary Least Squares (OLS) 
Variance-Covariance: Ordinary 
No. of observations (mean eq.): 98 
Sample: 1 to 98 

SPECIFIC mean equation:

           coef std.error  t-stat   p-value    
ar2   -0.243141  0.093636 -2.5966 0.0109091 *  
sis8  -1.754718  0.491755 -3.5683 0.0005654 ***
sis11  1.812882  0.500086  3.6251 0.0004666 ***
---
Signif. codes:  0***0.001**0.01*0.05.0.1 ‘ ’ 1

Diagnostics and fit:

                    Chi-sq df p-value
Ljung-Box AR(1)   0.098965  1  0.7531
Ljung-Box ARCH(1) 0.458471  1  0.4983
Jarque-Bera       1.955519  2  0.3762
                           
SE of regression    0.83927
R-squared           0.15251
Log-lik.(n=98)   -120.38400

Of course the fact that the dependent variable looks like this:
Dependent var.: structure(c(-1.49920605110092, 1.4712331168047, 1.45913852737207, 0.140139035211714, 0.209184394605135, -3.03608982400775, -0.486934131799972, -1.08786730804861, 0.0578597068791147, 1.10397550204732, -0.0256169650073917, 0.514846393297498, 0.990056676414481, 0.303454315965962, -0.930072225296335, 0.0840306780356554, 0.52677962527949, 0.0158686153085828, 0.205351836479015, 1.01628334567918, 0.408998965897837, -0.70523546971279, 0.235614331463595, 0.345130033022162, -1.0197995515778, -1.41182225384616, -1.36384225283298, 0.873104933230715, -0.336681598970977, -0.659256041532951, -0.100766982495955, 0.703907834130922, 0.438054879984456, 1.49714789413423, 0.21624438044514, -1.49533784367189, 0.124994030654034, -1.03809446681621, 0.220422818605093, -0.438085829074046, 1.47863764573664, -0.556313359962856, -0.435921712725661, 1.05191175997743, -1.02725862138505, 0.0399132738986099, -0.327749726277994, 0.492976415015141, 0.776206252435, -0.63642817523845, -0.443068630917215, -1.10854500704059, -1.0034363619741, 0.609448332155842, 0.301592567340248, -0.726529617261133, -0.958138796461654, 0.628063529064452, 0.662587204884996, 0.23178359784619, 0.413281438915735, 0.485260525256912, -0.935684951108486, 0.0791252617406723, 0.580592705860603, -0.0922784371728558, 0.417550529489087, 0.365028713874996, 1.03275341580283, 0.200837445511168, 1.39220605825101, -0.372000907229848, -0.987258168947263, 0.243921801522475, 2.10734298633766, -1.43095972513105, -1.09401606375475, 0.234718167044343, 0.341485677501788, -1.66873749927288, 0.725706803475654, 0.693666146100501, -1.68541051146824, 0.0222088020399635, 1.53085680970446, -1.11054543175816, -0.204529304982341, -0.405710693056334, -0.446524840539564, -0.939305320978487, 1.37036268454058, 0.364774319919463, 1.01924381287398, 0.143191429713686, 1.08109610495029, 1.15925350214756, -0.273037600145984, 0.869982996850915), dim = c(98L, 1L), dimnames = list(NULL, "y"))

Is not ideal.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions