# RStudio ## Steps in Vector Autoregressive (VAR) and Vector Error Correction (VEC) Models

Steps in Vector Autoregressive (VAR) and Vector Error Correction (VEC) Models Check co-integration usingJohansen co-integration test If you find any co-integration equation, go for VEC model. However, VAR is fine too for simplicity. Estimation parameters do not differ drasticially. Decide on lag orders. Perform diagnostic check. If all good, perform out-sample forecast. Check accuracy of both in-sample and out-sample forecast. ## Checklist for Structural Equation Modelling

Checklist for Structural Equation Modelling Here I present a checklist for robust structural equation modeling (SEM) in research articles. 1. Data cleaning 2. Check normality of data 3. Check for response bias 4. Develop a measurement model 4.1. Exploratory factor analysis 4.2. Confirmatory factor analysis 4.3. Correlations among latent factors 4.4. Convergent and divergent validity checks 4.5. Reliability checks 4.6. ## Error in maximum likelihood robust estimator in lavaan

Error in t(Delta[[g]]) %*% A1[[g]] : non-conformable arguments If you see this error in lavaan that is because the changed the MLM to MLR for Maximum Likelihood Robust estimator. Change your model fit command to the following: fit.cfamodel3 ## Introduction to R (Part 2) Data types in R

#########DATA TYPES########## #mainly six (6) types #Type 1: Vector ##Six types of vector:logical(T/F),numeric, integer, complex, charater a=TRUE #logical b=FALSE #logical c=20.5 #numeric d=7L #integer #L to mention integer e=10+5L #comples f=”Research HUB” #charater vec= c(1,4,3,7,90,30,40) #to create a vector vec vec2=c(“hello”, “sorry”, “buzinga”) vec2 sortvec=sort(vec) #sorted from small to large sortvec sortvec2=sort(vec2) #sorted alphabatically sortvec2 vec #gives the vaue in ## Introduction to R (Part 1): Data operators in R

#Specifying a variable #here, variable refer to a reserved memory to store values a=30 b=”Welcome to Research HUB” c= TRUE d= 15 #Data operators (5 categories) #Arithmetic operators (+, -, *, /, ^, %%, %/%) a+d a-d a*d a/d a^2 a%%d #%% gives reminder after division a%/%d #%/% gives round-up dividing number #Assignment operator (=, <-, <<-, ->, ->>) ## Structural Equation Modelling (SEM) and Multi-group SEM using R

Structural Equation Modeling (SEM) is a multivariate statistical analysis technique that is used to analyze structural relationships among variables. SEM is the combination of factor analysis and multiple regression analysis. Usually factors are created using multiple observed variables through factor analysis. Those factors are called latent variables. Thereafter, multiple regression analysis is performed on latent variables level, not in observed