The current aim is to simulate an existing data set by fitting a Vector Auto regression Moving Average (VARMA) model, extracting the parameters, and then simulating a new data set using the extracted parameters.
After the data has been simulated, we will run i-ARIMAX and i-BORTUA on both the raw existing data set and the simulated data set to compare how accurately the relationships in the exisisting data set have been simulated.
First, we are going to load in an existing data set used in the paper “Characterizing the momentary association between loneliness, depression, and social interactions: Insights from an ecological momentary assessment study” (Kuczynski et al., 2024).
library(readxl)
# Path to the local file
local_file <- "C:/Users/WillLi/Downloads/rawsimdata.xlsx"
# Read the data file using readxl
rawdata <- read_excel(local_file)
# Display the first few rows of the data
str(rawdata)
## tibble [700 × 32] (S3: tbl_df/tbl/data.frame)
## $ imp : num [1:700] 1 1 1 1 1 1 1 1 1 1 ...
## $ pid : num [1:700] 1070 1070 1070 1070 1070 1070 1070 1070 1070 1070 ...
## $ dayNumber : num [1:700] 0 0 0 0 0 1 1 1 1 1 ...
## $ pingNumber : num [1:700] 0 1 2 3 4 0 1 2 3 4 ...
## $ pingTotal : num [1:700] 1 2 3 4 5 6 7 8 9 10 ...
## $ weekend : num [1:700] 0 0 0 0 0 0 0 0 0 0 ...
## $ gender_woman : num [1:700] 1 1 1 1 1 1 1 1 1 1 ...
## $ socintsatisfaction_state : chr [1:700] "69" "60" "94" "21" ...
## $ socintquantity_state : num [1:700] 3 1 3 8 1 0 2 0 4 1 ...
## $ alone : num [1:700] 1 0 0 0 1 1 1 1 1 1 ...
## $ age : num [1:700] 28 28 28 28 28 28 28 28 28 28 ...
## $ partnered : num [1:700] 1 1 1 1 1 1 1 1 1 1 ...
## $ livealone : num [1:700] 1 1 1 1 1 1 1 1 1 1 ...
## $ mhdx_mdd : num [1:700] 1 1 1 1 1 1 1 1 1 1 ...
## $ mhdx_pdd : num [1:700] 0 0 0 0 0 0 0 0 0 0 ...
## $ mhdx_gad : num [1:700] 1 1 1 1 1 1 1 1 1 1 ...
## $ mhdx_sad : num [1:700] 0 0 0 0 0 0 0 0 0 0 ...
## $ mhdx_ptsd : num [1:700] 0 0 0 0 0 0 0 0 0 0 ...
## $ depressedmood_state : num [1:700] 49.1 50.7 65.7 72.6 64.8 ...
## $ loneliness_trait_gmc : num [1:700] -3.11 -3.11 -3.11 -3.11 -3.11 ...
## $ loneliness_state_pmc : num [1:700] 23.3 -5.12 9.21 16.82 18.5 ...
## $ socintsatisfaction_state_pmc: chr [1:700] "-16.460864999999998" "-25.460864999999998" "8.5391349999999999" "-64.460864999999998" ...
## $ responsiveness_state_pmc : chr [1:700] "-14.474012780000001" "-53.911396109999998" "0.18542055599999999" "-29.906929439999999" ...
## $ selfdisclosure_state_pmc : chr [1:700] "-12.907698330000001" "-43.135873330000003" "-33.151123329999997" "-36.868273330000001" ...
## $ otherdisclosure_state_pmc : chr [1:700] "2.3550749999999998" "-0.54100000000000004" "-7.0928000000000004" "-30.629300000000001" ...
## $ socintquantity_state_pmc : num [1:700] 0.974 -1.026 0.974 5.974 -1.026 ...
## $ loneliness_state_ar1 : num [1:700] 0.515 0.515 0.515 0.515 0.515 ...
## $ loneliness_state_mssd : num [1:700] 182 182 182 182 182 ...
## $ loneliness_state_pmc_l1 : chr [1:700] "NA" "23.295645830000002" "-5.1233624999999998" "9.2054624999999994" ...
## $ loneliness_state_pmc_l2 : chr [1:700] "NA" "NA" "23.295645830000002" "-5.1233624999999998" ...
## $ loneliness_state_pmc_l3 : chr [1:700] "NA" "NA" "NA" "23.295645830000002" ...
## $ loneliness_state_pmc_l4 : chr [1:700] "NA" "NA" "NA" "NA" ...
# Create data frame with only variables that we need
rawdata <- rawdata[, c("pid", "pingTotal", "depressedmood_state", "loneliness_state_pmc", "socintsatisfaction_state_pmc", "responsiveness_state_pmc", "selfdisclosure_state_pmc", "otherdisclosure_state_pmc")]
str(rawdata)
## tibble [700 × 8] (S3: tbl_df/tbl/data.frame)
## $ pid : num [1:700] 1070 1070 1070 1070 1070 1070 1070 1070 1070 1070 ...
## $ pingTotal : num [1:700] 1 2 3 4 5 6 7 8 9 10 ...
## $ depressedmood_state : num [1:700] 49.1 50.7 65.7 72.6 64.8 ...
## $ loneliness_state_pmc : num [1:700] 23.3 -5.12 9.21 16.82 18.5 ...
## $ socintsatisfaction_state_pmc: chr [1:700] "-16.460864999999998" "-25.460864999999998" "8.5391349999999999" "-64.460864999999998" ...
## $ responsiveness_state_pmc : chr [1:700] "-14.474012780000001" "-53.911396109999998" "0.18542055599999999" "-29.906929439999999" ...
## $ selfdisclosure_state_pmc : chr [1:700] "-12.907698330000001" "-43.135873330000003" "-33.151123329999997" "-36.868273330000001" ...
## $ otherdisclosure_state_pmc : chr [1:700] "2.3550749999999998" "-0.54100000000000004" "-7.0928000000000004" "-30.629300000000001" ...
Now that we have loaded and cleaned up the existing data set we will start fitting the data to a VARMA model, extracting the parameters, and then simulating a new data set using the extracted parameters. All this will be done using the MTS package.
First we need to ensure NA values are present for missing values so that we can use the idionomics package to impute missing data.
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.3.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
# Convert columns to numeric and ensure NA values are present where needed
cols_of_interest <- c("socintsatisfaction_state_pmc", "responsiveness_state_pmc", "selfdisclosure_state_pmc", "otherdisclosure_state_pmc")
rawdata <- rawdata %>%
mutate(across(all_of(cols_of_interest), ~ as.numeric(as.character(.))))
## Warning: There were 4 warnings in `mutate()`.
## The first warning was:
## ℹ In argument: `across(all_of(cols_of_interest),
## ~as.numeric(as.character(.)))`.
## Caused by warning:
## ! NAs introduced by coercion
## ℹ Run `dplyr::last_dplyr_warnings()` to see the 3 remaining warnings.
# Fill missing values using idionomics package
library(idionomics)
imputed <- imputatron_2000(data = rawdata, id_col = "pid", time_col = "pingTotal", cols_of_interest = c("depressedmood_state", "loneliness_state_pmc", "socintsatisfaction_state_pmc", "responsiveness_state_pmc", "selfdisclosure_state_pmc", "otherdisclosure_state_pmc"))
## ~~ Beep Boop Beep Boop ~~
## Imputatron will try to impute your dataset
## ...
## Imputatron filtered your data
## Imputatron transformed data to wide format
## Imputatron extracted start and end indexes for each timeseries
## Imputatron dynamically created a list of variables + indexes
## ...
## ###### Imputatron completed data preprocessing ####
## Imputatron created longData3d object
## Imputatron performed copyMeans on your data
## ...
## ###### Imputatron completed data imputation ####
## Imputatron will start data extraction sequence...
## Imputatron extracted a list of dataframes from longData3d object
## Imputatron melted each dataframe back to long format
## Imputatron added names to the list of dataframes
## ...
## ###### Imputatron completed data extraction ####
## Imputatron will start tidy dataframe creation sequence...
## Imputatron created tidy dataframe with all of your variables
## ...
## Imputatron finished the imputation process.
## You can access the following elements:
## Imputed Dataframe: $imputed_df
## Long Data Object: $long_data_obj
## Long Data Object with imputed data: $imputed_data
## Your original data, but filtered: $filtered_data
## Filtered data in wide format: $wide_data
## The list with variable names and indexes to create the Long Data Object: $timeInData_list
## ...
## Imputatron turning off...
## ~~ Beep Boop Beep Boop ~~ Bye!
imputed_rawdata <- imputed$imputed_df
str(imputed$imputed_df)
## 'data.frame': 700 obs. of 8 variables:
## $ pid : chr "1012" "1012" "1012" "1012" ...
## $ pingTotal : num 1 2 3 4 5 6 7 8 9 10 ...
## $ depressedmood_state : num 29.2 27.1 59.7 34.8 40.5 ...
## $ loneliness_state_pmc : num -6.15 -4.16 5.96 8.52 -3.27 ...
## $ socintsatisfaction_state_pmc: num -11.3 44.7 22.7 6.3 10.7 ...
## $ responsiveness_state_pmc : num -9.31 7.097 13.019 4.089 0.487 ...
## $ selfdisclosure_state_pmc : num 26.51 29.88 19.99 20.91 6.44 ...
## $ otherdisclosure_state_pmc : num 6.11 6.44 20.82 31.55 13.13 ...
I had to remove the self-disclosure and other-disclosure variables because it causes an error when I try to fit a VARMA model and simulate data. I think it’s because the variables are too inter correlated resulting in matrix singularity during fitting process?
simulated_data_list <- lapply(rawdata_list, simulate_individual) Error in solve.default(xpx, xpy): System computationally singular: reciprocal condition number = 2.67632e-20 Additionally: Warning message: In log(det(sse)): NaNs produced
# Remove self and other disclosure variable
imputed_rawdata <- imputed_rawdata[, -c(7, 8)]
Then we create a function that fits a VARMA model to each individual’s time series data, extracts the phi (AR), theta (MA), and sigma (Covariance of errors/residuals) matrices for each individual’s model, and then simulates new data with 150 time points using the extracted parameters.
# Split by individuals into a list
rawdata_list <- split(imputed_rawdata, imputed_rawdata$pid)
library(MTS)
## Warning: package 'MTS' was built under R version 4.3.3
# Function to fit VARMA model and simulate new data
simulate_individual <- function(rawdata_list) {
# Remove ID and time columns for fitting
individual_matrix <- as.matrix(rawdata_list[, -c(1, 2)])
# Fit VARMA model
fit <- VARMA(individual_matrix, p = 1, q = 1)
# Extract AR and MA coefficients
phi <- fit$Phi
theta <- fit$Theta
# Extract sigma matrix (covariance matrix of the residuals)
sigma <- fit$Sigma
# Simulate new data using extracted parameters
set.seed(1234)
sim_data <- VARMAsim(n = 150, arlags = c(1), malags = c(1),
phi = phi, theta = theta, sigma = sigma)
simulated_series <- sim_data$series
# Return both the fit object and the noisy simulated series
return(list(fit = fit, simulated_series = simulated_series))
}
# Loop through each individual's data and simulate new data
simulated_data_list <- lapply(rawdata_list, simulate_individual)
## Number of parameters: 36
## initial estimates: 26.4635 1.4037 -9.4653 -0.0849 0.1204 -0.1545 0.0553 0.0615 -0.0467 -0.0759 -0.0617 -0.0452 0.2601 -0.2827 0.3923 0.0295 -0.0266 0.0094 0.0358 0.3638 -0.2366 -0.2029 -0.178 0.1695 -0.4377 -0.2626 -0.0493 0.0709 -1.4278 0.2911 0.3221 -0.7497 0.1768 0.2877 0.1727 -0.2908
## Par. lower-bounds: 17.1288 -6.459 -27.1237 -9.7348 -0.1839 -0.4881 -0.0919 -0.2356 -0.3031 -0.3569 -0.1856 -0.2955 -0.3157 -0.9137 0.1139 -0.5324 -0.3412 -0.3354 -0.1163 0.0567 -0.8143 -0.9509 -0.5932 -0.4949 -0.9243 -0.8926 -0.3991 -0.4888 -2.5206 -1.1238 -0.4634 -2.0066 -0.4204 -0.4855 -0.2565 -0.9777
## Par. upper-bounds: 35.7983 9.2664 8.193 9.565 0.4248 0.1791 0.2024 0.3585 0.2097 0.205 0.0623 0.205 0.8358 0.3483 0.6707 0.5914 0.288 0.3542 0.1879 0.6708 0.341 0.5451 0.2373 0.834 0.0488 0.3674 0.3005 0.6306 -0.3351 1.7061 1.1077 0.5073 0.774 1.0609 0.602 0.3961
## Final Estimates: 26.5607 1.183945 -9.563395 0.08235992 0.1585401 -0.3322324 0.2024204 -0.2355848 -0.01520929 -0.3565469 -0.1069631 0.204965 0.3065563 -0.581732 0.1139456 0.3874356 -0.02716672 0.3542467 0.1878854 0.06520558 0.01243323 0.095918 -0.09811832 0.4698075 -0.2172287 0.3202974 0.05708403 -0.1868315 -0.4304431 0.3908816 0.5213593 -0.6213385 0.06998246 -0.4850365 -0.1203666 0.2870453
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## depressedmood_state 26.56070 6.86517 3.869 0.000109 ***
## loneliness_state_pmc 1.18395 1.94715 0.608 0.543160
## socintsatisfaction_state_pmc -9.56339 3.90127 -2.451 0.014232 *
## responsiveness_state_pmc 0.08236 6.15424 0.013 0.989323
## depressedmood_state 0.15854 0.20310 0.781 0.435044
## loneliness_state_pmc -0.33223 0.61386 -0.541 0.588355
## socintsatisfaction_state_pmc 0.20242 0.13399 1.511 0.130876
## responsiveness_state_pmc -0.23558 0.60608 -0.389 0.697497
## depressedmood_state -0.01521 0.05470 -0.278 0.780959
## loneliness_state_pmc -0.35655 0.35589 -1.002 0.316412
## socintsatisfaction_state_pmc -0.10696 0.13437 -0.796 0.426005
## responsiveness_state_pmc 0.20496 0.37326 0.549 0.582926
## depressedmood_state 0.30656 0.10084 3.040 0.002365 **
## loneliness_state_pmc -0.58173 0.72757 -0.800 0.423968
## socintsatisfaction_state_pmc 0.11395 0.24883 0.458 0.647004
## responsiveness_state_pmc 0.38744 0.89380 0.433 0.664675
## depressedmood_state -0.02717 0.17903 -0.152 0.879387
## loneliness_state_pmc 0.35425 0.60426 0.586 0.557709
## socintsatisfaction_state_pmc 0.18789 0.14576 1.289 0.197381
## responsiveness_state_pmc 0.06521 0.64844 0.101 0.919902
## 0.01243 0.19261 0.065 0.948531
## 0.09592 0.65778 0.146 0.884063
## -0.09812 0.14918 -0.658 0.510711
## 0.46981 0.57171 0.822 0.411214
## -0.21723 0.12797 -1.698 0.089590 .
## 0.32030 0.46816 0.684 0.493876
## 0.05708 0.15191 0.376 0.707088
## -0.18683 0.29810 -0.627 0.530835
## -0.43044 0.28565 -1.507 0.131845
## 0.39088 0.71559 0.546 0.584902
## 0.52136 0.34922 1.493 0.135462
## -0.62134 1.03113 -0.603 0.546788
## 0.06998 0.16174 0.433 0.665242
## -0.48504 0.64826 -0.748 0.454335
## -0.12037 0.16820 -0.716 0.474215
## 0.28705 0.74057 0.388 0.698310
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## ---
## Estimates in matrix form:
## Constant term:
## Estimates: 26.5607 1.183945 -9.563395 0.08235992
## AR coefficient matrix
## AR( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.1585 -0.332 0.202 -0.2356
## [2,] -0.0152 -0.357 -0.107 0.2050
## [3,] 0.3066 -0.582 0.114 0.3874
## [4,] -0.0272 0.354 0.188 0.0652
## MA coefficient matrix
## MA( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] -0.0124 -0.0959 0.0981 -0.470
## [2,] 0.2172 -0.3203 -0.0571 0.187
## [3,] 0.4304 -0.3909 -0.5214 0.621
## [4,] -0.0700 0.4850 0.1204 -0.287
##
## Residuals cov-matrix:
## [,1] [,2] [,3] [,4]
## [1,] 52.0449670 6.7430421 10.2565889 0.1678993
## [2,] 6.7430421 33.8567385 0.7133021 0.6146751
## [3,] 10.2565889 0.7133021 187.3559654 44.0466692
## [4,] 0.1678993 0.6146751 44.0466692 42.1643174
## ----
## aic= 17.15493
## bic= 18.3113
## Number of parameters: 36
## initial estimates: 15.295 -2.2086 -3.7516 2.6902 0.1122 -0.0326 -0.09 0.0674 0.1532 0.0343 -0.071 0.0433 0.2529 -0.2098 0.1832 0.0708 -0.1296 0.2724 -0.042 0.5387 0.1193 -0.0746 0.1786 0.1049 -0.452 0.2333 0.0931 -0.3452 0.1301 0.359 -0.2913 -0.3359 1.2568 -0.8239 -0.2657 -0.0744
## Par. lower-bounds: 10.0717 -8.0693 -12.3396 -6.329 -0.1826 -0.3682 -0.2697 -0.0771 -0.1775 -0.3423 -0.2726 -0.1188 -0.2319 -0.7616 -0.1122 -0.1668 -0.6386 -0.3071 -0.3522 0.2891 -0.6749 -0.6021 -0.3387 -0.2871 -1.3431 -0.3585 -0.4873 -0.785 -1.1757 -0.5083 -1.1419 -0.9805 -0.1146 -1.7347 -1.159 -0.7513
## Par. upper-bounds: 20.5183 3.652 4.8365 11.7095 0.407 0.303 0.0896 0.2119 0.484 0.4109 0.1306 0.2055 0.7376 0.342 0.4786 0.3084 0.3795 0.8519 0.2682 0.7882 0.9135 0.4529 0.6959 0.497 0.4391 0.8251 0.6735 0.0947 1.4359 1.2262 0.5592 0.3086 2.6281 0.0869 0.6276 0.6025
## Final Estimates: 15.50768 -2.84069 -4.387188 1.33799 0.1050462 -0.08889168 -0.1013647 -0.02666177 0.1832148 -0.3422976 0.1305542 -0.06922326 0.2972035 -0.761647 0.05697506 -0.1072591 -0.0617663 0.8519363 0.2682457 0.7587011 0.1071 0.003815948 -0.01652415 0.1389612 -0.1695297 0.4741012 -0.2682368 0.06120512 -0.005826791 0.8739563 0.09178951 0.254393 0.03608224 -1.014254 -0.3411109 -0.3343996
## Warning in sqrt(diag(solve(Hessian))): NaNs produced
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## depressedmood_state 15.507679 4.096821 3.785 0.000154 ***
## loneliness_state_pmc -2.840690 NaN NaN NaN
## socintsatisfaction_state_pmc -4.387188 NaN NaN NaN
## responsiveness_state_pmc 1.337990 NaN NaN NaN
## depressedmood_state 0.105046 0.230035 0.457 0.647921
## loneliness_state_pmc -0.088892 0.297501 -0.299 0.765097
## socintsatisfaction_state_pmc -0.101365 0.173371 -0.585 0.558771
## responsiveness_state_pmc -0.026662 0.116272 -0.229 0.818632
## depressedmood_state 0.183215 0.033966 5.394 6.89e-08 ***
## loneliness_state_pmc -0.342298 0.302811 -1.130 0.258308
## socintsatisfaction_state_pmc 0.130554 0.317645 0.411 0.681068
## responsiveness_state_pmc -0.069223 0.208315 -0.332 0.739662
## depressedmood_state 0.297203 NaN NaN NaN
## loneliness_state_pmc -0.761647 0.995391 -0.765 0.444168
## socintsatisfaction_state_pmc 0.056975 0.278667 0.204 0.837997
## responsiveness_state_pmc -0.107259 0.253161 -0.424 0.671800
## depressedmood_state -0.061766 NaN NaN NaN
## loneliness_state_pmc 0.851936 0.926422 0.920 0.357783
## socintsatisfaction_state_pmc 0.268246 0.938738 0.286 0.775069
## responsiveness_state_pmc 0.758701 0.180419 4.205 2.61e-05 ***
## 0.107100 0.241360 0.444 0.657234
## 0.003816 0.343817 0.011 0.991145
## -0.016524 0.192446 -0.086 0.931575
## 0.138961 0.100094 1.388 0.165042
## -0.169530 0.189533 -0.894 0.371077
## 0.474101 0.289619 1.637 0.101634
## -0.268237 0.274792 -0.976 0.328993
## 0.061205 0.165243 0.370 0.711088
## -0.005827 NaN NaN NaN
## 0.873956 0.955711 0.914 0.360477
## 0.091790 0.252792 0.363 0.716528
## 0.254393 0.328059 0.775 0.438075
## 0.036082 NaN NaN NaN
## -1.014254 0.892208 -1.137 0.255625
## -0.341111 1.088415 -0.313 0.753976
## -0.334400 0.222760 -1.501 0.133313
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## ---
## Estimates in matrix form:
## Constant term:
## Estimates: 15.50768 -2.84069 -4.387188 1.33799
## AR coefficient matrix
## AR( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.1050 -0.0889 -0.101 -0.0267
## [2,] 0.1832 -0.3423 0.131 -0.0692
## [3,] 0.2972 -0.7616 0.057 -0.1073
## [4,] -0.0618 0.8519 0.268 0.7587
## MA coefficient matrix
## MA( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] -0.10710 -0.00382 0.0165 -0.1390
## [2,] 0.16953 -0.47410 0.2682 -0.0612
## [3,] 0.00583 -0.87396 -0.0918 -0.2544
## [4,] -0.03608 1.01425 0.3411 0.3344
##
## Residuals cov-matrix:
## [,1] [,2] [,3] [,4]
## [1,] 35.269945 5.0656110 9.5820876 -9.099355
## [2,] 5.065611 33.3806858 0.9130151 8.264177
## [3,] 9.582088 0.9130151 66.8908204 12.645313
## [4,] -9.099355 8.2641765 12.6453131 74.770457
## ----
## aic= 16.43043
## bic= 17.5868
## Number of parameters: 36
## initial estimates: 16.8801 2.2712 2.4754 2.3253 0.2056 0.078 -0.2278 -0.462 -0.0038 0.4111 -0.0511 -0.9831 -0.1947 -0.174 0.2858 0.6663 -0.0138 -0.1517 -0.0657 0.3946 -0.5498 0.0249 -0.1031 0.8495 -0.3189 0.0246 -0.1524 2.1445 0.2116 -0.098 0.1969 -1.5077 -0.1303 0.1555 -9e-04 -0.8934
## Par. lower-bounds: 7.8778 -10.1908 -5.1573 -1.0907 -0.2215 -0.2135 -0.6317 -1.231 -0.5951 0.0075 -0.6103 -2.0477 -0.5568 -0.4212 -0.0566 0.0143 -0.1759 -0.2623 -0.219 0.1028 -1.3303 -0.5721 -0.8674 -0.8559 -1.3993 -0.8018 -1.2105 -0.2162 -0.4501 -0.6042 -0.4511 -2.9536 -0.4265 -0.071 -0.291 -1.5405
## Par. upper-bounds: 25.8824 14.7332 10.1081 5.7414 0.6327 0.3695 0.1762 0.307 0.5875 0.8146 0.5081 0.0814 0.1675 0.0731 0.6283 1.3183 0.1482 -0.0411 0.0875 0.6864 0.2307 0.6219 0.6613 2.5548 0.7614 0.851 0.9057 4.5053 0.8734 0.4082 0.845 -0.0618 0.1658 0.382 0.2891 -0.2462
## Final Estimates: 16.77557 2.325582 2.527409 1.97274 0.1503915 -0.2134968 -0.6062959 -0.2674939 0.04664582 0.8124379 0.4016155 -1.503892 -0.256709 -0.04462195 0.2471596 1.116427 -0.06041166 -0.07656135 -0.1183524 0.6814259 -0.3111271 0.4806776 0.4848745 0.3635618 0.194406 -0.7274622 -0.5274944 1.324364 0.2922856 -0.1765584 0.2467009 -1.185015 0.1423489 -0.04911289 0.1859005 -0.5410203
## Warning in sqrt(diag(solve(Hessian))): NaNs produced
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## depressedmood_state 16.77557 11.59436 1.447 0.14793
## loneliness_state_pmc 2.32558 11.26829 0.206 0.83649
## socintsatisfaction_state_pmc 2.52741 8.70273 0.290 0.77150
## responsiveness_state_pmc 1.97274 1.56185 1.263 0.20656
## depressedmood_state 0.15039 0.58718 0.256 0.79785
## loneliness_state_pmc -0.21350 0.25298 -0.844 0.39872
## socintsatisfaction_state_pmc -0.60630 0.54587 -1.111 0.26670
## responsiveness_state_pmc -0.26749 0.22533 -1.187 0.23518
## depressedmood_state 0.04665 0.51675 0.090 0.92807
## loneliness_state_pmc 0.81244 0.29382 2.765 0.00569 **
## socintsatisfaction_state_pmc 0.40162 0.59650 0.673 0.50076
## responsiveness_state_pmc -1.50389 0.86262 -1.743 0.08126 .
## depressedmood_state -0.25671 0.33722 -0.761 0.44650
## loneliness_state_pmc -0.04462 0.29901 -0.149 0.88137
## socintsatisfaction_state_pmc 0.24716 0.41712 0.593 0.55349
## responsiveness_state_pmc 1.11643 0.95137 1.173 0.24060
## depressedmood_state -0.06041 0.06322 -0.956 0.33926
## loneliness_state_pmc -0.07656 NaN NaN NaN
## socintsatisfaction_state_pmc -0.11835 NaN NaN NaN
## responsiveness_state_pmc 0.68143 NaN NaN NaN
## -0.31113 0.51583 -0.603 0.54640
## 0.48068 0.21977 2.187 0.02873 *
## 0.48487 0.75536 0.642 0.52093
## 0.36356 0.15056 2.415 0.01575 *
## 0.19441 0.52089 0.373 0.70898
## -0.72746 0.26207 -2.776 0.00551 **
## -0.52749 0.79522 -0.663 0.50712
## 1.32436 0.80777 1.640 0.10110
## 0.29229 0.37295 0.784 0.43321
## -0.17656 0.27497 -0.642 0.52081
## 0.24670 0.59795 0.413 0.67991
## -1.18501 0.96699 -1.225 0.22040
## 0.14235 NaN NaN NaN
## -0.04911 NaN NaN NaN
## 0.18590 NaN NaN NaN
## -0.54102 NaN NaN NaN
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## ---
## Estimates in matrix form:
## Constant term:
## Estimates: 16.77557 2.325582 2.527409 1.97274
## AR coefficient matrix
## AR( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.1504 -0.2135 -0.606 -0.267
## [2,] 0.0466 0.8124 0.402 -1.504
## [3,] -0.2567 -0.0446 0.247 1.116
## [4,] -0.0604 -0.0766 -0.118 0.681
## MA coefficient matrix
## MA( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.311 -0.4807 -0.485 -0.364
## [2,] -0.194 0.7275 0.527 -1.324
## [3,] -0.292 0.1766 -0.247 1.185
## [4,] -0.142 0.0491 -0.186 0.541
##
## Residuals cov-matrix:
## [,1] [,2] [,3] [,4]
## [1,] 168.701740 190.96345 -67.81434 -4.372419
## [2,] 190.963447 325.66291 -103.21602 -17.313407
## [3,] -67.814339 -103.21602 102.77830 21.044162
## [4,] -4.372419 -17.31341 21.04416 36.478382
## ----
## aic= 18.52662
## bic= 19.68299
## Number of parameters: 36
## initial estimates: 31.2081 -22.4688 18.443 6.8525 0.5522 -0.0932 -0.0397 -0.1477 0.3323 0.2429 -0.0179 0.0913 -0.2696 0.7345 0.4486 0.3604 -0.1257 -0.1199 0.1668 0.1551 -0.8438 0.4644 -0.2349 0.0216 -0.6284 0.0084 -0.0685 0.058 0.9868 -1.2221 0.3211 0.0065 0.085 -0.4578 -0.2722 -0.0031
## Par. lower-bounds: 8.7137 -47.7095 -24.3963 -20.0609 0.2284 -0.4657 -0.1955 -0.4491 -0.031 -0.1751 -0.1927 -0.2469 -0.8863 0.0251 0.1518 -0.2135 -0.5131 -0.5656 -0.0197 -0.2054 -1.52 -0.195 -0.7191 -0.594 -1.3872 -0.7315 -0.6117 -0.6328 -0.3011 -2.4779 -0.6009 -1.166 -0.7241 -1.2468 -0.8514 -0.7397
## Par. upper-bounds: 53.7025 2.7718 61.2823 33.7659 0.876 0.2793 0.1161 0.1536 0.6957 0.6609 0.157 0.4294 0.3471 1.444 0.7453 0.9343 0.2618 0.3258 0.3532 0.5157 -0.1675 1.1239 0.2492 0.6372 0.1304 0.7484 0.4747 0.7488 2.2747 0.0338 1.2431 1.1789 0.8941 0.3312 0.3071 0.7335
## Final Estimates: 30.97354 -22.38152 18.41903 7.165229 0.536213 -0.1040728 0.1161211 -0.4490099 0.3393684 0.2448737 -0.05377215 -0.1576518 -0.3139847 1.248228 0.7182872 -0.1776403 -0.1333014 -0.1294185 0.1199841 0.5106019 -0.3209361 0.01695037 -0.2770166 0.3369397 -0.469675 -0.09562999 0.01400309 0.297889 0.6332756 -1.515773 -0.4580987 0.4286804 0.2148776 0.1376826 0.02766493 -0.3738548
## Warning in sqrt(diag(solve(Hessian))): NaNs produced
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## depressedmood_state 30.973538 11.146987 2.779 0.005459 **
## loneliness_state_pmc -22.381517 2.685886 -8.333 < 2e-16 ***
## socintsatisfaction_state_pmc 18.419026 34.563186 0.533 0.594097
## responsiveness_state_pmc 7.165229 14.555079 0.492 0.622519
## depressedmood_state 0.536213 0.169502 3.163 0.001559 **
## loneliness_state_pmc -0.104073 NaN NaN NaN
## socintsatisfaction_state_pmc 0.116121 0.009257 12.544 < 2e-16 ***
## responsiveness_state_pmc -0.449010 NaN NaN NaN
## depressedmood_state 0.339368 0.045029 7.537 4.82e-14 ***
## loneliness_state_pmc 0.244874 0.340003 0.720 0.471396
## socintsatisfaction_state_pmc -0.053772 0.066618 -0.807 0.419565
## responsiveness_state_pmc -0.157652 0.277717 -0.568 0.570258
## depressedmood_state -0.313985 0.529151 -0.593 0.552931
## loneliness_state_pmc 1.248228 0.744289 1.677 0.093528 .
## socintsatisfaction_state_pmc 0.718287 0.130832 5.490 4.02e-08 ***
## responsiveness_state_pmc -0.177640 NaN NaN NaN
## depressedmood_state -0.133301 0.222535 -0.599 0.549164
## loneliness_state_pmc -0.129418 0.111933 -1.156 0.247592
## socintsatisfaction_state_pmc 0.119984 NaN NaN NaN
## responsiveness_state_pmc 0.510602 NaN NaN NaN
## -0.320936 0.200429 -1.601 0.109323
## 0.016950 NaN NaN NaN
## -0.277017 0.073882 -3.749 0.000177 ***
## 0.336940 NaN NaN NaN
## -0.469675 NaN NaN NaN
## -0.095630 0.293439 -0.326 0.744504
## 0.014003 0.205002 0.068 0.945541
## 0.297889 0.246087 1.211 0.226087
## 0.633276 0.490339 1.292 0.196528
## -1.515773 1.088134 -1.393 0.163619
## -0.458099 0.038319 -11.955 < 2e-16 ***
## 0.428680 NaN NaN NaN
## 0.214878 0.139399 1.541 0.123207
## 0.137683 0.203949 0.675 0.499623
## 0.027665 0.138652 0.200 0.841850
## -0.373855 NaN NaN NaN
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## ---
## Estimates in matrix form:
## Constant term:
## Estimates: 30.97354 -22.38152 18.41903 7.165229
## AR coefficient matrix
## AR( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.536 -0.104 0.1161 -0.449
## [2,] 0.339 0.245 -0.0538 -0.158
## [3,] -0.314 1.248 0.7183 -0.178
## [4,] -0.133 -0.129 0.1200 0.511
## MA coefficient matrix
## MA( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.321 -0.0170 0.2770 -0.337
## [2,] 0.470 0.0956 -0.0140 -0.298
## [3,] -0.633 1.5158 0.4581 -0.429
## [4,] -0.215 -0.1377 -0.0277 0.374
##
## Residuals cov-matrix:
## [,1] [,2] [,3] [,4]
## [1,] 116.36179 59.84414 -85.9036 -14.86582
## [2,] 59.84414 161.18054 -132.1918 -65.57757
## [3,] -85.90360 -132.19177 432.8022 147.66671
## [4,] -14.86582 -65.57757 147.6667 181.98040
## ----
## aic= 21.20963
## bic= 22.366
## Number of parameters: 36
## initial estimates: 7.1996 2.5364 0.4137 -0.9089 -0.1599 0.1271 -0.0852 -0.0366 -0.3311 0.5078 -0.1311 -0.1908 -0.0924 0.0025 0.1026 0.0892 0.186 -0.1819 -0.0778 0.4744 0.3011 -0.422 -0.0193 -0.1597 0.2368 -0.5454 -0.0919 0.2217 -0.1926 -0.0398 -0.162 -0.3351 0.1 0.2778 0.3685 -0.7461
## Par. lower-bounds: 4.3287 -1.9725 -4.0147 -4.2047 -0.5292 -0.0825 -0.2879 -0.3147 -0.9112 0.1786 -0.4493 -0.6277 -0.6621 -0.3208 -0.2099 -0.3399 -0.238 -0.4225 -0.3104 0.155 -0.3598 -0.8865 -0.3999 -0.7095 -0.8013 -1.2749 -0.6896 -0.6419 -1.2121 -0.7563 -0.749 -1.1833 -0.6587 -0.2554 -0.0684 -1.3773
## Par. upper-bounds: 10.0706 7.0454 4.8422 2.3868 0.2094 0.3367 0.1174 0.2416 0.2489 0.837 0.1872 0.2461 0.4773 0.3259 0.4152 0.5183 0.61 0.0588 0.1548 0.7937 0.9621 0.0425 0.3613 0.3902 1.2748 0.1842 0.5058 1.0853 0.8269 0.6767 0.4251 0.5131 0.8587 0.811 0.8054 -0.1149
## Final Estimates: 7.144682 2.473312 0.3699705 -0.9166265 -0.1821947 0.316578 0.01798744 -0.09666605 -0.428877 0.8339285 -0.3417162 -0.2673682 -0.1250625 0.06941488 0.4126679 0.2598238 0.1308287 -0.1181109 -0.08999148 0.7458227 0.01167531 -0.4992042 -0.2698725 0.1502054 0.0429577 -0.9356748 0.04983098 0.2959728 -0.280929 -0.07256936 -0.6082165 0.226605 0.2333871 0.08071241 0.221737 -0.5934498
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## depressedmood_state 7.144682 1.390358 5.139 2.77e-07 ***
## loneliness_state_pmc 2.473312 0.400403 6.177 6.53e-10 ***
## socintsatisfaction_state_pmc 0.369971 3.255531 0.114 0.90952
## responsiveness_state_pmc -0.916626 1.708961 -0.536 0.59171
## depressedmood_state -0.182195 0.182984 -0.996 0.31940
## loneliness_state_pmc 0.316578 0.296531 1.068 0.28570
## socintsatisfaction_state_pmc 0.017987 0.184551 0.097 0.92236
## responsiveness_state_pmc -0.096666 0.455568 -0.212 0.83196
## depressedmood_state -0.428877 0.057887 -7.409 1.27e-13 ***
## loneliness_state_pmc 0.833928 0.063630 13.106 < 2e-16 ***
## socintsatisfaction_state_pmc -0.341716 0.117168 -2.916 0.00354 **
## responsiveness_state_pmc -0.267368 0.196128 -1.363 0.17281
## depressedmood_state -0.125062 0.535347 -0.234 0.81529
## loneliness_state_pmc 0.069415 0.316176 0.220 0.82623
## socintsatisfaction_state_pmc 0.412668 0.160052 2.578 0.00993 **
## responsiveness_state_pmc 0.259824 0.382607 0.679 0.49708
## depressedmood_state 0.130829 0.273250 0.479 0.63209
## loneliness_state_pmc -0.118111 0.097931 -1.206 0.22779
## socintsatisfaction_state_pmc -0.089991 0.162946 -0.552 0.58076
## responsiveness_state_pmc 0.745823 0.300307 2.484 0.01301 *
## 0.011675 0.172028 0.068 0.94589
## -0.499204 0.349273 -1.429 0.15293
## -0.269872 0.176067 -1.533 0.12533
## 0.150205 0.469882 0.320 0.74922
## 0.042958 0.137792 0.312 0.75522
## -0.935675 0.001545 -605.685 < 2e-16 ***
## 0.049831 0.062036 0.803 0.42182
## 0.295973 0.176854 1.674 0.09422 .
## -0.280929 0.560120 -0.502 0.61598
## -0.072569 0.355338 -0.204 0.83818
## -0.608217 0.289580 -2.100 0.03570 *
## 0.226605 0.405109 0.559 0.57591
## 0.233387 0.265235 0.880 0.37890
## 0.080712 0.040274 2.004 0.04506 *
## 0.221737 0.154545 1.435 0.15135
## -0.593450 0.332826 -1.783 0.07458 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## ---
## Estimates in matrix form:
## Constant term:
## Estimates: 7.144682 2.473312 0.3699705 -0.9166265
## AR coefficient matrix
## AR( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] -0.182 0.3166 0.018 -0.0967
## [2,] -0.429 0.8339 -0.342 -0.2674
## [3,] -0.125 0.0694 0.413 0.2598
## [4,] 0.131 -0.1181 -0.090 0.7458
## MA coefficient matrix
## MA( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] -0.0117 0.4992 0.2699 -0.150
## [2,] -0.0430 0.9357 -0.0498 -0.296
## [3,] 0.2809 0.0726 0.6082 -0.227
## [4,] -0.2334 -0.0807 -0.2217 0.593
##
## Residuals cov-matrix:
## [,1] [,2] [,3] [,4]
## [1,] 39.708234 29.96309 -24.56602 -9.495311
## [2,] 29.963092 106.91894 -36.37989 -16.704844
## [3,] -24.566022 -36.37989 122.18233 53.070058
## [4,] -9.495311 -16.70484 53.07006 68.581260
## ----
## aic= 17.59812
## bic= 18.75449
## Number of parameters: 36
## initial estimates: 13.7806 -3.7168 1.0672 3.7158 0.4785 -0.0125 -0.0511 0.1276 0.1721 0.107 0.0775 -0.0087 -0.0385 -0.0215 0.2721 -0.1008 -0.1161 0.3036 0.2434 0.0628 0.3347 -1.1815 0.1797 -0.8487 0.7976 -1.4645 -0.1373 -0.0891 -0.4169 1.1145 -0.7172 1.0484 -0.751 0.7036 -0.1629 0.0376
## Par. lower-bounds: 3.2796 -11.3794 -9.7284 -4.9666 0.0909 -0.536 -0.3963 -0.32 -0.1107 -0.2751 -0.1744 -0.3353 -0.4369 -0.5598 -0.0828 -0.561 -0.4365 -0.1293 -0.042 -0.3073 -0.5753 -2.4488 -0.6363 -1.872 0.1335 -2.3893 -0.7328 -0.8358 -1.3525 -0.1884 -1.5561 -0.0036 -1.5035 -0.3442 -0.8376 -0.8085
## Par. upper-bounds: 24.2815 3.9458 11.8628 12.3982 0.866 0.5111 0.2941 0.5753 0.4549 0.4891 0.3294 0.318 0.3599 0.5168 0.627 0.3594 0.2043 0.7365 0.5289 0.4329 1.2447 0.0858 0.9957 0.1747 1.4616 -0.5397 0.4582 0.6577 0.5186 2.4174 0.1217 2.1005 0.0014 1.7515 0.5118 0.8838
## Final Estimates: 13.76511 -3.658342 1.031522 3.703772 0.4024891 0.4432519 0.2893357 0.512488 0.1237972 0.4453659 -0.06840467 0.317972 -0.02938443 -0.4223081 0.6269758 -0.5580941 -0.1045066 0.1415224 0.06081943 -0.2136291 0.05121923 -0.8652528 -0.2823286 -0.7037211 0.2007184 -0.815501 0.1358874 -0.2677997 -0.04757185 0.8241241 -0.7664619 0.7749712 -0.1789329 0.4485894 -0.02509364 0.5047331
## Warning in sqrt(diag(solve(Hessian))): NaNs produced
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## depressedmood_state 13.76511 13.02113 1.057 0.29045
## loneliness_state_pmc -3.65834 0.21179 -17.273 < 2e-16 ***
## socintsatisfaction_state_pmc 1.03152 12.94902 0.080 0.93651
## responsiveness_state_pmc 3.70377 17.64514 0.210 0.83374
## depressedmood_state 0.40249 0.47027 0.856 0.39207
## loneliness_state_pmc 0.44325 0.97328 0.455 0.64881
## socintsatisfaction_state_pmc 0.28934 NaN NaN NaN
## responsiveness_state_pmc 0.51249 0.82204 0.623 0.53300
## depressedmood_state 0.12380 0.04171 2.968 0.00299 **
## loneliness_state_pmc 0.44537 0.36994 1.204 0.22863
## socintsatisfaction_state_pmc -0.06840 0.21611 -0.317 0.75160
## responsiveness_state_pmc 0.31797 0.37915 0.839 0.40167
## depressedmood_state -0.02938 0.49044 -0.060 0.95222
## loneliness_state_pmc -0.42231 0.73646 -0.573 0.56635
## socintsatisfaction_state_pmc 0.62698 0.21092 2.973 0.00295 **
## responsiveness_state_pmc -0.55809 0.48055 -1.161 0.24549
## depressedmood_state -0.10451 0.70815 -0.148 0.88268
## loneliness_state_pmc 0.14152 0.21440 0.660 0.50919
## socintsatisfaction_state_pmc 0.06082 0.16234 0.375 0.70792
## responsiveness_state_pmc -0.21363 0.76980 -0.278 0.78139
## 0.05122 0.53284 0.096 0.92342
## -0.86525 0.85289 -1.014 0.31035
## -0.28233 NaN NaN NaN
## -0.70372 0.89014 -0.791 0.42919
## 0.20072 0.14260 1.408 0.15926
## -0.81550 0.35044 -2.327 0.01996 *
## 0.13589 0.14623 0.929 0.35275
## -0.26780 0.44919 -0.596 0.55105
## -0.04757 0.53222 -0.089 0.92878
## 0.82412 0.89140 0.925 0.35521
## -0.76646 0.28830 -2.659 0.00785 **
## 0.77497 0.47861 1.619 0.10540
## -0.17893 0.79206 -0.226 0.82127
## 0.44859 0.33485 1.340 0.18036
## -0.02509 0.22396 -0.112 0.91079
## 0.50473 0.90976 0.555 0.57903
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## ---
## Estimates in matrix form:
## Constant term:
## Estimates: 13.76511 -3.658342 1.031522 3.703772
## AR coefficient matrix
## AR( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.4025 0.443 0.2893 0.512
## [2,] 0.1238 0.445 -0.0684 0.318
## [3,] -0.0294 -0.422 0.6270 -0.558
## [4,] -0.1045 0.142 0.0608 -0.214
## MA coefficient matrix
## MA( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] -0.0512 0.865 0.2823 0.704
## [2,] -0.2007 0.816 -0.1359 0.268
## [3,] 0.0476 -0.824 0.7665 -0.775
## [4,] 0.1789 -0.449 0.0251 -0.505
##
## Residuals cov-matrix:
## [,1] [,2] [,3] [,4]
## [1,] 210.51156 109.04899 -111.46717 -85.81668
## [2,] 109.04899 126.94399 -73.98434 -65.42262
## [3,] -111.46717 -73.98434 224.68838 105.67234
## [4,] -85.81668 -65.42262 105.67234 141.53303
## ----
## aic= 20.11902
## bic= 21.27539
## Number of parameters: 36
## initial estimates: 25.8437 -4.9757 -4.7346 -6.2618 0.2585 0.1447 0.2629 -0.3315 0.1006 0.4086 -0.0017 0.0258 0.1333 -0.5894 0.3224 -0.1629 0.1707 -0.6505 -0.0142 0.0847 -0.117 0.2894 -0.1093 0.4317 -0.084 0.4228 0.1681 -0.1508 -0.0739 0.5187 -1.283 0.8956 0.1957 0.4814 -0.7593 0.6378
## Par. lower-bounds: 14.4191 -16.6027 -20.3323 -24.0283 -0.0442 -0.2039 -0.0513 -0.6524 -0.2075 0.0537 -0.3215 -0.3008 -0.28 -1.0654 -0.1066 -0.601 -0.3 -1.1927 -0.5029 -0.4143 -0.7365 -0.4782 -0.9757 -0.2701 -0.7145 -0.3585 -0.7137 -0.865 -0.9197 -0.5294 -2.4659 -0.0626 -0.7677 -0.7124 -2.1066 -0.4536
## Par. upper-bounds: 37.2683 6.6513 10.8632 11.5048 0.5612 0.4933 0.5772 -0.0106 0.4087 0.7634 0.3181 0.3523 0.5466 -0.1134 0.7514 0.2752 0.6415 -0.1083 0.4745 0.5837 0.5025 1.057 0.7571 1.1336 0.5465 1.204 1.0498 0.5634 0.7719 1.5667 -0.1001 1.8538 1.1591 1.6751 0.5881 1.7292
## Final Estimates: 25.83624 -4.98666 -4.714022 -6.266612 0.3197058 0.0004138998 0.2281808 -0.3937679 0.1049289 0.3295515 -0.1958658 0.1599344 0.1247017 -0.4393905 0.6913423 -0.1360302 0.1851714 -0.7191725 0.01495136 0.1383826 -0.0890716 0.3108588 -0.1688175 0.241248 -0.06902205 0.07149893 0.2955314 -0.2322249 -0.2877327 0.4450587 -1.358527 0.7197429 -0.1006029 0.4327174 -0.6294831 0.5184923
## Warning in sqrt(diag(solve(Hessian))): NaNs produced
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## depressedmood_state 25.8362407 0.8951006 28.864 < 2e-16 ***
## loneliness_state_pmc -4.9866601 NaN NaN NaN
## socintsatisfaction_state_pmc -4.7140216 0.0682570 -69.063 < 2e-16 ***
## responsiveness_state_pmc -6.2666118 0.5012378 -12.502 < 2e-16 ***
## depressedmood_state 0.3197058 0.0155965 20.499 < 2e-16 ***
## loneliness_state_pmc 0.0004139 NaN NaN NaN
## socintsatisfaction_state_pmc 0.2281808 0.0955399 2.388 0.0169 *
## responsiveness_state_pmc -0.3937679 0.8496117 -0.463 0.6430
## depressedmood_state 0.1049289 0.0181912 5.768 8.02e-09 ***
## loneliness_state_pmc 0.3295515 0.0370170 8.903 < 2e-16 ***
## socintsatisfaction_state_pmc -0.1958658 0.1323985 -1.479 0.1390
## responsiveness_state_pmc 0.1599344 0.3821034 0.419 0.6755
## depressedmood_state 0.1247017 0.0040405 30.863 < 2e-16 ***
## loneliness_state_pmc -0.4393905 0.0271664 -16.174 < 2e-16 ***
## socintsatisfaction_state_pmc 0.6913423 0.0069521 99.444 < 2e-16 ***
## responsiveness_state_pmc -0.1360302 0.0078629 -17.300 < 2e-16 ***
## depressedmood_state 0.1851714 0.0145268 12.747 < 2e-16 ***
## loneliness_state_pmc -0.7191725 0.0102253 -70.333 < 2e-16 ***
## socintsatisfaction_state_pmc 0.0149514 0.3211919 0.047 0.9629
## responsiveness_state_pmc 0.1383826 0.4836135 0.286 0.7748
## -0.0890716 0.5572372 -0.160 0.8730
## 0.3108588 0.4527556 0.687 0.4923
## -0.1688175 0.1224651 -1.378 0.1681
## 0.2412480 0.5774552 0.418 0.6761
## -0.0690221 0.3706112 -0.186 0.8523
## 0.0714989 0.4411341 0.162 0.8712
## 0.2955314 0.0693278 4.263 2.02e-05 ***
## -0.2322249 0.6756926 -0.344 0.7311
## -0.2877327 0.0043948 -65.471 < 2e-16 ***
## 0.4450587 0.0150305 29.610 < 2e-16 ***
## -1.3585269 0.0008646 -1571.299 < 2e-16 ***
## 0.7197429 0.0020905 344.287 < 2e-16 ***
## -0.1006029 0.0739880 -1.360 0.1739
## 0.4327174 0.0406530 10.644 < 2e-16 ***
## -0.6294831 0.0103754 -60.671 < 2e-16 ***
## 0.5184923 0.1025023 5.058 4.23e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## ---
## Estimates in matrix form:
## Constant term:
## Estimates: 25.83624 -4.98666 -4.714022 -6.266612
## AR coefficient matrix
## AR( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.320 0.000414 0.228 -0.394
## [2,] 0.105 0.329552 -0.196 0.160
## [3,] 0.125 -0.439390 0.691 -0.136
## [4,] 0.185 -0.719172 0.015 0.138
## MA coefficient matrix
## MA( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.0891 -0.3109 0.169 -0.241
## [2,] 0.0690 -0.0715 -0.296 0.232
## [3,] 0.2877 -0.4451 1.359 -0.720
## [4,] 0.1006 -0.4327 0.629 -0.518
##
## Residuals cov-matrix:
## [,1] [,2] [,3] [,4]
## [1,] 156.87014 69.30893 -50.37591 -49.83805
## [2,] 69.30893 129.61706 -38.77261 -57.99923
## [3,] -50.37591 -38.77261 265.66340 236.72258
## [4,] -49.83805 -57.99923 236.72258 341.70611
## ----
## aic= 21.02317
## bic= 22.17954
## Number of parameters: 36
## initial estimates: 23.4967 0.4382 5.3973 5.7201 0.2739 -0.3344 -0.0451 -0.2822 0.0849 -0.0863 0.2098 -0.5333 -0.2851 0.3759 0.4627 0.1773 -0.2659 0.2193 -0.0901 0.5658 0.0594 1.1895 0.5069 -0.1121 0.021 0.7433 0.1656 0.0315 0.0612 -1.089 -0.5545 -0.2493 0.0459 -0.6786 -0.0499 -0.5452
## Par. lower-bounds: 13.2811 -8.3149 -5.0677 -3.6663 -0.0489 -0.7193 -0.4237 -0.7462 -0.1916 -0.4162 -0.1147 -0.9308 -0.6157 -0.0185 0.0748 -0.298 -0.5624 -0.1345 -0.438 0.1395 -0.6341 0.2771 -0.2096 -1.2019 -0.5732 -0.0385 -0.4482 -0.9023 -0.6493 -2.0238 -1.2885 -1.3656 -0.5913 -1.517 -0.7082 -1.5465
## Par. upper-bounds: 33.7123 9.1912 15.8624 15.1065 0.5966 0.0506 0.3336 0.1817 0.3615 0.2436 0.5342 -0.1358 0.0455 0.7702 0.8506 0.6525 0.0307 0.573 0.2579 0.9921 0.7529 2.102 1.2233 0.9776 0.6152 1.5251 0.7795 0.9652 0.7716 -0.1543 0.1794 0.8671 0.6831 0.1598 0.6084 0.456
## Final Estimates: 23.47129 0.4617356 5.425038 5.704096 0.1859301 -0.278455 -0.1949036 -0.4666132 -0.008329246 0.1815017 0.2738327 -0.7949189 -0.1799857 0.7424762 0.7323663 0.3647884 -0.1479732 0.5730218 -0.08827172 0.5831397 -0.03448522 0.2770934 0.5047502 0.1077895 -0.0004658998 -0.02058402 -0.09403086 0.3799993 -0.02800139 -1.03212 -0.9943817 -0.1402917 -0.08127509 -0.8040835 0.001451659 -0.3231939
## Warning in sqrt(diag(solve(Hessian))): NaNs produced
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## depressedmood_state 23.4712941 NaN NaN NaN
## loneliness_state_pmc 0.4617356 NaN NaN NaN
## socintsatisfaction_state_pmc 5.4250375 4.8863818 1.110 0.26690
## responsiveness_state_pmc 5.7040963 1.8322235 3.113 0.00185 **
## depressedmood_state 0.1859301 NaN NaN NaN
## loneliness_state_pmc -0.2784550 0.3409275 -0.817 0.41407
## socintsatisfaction_state_pmc -0.1949036 NaN NaN NaN
## responsiveness_state_pmc -0.4666132 NaN NaN NaN
## depressedmood_state -0.0083292 0.0454311 -0.183 0.85453
## loneliness_state_pmc 0.1815017 0.2337412 0.777 0.43745
## socintsatisfaction_state_pmc 0.2738327 0.1637086 1.673 0.09439 .
## responsiveness_state_pmc -0.7949189 NaN NaN NaN
## depressedmood_state -0.1799857 0.1919282 -0.938 0.34836
## loneliness_state_pmc 0.7424762 0.1614204 4.600 4.23e-06 ***
## socintsatisfaction_state_pmc 0.7323663 0.1813149 4.039 5.36e-05 ***
## responsiveness_state_pmc 0.3647884 0.2154567 1.693 0.09044 .
## depressedmood_state -0.1479732 0.0942871 -1.569 0.11656
## loneliness_state_pmc 0.5730218 NaN NaN NaN
## socintsatisfaction_state_pmc -0.0882717 NaN NaN NaN
## responsiveness_state_pmc 0.5831397 NaN NaN NaN
## -0.0344852 NaN NaN NaN
## 0.2770934 0.3567887 0.777 0.43738
## 0.5047502 NaN NaN NaN
## 0.1077895 NaN NaN NaN
## -0.0004659 NaN NaN NaN
## -0.0205840 0.2373795 -0.087 0.93090
## -0.0940309 0.1394140 -0.674 0.50001
## 0.3799993 NaN NaN NaN
## -0.0280014 0.1559502 -0.180 0.85750
## -1.0321203 0.1884515 -5.477 4.33e-08 ***
## -0.9943817 0.2192138 -4.536 5.73e-06 ***
## -0.1402917 0.1409221 -0.996 0.31948
## -0.0812751 0.1057306 -0.769 0.44207
## -0.8040835 NaN NaN NaN
## 0.0014517 0.1222545 0.012 0.99053
## -0.3231939 NaN NaN NaN
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## ---
## Estimates in matrix form:
## Constant term:
## Estimates: 23.47129 0.4617356 5.425038 5.704096
## AR coefficient matrix
## AR( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.18593 -0.278 -0.1949 -0.467
## [2,] -0.00833 0.182 0.2738 -0.795
## [3,] -0.17999 0.742 0.7324 0.365
## [4,] -0.14797 0.573 -0.0883 0.583
## MA coefficient matrix
## MA( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.034485 -0.2771 -0.50475 -0.108
## [2,] 0.000466 0.0206 0.09403 -0.380
## [3,] 0.028001 1.0321 0.99438 0.140
## [4,] 0.081275 0.8041 -0.00145 0.323
##
## Residuals cov-matrix:
## [,1] [,2] [,3] [,4]
## [1,] 336.1885 147.1317 -134.7086 -125.1745
## [2,] 147.1317 234.6211 -135.5576 -113.9454
## [3,] -134.7086 -135.5576 300.9418 181.4561
## [4,] -125.1745 -113.9454 181.4561 223.6836
## ----
## aic= 21.99579
## bic= 23.15216
## Number of parameters: 36
## initial estimates: 12.9621 -0.6483 5.9701 9.3576 0.383 -0.1034 -0.0244 -0.1125 0.0286 0.3899 0.0551 -0.157 -0.3727 0.224 0.2436 -0.123 -0.4445 0.2781 0.058 0.3217 -0.2791 -0.0785 -0.2222 0.2861 -0.0807 -0.4933 -0.6082 0.4602 0.0155 -0.0917 0.0759 0.544 1.1786 -1.0238 -0.2297 0.4985
## Par. lower-bounds: 4.8153 -9.0925 -5.5516 0.3729 0.0236 -0.4569 -0.3078 -0.4119 -0.344 0.0235 -0.2387 -0.4673 -0.881 -0.276 -0.1572 -0.5464 -0.8409 -0.1118 -0.2546 -0.0085 -1.0551 -0.7777 -0.8517 -0.4472 -0.885 -1.218 -1.2607 -0.2999 -1.0819 -1.0806 -0.8144 -0.4931 0.3229 -1.795 -0.924 -0.3102
## Par. upper-bounds: 21.1088 7.796 17.4917 18.3422 0.7424 0.2501 0.2591 0.1869 0.4011 0.7564 0.3489 0.1533 0.1357 0.7239 0.6445 0.3004 -0.0481 0.668 0.3706 0.6518 0.4968 0.6207 0.4074 1.0194 0.7236 0.2314 0.0443 1.2203 1.1129 0.8972 0.9662 1.5811 2.0343 -0.2527 0.4645 1.3073
## Final Estimates: 13.0184 -0.7247611 5.93097 9.393478 0.391674 -0.3328799 -0.02921222 -0.3563007 0.09015663 0.6585867 0.3488199 -0.05519466 -0.3544627 0.3479997 0.3056563 -0.5212425 -0.5306183 0.5936887 -0.2374884 0.4054889 -0.01859158 0.1975513 -0.1374974 0.4756468 -0.09817038 -0.7675787 -0.6298616 -0.09541755 0.4717822 -0.3497953 -0.007669438 0.9994048 0.7881963 -0.9309685 0.4147802 0.03514498
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## depressedmood_state 13.018400 4.119980 3.160 0.001579 **
## loneliness_state_pmc -0.724761 2.854119 -0.254 0.799546
## socintsatisfaction_state_pmc 5.930970 5.128399 1.156 0.247479
## responsiveness_state_pmc 9.393478 4.419756 2.125 0.033558 *
## depressedmood_state 0.391674 0.206746 1.894 0.058163 .
## loneliness_state_pmc -0.332880 0.233932 -1.423 0.154742
## socintsatisfaction_state_pmc -0.029212 0.188247 -0.155 0.876679
## responsiveness_state_pmc -0.356301 0.117456 -3.033 0.002417 **
## depressedmood_state 0.090157 0.136342 0.661 0.508450
## loneliness_state_pmc 0.658587 0.128593 5.121 3.03e-07 ***
## socintsatisfaction_state_pmc 0.348820 0.114984 3.034 0.002416 **
## responsiveness_state_pmc -0.055195 0.102864 -0.537 0.591557
## depressedmood_state -0.354463 0.225231 -1.574 0.115540
## loneliness_state_pmc 0.348000 0.199672 1.743 0.081358 .
## socintsatisfaction_state_pmc 0.305656 0.140347 2.178 0.029416 *
## responsiveness_state_pmc -0.521242 0.123647 -4.216 2.49e-05 ***
## depressedmood_state -0.530618 0.220616 -2.405 0.016165 *
## loneliness_state_pmc 0.593689 0.144559 4.107 4.01e-05 ***
## socintsatisfaction_state_pmc -0.237488 0.105416 -2.253 0.024268 *
## responsiveness_state_pmc 0.405489 0.109534 3.702 0.000214 ***
## -0.018592 0.255952 -0.073 0.942095
## 0.197551 0.159794 1.236 0.216353
## -0.137497 0.159276 -0.863 0.387991
## 0.475647 0.171264 2.777 0.005482 **
## -0.098170 0.110743 -0.886 0.375366
## -0.767579 0.102610 -7.481 7.39e-14 ***
## -0.629862 0.093602 -6.729 1.71e-11 ***
## -0.095418 0.147308 -0.648 0.517153
## 0.471782 0.199748 2.362 0.018182 *
## -0.349795 0.161121 -2.171 0.029931 *
## -0.007669 0.088136 -0.087 0.930657
## 0.999405 0.123252 8.109 4.44e-16 ***
## 0.788196 0.139104 5.666 1.46e-08 ***
## -0.930969 0.106422 -8.748 < 2e-16 ***
## 0.414780 0.066478 6.239 4.39e-10 ***
## 0.035145 0.101244 0.347 0.728494
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## ---
## Estimates in matrix form:
## Constant term:
## Estimates: 13.0184 -0.7247611 5.93097 9.393478
## AR coefficient matrix
## AR( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.3917 -0.333 -0.0292 -0.3563
## [2,] 0.0902 0.659 0.3488 -0.0552
## [3,] -0.3545 0.348 0.3057 -0.5212
## [4,] -0.5306 0.594 -0.2375 0.4055
## MA coefficient matrix
## MA( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.0186 -0.198 0.13750 -0.4756
## [2,] 0.0982 0.768 0.62986 0.0954
## [3,] -0.4718 0.350 0.00767 -0.9994
## [4,] -0.7882 0.931 -0.41478 -0.0351
##
## Residuals cov-matrix:
## [,1] [,2] [,3] [,4]
## [1,] 127.59152 72.28125 -48.77543 -45.68038
## [2,] 72.28125 143.36900 -75.59050 -37.99892
## [3,] -48.77543 -75.59050 201.74311 102.52881
## [4,] -45.68038 -37.99892 102.52881 137.94930
## ----
## aic= 19.97919
## bic= 21.13555
## Number of parameters: 36
## initial estimates: 6.1774 -4.6321 -4.0155 -0.6962 0.3887 0.2254 -0.2069 0.1753 0.265 0.2243 0.0207 -0.2162 0.2713 -0.1849 0.4052 0.2028 -0.0064 -0.0533 0.0813 0.489 0.2819 0.0687 0.2657 0.3623 -0.2439 -0.0352 0.31 -0.0058 0.0448 -0.3797 -1.1052 1.8031 0.5562 -0.1328 -0.1124 0.1426
## Par. lower-bounds: 1.9817 -10.7785 -10.4185 -5.0595 0.1227 -0.0272 -0.4304 -0.1503 -0.1246 -0.1458 -0.3067 -0.6933 -0.1346 -0.5704 0.0642 -0.2941 -0.2829 -0.316 -0.1511 0.1503 -0.4134 -0.5018 -0.1961 -0.4458 -1.2624 -0.871 -0.3666 -1.1896 -1.0162 -1.2504 -1.8101 0.5699 -0.1668 -0.7262 -0.5927 -0.6977
## Par. upper-bounds: 10.3732 1.5142 2.3874 3.6671 0.6546 0.478 0.0165 0.501 0.6546 0.5943 0.348 0.2608 0.6771 0.2006 0.7462 0.6998 0.2702 0.2094 0.3137 0.8276 0.9772 0.6392 0.7276 1.1704 0.7746 0.8005 0.9866 1.178 1.1058 0.4909 -0.4004 3.0363 1.2793 0.4605 0.3679 0.983
## Final Estimates: 6.280125 -4.5926 -3.843179 -0.7929591 0.3469397 0.126109 0.007475874 -0.03229595 0.3619164 0.2842107 -0.07923777 0.05294937 0.3272453 0.07224821 0.6481546 -0.2894105 0.03633556 0.04482576 -0.1417862 0.5152859 0.06313667 0.08686957 -0.1264512 0.1532734 -0.4162826 0.06786629 0.1817652 -0.4488725 -0.3758188 -0.06027331 -0.6867777 1.123654 0.1270691 -0.1397119 0.3546127 0.05571714
## Warning in sqrt(diag(solve(Hessian))): NaNs produced
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## depressedmood_state 6.280125 1.833545 3.425 0.000615 ***
## loneliness_state_pmc -4.592600 NaN NaN NaN
## socintsatisfaction_state_pmc -3.843179 0.529176 -7.263 3.80e-13 ***
## responsiveness_state_pmc -0.792959 0.953127 -0.832 0.405434
## depressedmood_state 0.346940 0.135291 2.564 0.010335 *
## loneliness_state_pmc 0.126109 0.141591 0.891 0.373112
## socintsatisfaction_state_pmc 0.007476 0.155681 0.048 0.961700
## responsiveness_state_pmc -0.032296 0.267515 -0.121 0.903908
## depressedmood_state 0.361916 NaN NaN NaN
## loneliness_state_pmc 0.284211 NaN NaN NaN
## socintsatisfaction_state_pmc -0.079238 NaN NaN NaN
## responsiveness_state_pmc 0.052949 NaN NaN NaN
## depressedmood_state 0.327245 0.012112 27.019 < 2e-16 ***
## loneliness_state_pmc 0.072248 NaN NaN NaN
## socintsatisfaction_state_pmc 0.648155 0.117635 5.510 3.59e-08 ***
## responsiveness_state_pmc -0.289411 0.070972 -4.078 4.55e-05 ***
## depressedmood_state 0.036336 0.083436 0.435 0.663205
## loneliness_state_pmc 0.044826 NaN NaN NaN
## socintsatisfaction_state_pmc -0.141786 0.120799 -1.174 0.240502
## responsiveness_state_pmc 0.515286 0.116457 4.425 9.66e-06 ***
## 0.063137 0.163281 0.387 0.698997
## 0.086870 0.125381 0.693 0.488405
## -0.126451 0.175926 -0.719 0.472281
## 0.153273 0.311254 0.492 0.622409
## -0.416283 NaN NaN NaN
## 0.067866 NaN NaN NaN
## 0.181765 NaN NaN NaN
## -0.448873 NaN NaN NaN
## -0.375819 0.150227 -2.502 0.012361 *
## -0.060273 NaN NaN NaN
## -0.686778 0.131550 -5.221 1.78e-07 ***
## 1.123654 NaN NaN NaN
## 0.127069 0.124392 1.022 0.307007
## -0.139712 NaN NaN NaN
## 0.354613 0.131056 2.706 0.006814 **
## 0.055717 NaN NaN NaN
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## ---
## Estimates in matrix form:
## Constant term:
## Estimates: 6.280125 -4.5926 -3.843179 -0.7929591
## AR coefficient matrix
## AR( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] 0.3469 0.1261 0.00748 -0.0323
## [2,] 0.3619 0.2842 -0.07924 0.0529
## [3,] 0.3272 0.0722 0.64815 -0.2894
## [4,] 0.0363 0.0448 -0.14179 0.5153
## MA coefficient matrix
## MA( 1 )-matrix
## [,1] [,2] [,3] [,4]
## [1,] -0.0631 -0.0869 0.126 -0.1533
## [2,] 0.4163 -0.0679 -0.182 0.4489
## [3,] 0.3758 0.0603 0.687 -1.1237
## [4,] -0.1271 0.1397 -0.355 -0.0557
##
## Residuals cov-matrix:
## [,1] [,2] [,3] [,4]
## [1,] 141.85556 113.92993 -13.47653 -12.28112
## [2,] 113.92993 254.11587 13.47445 -16.57970
## [3,] -13.47653 13.47445 256.33408 114.41773
## [4,] -12.28112 -16.57970 114.41773 132.70107
## ----
## aic= 20.9769
## bic= 22.13326
# Extract fit results and noisy simulated series into separate lists
fit_results_list <- lapply(simulated_data_list, function(x) x$fit)
simulated_data_list5 <- lapply(simulated_data_list, function(x) x$simulated_series)
# Combine into one large data frame for further analysis
combined_simulated_data_list5 <- do.call(rbind, lapply(1:length(simulated_data_list5), function(i) {
individual_df <- as.data.frame(simulated_data_list5[[i]])
individual_df$ID <- i
individual_df$time <- 1:nrow(individual_df)
return(individual_df)
}))
Next we are going to run i-ARIMAX on both the original raw data set and the simulated data set using the idionomics package to see how they compare.
# i-ARIMAX on existing raw data set
# Create list of independent variables
IV <- c("loneliness_state_pmc","socintsatisfaction_state_pmc","responsiveness_state_pmc")
# Initialize an empty list to store the results
hoard.iarimax1 <- list()
# Loop through each independent variable (IV)
for (i in seq_along(IV)) {
# Create a unique model name for each IV
model_name <- paste0("IV_", i)
# Run the IARIMAXoid_Pro function and store the result in the list
hoard.iarimax1[[model_name]] <- IARIMAXoid_Pro(
imputed_rawdata,
x_series = IV[[i]], # Current independent variable
y_series = "depressedmood_state", # The single dependent variable
id_var = "pid",
hlm_compare = TRUE,
timevar = "pingTotal",
metaanalysis = TRUE
)
}
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
Then we are going to do the same thing and run i-ARIMAX on the simulated data
# i-ARIMAX on simulated data set
# Rename columns to same as raw data set
combined_simulated_data_list5 <- combined_simulated_data_list5 %>%
rename(
depressedmood_state = V1,
loneliness_state_pmc = V2,
socintsatisfaction_state_pmc = V3,
responsiveness_state_pmc = V4
)
# Initialize an empty list to store the results
hoard.iarimax1sim <- list()
# Loop through each independent variable (IV)
for (i in seq_along(IV)) {
# Create a unique model name for each IV
model_name <- paste0("IV_", i)
# Run the IARIMAXoid_Pro function and store the result in the list
hoard.iarimax1sim[[model_name]] <- IARIMAXoid_Pro(
combined_simulated_data_list5,
x_series = IV[[i]], # Current independent variable
y_series = "depressedmood_state", # The single dependent variable
id_var = "ID",
hlm_compare = TRUE,
timevar = "time",
metaanalysis = TRUE
)
}
Now we can compare the results between the raw data and simualted data for variable of loneliness
# Compare loneliness_state_pmc (IV1) of raw data i-ARIMAX and simulated data i-ARIMAX
# Raw data i-ARIMAX loneliness results
print(hoard.iarimax1[[1]]$results_df)
## pid nAR nI nMA intercept AR1 stderr_AR1 AR2 stderr_AR2 AR3
## 1012 1012 0 1 1 NA NA NA NA NA NA
## 1023 1023 0 0 0 17.160066 NA NA NA NA NA
## 1041 1041 0 1 1 NA NA NA NA NA NA
## 1048 1048 0 1 1 NA NA NA NA NA NA
## 1058 1058 0 0 0 6.137413 NA NA NA NA NA
## 1060 1060 1 0 0 25.779614 0.2880061 0.14121681 NA NA NA
## 1070 1070 0 0 2 38.052755 NA NA NA NA NA
## 1076 1076 1 0 1 31.144733 0.8771265 0.08700187 NA NA NA
## 1093 1093 0 0 1 21.037353 NA NA NA NA NA
## 1097 1097 1 0 0 10.568771 0.4284279 0.11847942 NA NA NA
## stderr_AR3 AR4 stderr_AR4 AR5 stderr_AR5 MA1 stderr_MA1 MA2
## 1012 NA NA NA NA NA -0.8336191 0.06137501 NA
## 1023 NA NA NA NA NA NA NA NA
## 1041 NA NA NA NA NA -0.7941422 0.08516961 NA
## 1048 NA NA NA NA NA -0.6656482 0.09593274 NA
## 1058 NA NA NA NA NA NA NA NA
## 1060 NA NA NA NA NA NA NA NA
## 1070 NA NA NA NA NA 0.3586989 0.13546284 0.2697739
## 1076 NA NA NA NA NA -0.6876706 0.12151965 NA
## 1093 NA NA NA NA NA 0.4001285 0.11024212 NA
## 1097 NA NA NA NA NA NA NA NA
## stderr_MA2 MA3 stderr_MA3 MA4 stderr_MA4 MA5 stderr_MA5 drift stderr_drift
## 1012 NA NA NA NA NA NA NA NA NA
## 1023 NA NA NA NA NA NA NA NA NA
## 1041 NA NA NA NA NA NA NA NA NA
## 1048 NA NA NA NA NA NA NA NA NA
## 1058 NA NA NA NA NA NA NA NA NA
## 1060 NA NA NA NA NA NA NA NA NA
## 1070 0.1256088 NA NA NA NA NA NA NA NA
## 1076 NA NA NA NA NA NA NA NA NA
## 1093 NA NA NA NA NA NA NA NA NA
## 1097 NA NA NA NA NA NA NA NA NA
## xreg stderr_xreg n_valid n_params raw_correlation
## 1012 0.1843948 0.13487993 70 2 0.1108527
## 1023 0.1533029 0.12198728 70 2 0.1485396
## 1041 0.5918273 0.05705052 70 2 0.7586024
## 1048 0.3264294 0.09651573 70 2 0.5225267
## 1058 0.2966953 0.05491100 70 2 0.5425106
## 1060 0.8722322 0.13543980 70 3 0.7202444
## 1070 0.5041537 0.11577913 70 4 0.5994497
## 1076 0.6281609 0.11584840 70 4 0.5449530
## 1093 0.5191113 0.08140474 70 3 0.5662955
## 1097 0.3716211 0.08453090 70 3 0.6248622
# Simulated data i-ARIMAX loneliness results
print(hoard.iarimax1sim[[1]]$results_df)
## ID nAR nI nMA intercept AR1 stderr_AR1 AR2 stderr_AR2
## 1 1 0 0 1 NA NA NA NA NA
## 2 2 2 0 0 NA 0.1277027 0.08172077 -0.1560868 0.08166360
## 3 3 0 1 1 NA NA NA NA NA
## 4 4 1 1 1 NA 0.2826311 0.08437276 NA NA
## 5 5 0 0 0 NA NA NA NA NA
## 6 6 1 0 0 NA 0.1924682 0.08667701 NA NA
## 7 7 3 0 0 NA 0.2081179 0.08162333 -0.1572192 0.08122486
## 8 8 0 1 1 NA NA NA NA NA
## 9 9 0 0 1 NA NA NA NA NA
## 10 10 1 0 2 NA 0.8394546 0.07764994 NA NA
## AR3 stderr_AR3 AR4 stderr_AR4 AR5 stderr_AR5 MA1 stderr_MA1
## 1 NA NA NA NA NA NA 0.2016424 0.09703402
## 2 NA NA NA NA NA NA NA NA
## 3 NA NA NA NA NA NA -0.9266001 0.03571928
## 4 NA NA NA NA NA NA -0.9687995 0.02159676
## 5 NA NA NA NA NA NA NA NA
## 6 NA NA NA NA NA NA NA NA
## 7 -0.1700205 0.08014395 NA NA NA NA NA NA
## 8 NA NA NA NA NA NA -0.9383770 0.02628301
## 9 NA NA NA NA NA NA 0.4200544 0.08334024
## 10 NA NA NA NA NA NA -0.4225577 0.09067395
## MA2 stderr_MA2 MA3 stderr_MA3 MA4 stderr_MA4 MA5 stderr_MA5 drift
## 1 NA NA NA NA NA NA NA NA NA
## 2 NA NA NA NA NA NA NA NA NA
## 3 NA NA NA NA NA NA NA NA NA
## 4 NA NA NA NA NA NA NA NA NA
## 5 NA NA NA NA NA NA NA NA NA
## 6 NA NA NA NA NA NA NA NA NA
## 7 NA NA NA NA NA NA NA NA NA
## 8 NA NA NA NA NA NA NA NA NA
## 9 NA NA NA NA NA NA NA NA NA
## 10 -0.4866193 0.0699588 NA NA NA NA NA NA NA
## stderr_drift xreg stderr_xreg n_valid n_params raw_correlation
## 1 NA 0.2184942 0.12622981 150 2 0.05652008
## 2 NA 0.2513318 0.10283622 150 3 0.15534117
## 3 NA 0.6630795 0.04490643 150 2 0.76424538
## 4 NA 0.4063217 0.08299780 150 3 0.45361753
## 5 NA 0.3791468 0.04459513 150 1 0.56350922
## 6 NA 0.8702662 0.10259265 150 2 0.61987843
## 7 NA 0.6811561 0.09692781 150 4 0.48267672
## 8 NA 0.6713186 0.09238796 150 2 0.48328372
## 9 NA 0.5391537 0.07305204 150 2 0.46348199
## 10 NA 0.4807411 0.05572113 150 4 0.55785967
# Compare meta-analysis results (loneliness)
# Raw data
print(hoard.iarimax1[[1]]$meta_analysis)
##
## Random-Effects Model (k = 10; tau^2 estimator: REML)
##
## tau^2 (estimated amount of total heterogeneity): 0.0303 (SE = 0.0189)
## tau (square root of estimated tau^2 value): 0.1742
## I^2 (total heterogeneity / total variability): 79.59%
## H^2 (total variability / sampling variability): 4.90
##
## Test for Heterogeneity:
## Q(df = 9) = 39.1191, p-val < .0001
##
## Model Results:
##
## estimate se zval pval ci.lb ci.ub
## 0.4429 0.0635 6.9707 <.0001 0.3184 0.5674 ***
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Simulated data
print(hoard.iarimax1sim[[1]]$meta_analysis)
##
## Random-Effects Model (k = 10; tau^2 estimator: REML)
##
## tau^2 (estimated amount of total heterogeneity): 0.0302 (SE = 0.0175)
## tau (square root of estimated tau^2 value): 0.1738
## I^2 (total heterogeneity / total variability): 85.79%
## H^2 (total variability / sampling variability): 7.04
##
## Test for Heterogeneity:
## Q(df = 9) = 52.2017, p-val < .0001
##
## Model Results:
##
## estimate se zval pval ci.lb ci.ub
## 0.5193 0.0610 8.5169 <.0001 0.3998 0.6388 ***
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Next, compare results for variable 2 - social interaction satisfaction
# Compare socintsatisfaction_state_pmc (IV2) of raw data i-ARIMAX and simulated data i-ARIMAX
# Raw data i-ARIMAX social interaction satisfaction results
print(hoard.iarimax1[[2]]$results_df)
## pid nAR nI nMA intercept AR1 stderr_AR1 AR2 stderr_AR2 AR3
## 1012 1012 0 1 2 NA NA NA NA NA NA
## 1023 1023 0 0 0 17.165273 NA NA NA NA NA
## 1041 1041 0 0 0 18.331301 NA NA NA NA NA
## 1048 1048 0 1 1 NA NA NA NA NA NA
## 1058 1058 0 0 0 6.128974 NA NA NA NA NA
## 1060 1060 1 0 0 26.241405 0.4500693 0.1142518 NA NA NA
## 1070 1070 0 1 4 NA NA NA NA NA NA
## 1076 1076 1 0 0 29.803251 0.2083407 0.1233264 NA NA NA
## 1093 1093 1 0 0 21.007332 0.2898558 0.1172817 NA NA NA
## 1097 1097 1 1 1 NA 0.5697388 0.1137639 NA NA NA
## stderr_AR3 AR4 stderr_AR4 AR5 stderr_AR5 MA1 stderr_MA1 MA2
## 1012 NA NA NA NA NA -1.0278012 0.12238830 0.26269534
## 1023 NA NA NA NA NA NA NA NA
## 1041 NA NA NA NA NA NA NA NA
## 1048 NA NA NA NA NA -0.6536890 0.08721836 NA
## 1058 NA NA NA NA NA NA NA NA
## 1060 NA NA NA NA NA NA NA NA
## 1070 NA NA NA NA NA -0.6302328 0.11436411 -0.05377235
## 1076 NA NA NA NA NA NA NA NA
## 1093 NA NA NA NA NA NA NA NA
## 1097 NA NA NA NA NA -0.9707820 0.05606114 NA
## stderr_MA2 MA3 stderr_MA3 MA4 stderr_MA4 MA5 stderr_MA5 drift
## 1012 0.1481011 NA NA NA NA NA NA NA
## 1023 NA NA NA NA NA NA NA NA
## 1041 NA NA NA NA NA NA NA NA
## 1048 NA NA NA NA NA NA NA NA
## 1058 NA NA NA NA NA NA NA NA
## 1060 NA NA NA NA NA NA NA NA
## 1070 0.1297701 -0.3809498 0.2020064 0.2822914 0.1572439 NA NA NA
## 1076 NA NA NA NA NA NA NA NA
## 1093 NA NA NA NA NA NA NA NA
## 1097 NA NA NA NA NA NA NA NA
## stderr_drift xreg stderr_xreg n_valid n_params raw_correlation
## 1012 NA 0.05894468 0.04973171 70 3 0.21187002
## 1023 NA 0.13187203 0.08259387 70 2 0.18745163
## 1041 NA -0.60925428 0.09027732 70 2 -0.62783418
## 1048 NA -0.13757289 0.05433243 70 2 -0.27199439
## 1058 NA -0.16170736 0.06649622 70 2 -0.27910875
## 1060 NA -0.44480388 0.09600838 70 3 -0.51307492
## 1070 NA -0.14518134 0.06752348 70 5 -0.35234403
## 1076 NA -0.38341317 0.09927548 70 3 -0.47329802
## 1093 NA -0.20592604 0.08158762 70 3 -0.32940401
## 1097 NA -0.02650023 0.08015096 70 3 -0.03138651
# Simulated data i-ARIMAX social interaction satisfaction results
print(hoard.iarimax1sim[[2]]$results_df)
## ID nAR nI nMA intercept AR1 stderr_AR1 AR2 stderr_AR2 AR3
## 1 1 2 0 2 NA -0.3088206 0.13939484 -0.8002944 0.07092024 NA
## 2 2 2 0 1 NA 0.9922580 0.09668066 -0.1676611 0.08253587 NA
## 3 3 1 0 1 NA 0.7577864 0.08297926 NA NA NA
## 4 4 1 1 1 NA 0.3255965 0.08235976 NA NA NA
## 5 5 0 1 2 NA NA NA NA NA NA
## 6 6 1 0 0 NA 0.2895447 0.07830511 NA NA NA
## 7 7 0 0 1 NA NA NA NA NA NA
## 8 8 0 0 0 NA NA NA NA NA NA
## 9 9 2 0 3 NA 1.8655274 0.05778961 -0.9194098 0.05122990 NA
## 10 10 1 0 0 NA 0.4631270 0.07262189 NA NA NA
## stderr_AR3 AR4 stderr_AR4 AR5 stderr_AR5 MA1 stderr_MA1 MA2
## 1 NA NA NA NA NA 0.3928743 0.09561500 0.9698380
## 2 NA NA NA NA NA -0.9278255 0.06603365 NA
## 3 NA NA NA NA NA -0.9415509 0.04764788 NA
## 4 NA NA NA NA NA -0.9633702 0.02418054 NA
## 5 NA NA NA NA NA -1.2064903 0.09960127 0.2277685
## 6 NA NA NA NA NA NA NA NA
## 7 NA NA NA NA NA 0.3173546 0.07529490 NA
## 8 NA NA NA NA NA NA NA NA
## 9 NA NA NA NA NA -1.6411199 0.10112167 0.4758058
## 10 NA NA NA NA NA NA NA NA
## stderr_MA2 MA3 stderr_MA3 MA4 stderr_MA4 MA5 stderr_MA5 drift
## 1 0.07538947 NA NA NA NA NA NA NA
## 2 NA NA NA NA NA NA NA NA
## 3 NA NA NA NA NA NA NA NA
## 4 NA NA NA NA NA NA NA NA
## 5 0.09709366 NA NA NA NA NA NA NA
## 6 NA NA NA NA NA NA NA NA
## 7 NA NA NA NA NA NA NA NA
## 8 NA NA NA NA NA NA NA NA
## 9 0.16313274 0.2008249 0.09233108 NA NA NA NA NA
## 10 NA NA NA NA NA NA NA NA
## stderr_drift xreg stderr_xreg n_valid n_params raw_correlation
## 1 NA 0.09075473 0.04393552 150 5 0.1667643496
## 2 NA 0.12534486 0.07435696 150 4 0.2172082999
## 3 NA -0.72076435 0.03486830 150 3 -0.6485506678
## 4 NA -0.17527510 0.05005882 150 3 -0.2993871733
## 5 NA -0.21665018 0.06399133 150 3 -0.2129631956
## 6 NA -0.39762614 0.07961836 150 2 -0.3655055854
## 7 NA -0.03662189 0.07218586 150 2 -0.1108398172
## 8 NA -0.42783646 0.04870286 150 1 -0.4714058980
## 9 NA -0.11091313 0.06764693 150 6 -0.2000601155
## 10 NA 0.04803466 0.06735318 150 2 0.0003699997
# Compare meta-analysis results (social interaction satisfaction)
# Raw data
print(hoard.iarimax1[[2]]$meta_analysis)
##
## Random-Effects Model (k = 10; tau^2 estimator: REML)
##
## tau^2 (estimated amount of total heterogeneity): 0.0446 (SE = 0.0239)
## tau (square root of estimated tau^2 value): 0.2113
## I^2 (total heterogeneity / total variability): 89.56%
## H^2 (total variability / sampling variability): 9.58
##
## Test for Heterogeneity:
## Q(df = 9) = 72.6915, p-val < .0001
##
## Model Results:
##
## estimate se zval pval ci.lb ci.ub
## -0.1860 0.0712 -2.6121 0.0090 -0.3255 -0.0464 **
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Simulated data
print(hoard.iarimax1sim[[2]]$meta_analysis)
##
## Random-Effects Model (k = 10; tau^2 estimator: REML)
##
## tau^2 (estimated amount of total heterogeneity): 0.0701 (SE = 0.0348)
## tau (square root of estimated tau^2 value): 0.2647
## I^2 (total heterogeneity / total variability): 95.79%
## H^2 (total variability / sampling variability): 23.74
##
## Test for Heterogeneity:
## Q(df = 9) = 318.4398, p-val < .0001
##
## Model Results:
##
## estimate se zval pval ci.lb ci.ub
## -0.1844 0.0859 -2.1460 0.0319 -0.3529 -0.0160 *
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Last, compare results for responsiveness
# Compare responsiveness_state_pmc (IV2) of raw data i-ARIMAX and simulated data i-ARIMAX
# Raw data i-ARIMAX responsiveness results
print(hoard.iarimax1[[3]]$results_df)
## pid nAR nI nMA intercept AR1 stderr_AR1 AR2 stderr_AR2 AR3
## 1012 1012 0 1 2 NA NA NA NA NA NA
## 1023 1023 0 0 0 17.254333 NA NA NA NA NA
## 1041 1041 2 0 0 18.791328 0.2694910 0.12495211 0.1949281 0.1233648 NA
## 1048 1048 0 1 1 NA NA NA NA NA NA
## 1058 1058 0 0 0 6.122635 NA NA NA NA NA
## 1060 1060 1 0 0 26.622604 0.4206131 0.12281064 NA NA NA
## 1070 1070 1 1 1 NA 0.2357464 0.14217201 NA NA NA
## 1076 1076 1 0 4 30.737502 0.7905816 0.09467278 NA NA NA
## 1093 1093 0 0 4 21.132680 NA NA NA NA NA
## 1097 1097 1 1 1 NA 0.5800271 0.11335164 NA NA NA
## stderr_AR3 AR4 stderr_AR4 AR5 stderr_AR5 MA1 stderr_MA1 MA2
## 1012 NA NA NA NA NA -1.0468059 0.12042046 0.2635505
## 1023 NA NA NA NA NA NA NA NA
## 1041 NA NA NA NA NA NA NA NA
## 1048 NA NA NA NA NA -0.6262371 0.09846216 NA
## 1058 NA NA NA NA NA NA NA NA
## 1060 NA NA NA NA NA NA NA NA
## 1070 NA NA NA NA NA -0.8559760 0.06944188 NA
## 1076 NA NA NA NA NA -0.7628503 0.13326724 -0.0957419
## 1093 NA NA NA NA NA 0.2281863 0.11520453 0.1623510
## 1097 NA NA NA NA NA -0.9734330 0.05945987 NA
## stderr_MA2 MA3 stderr_MA3 MA4 stderr_MA4 MA5 stderr_MA5
## 1012 0.1348974 NA NA NA NA NA NA
## 1023 NA NA NA NA NA NA NA
## 1041 NA NA NA NA NA NA NA
## 1048 NA NA NA NA NA NA NA
## 1058 NA NA NA NA NA NA NA
## 1060 NA NA NA NA NA NA NA
## 1070 NA NA NA NA NA NA NA
## 1076 0.1409719 -0.09517184 0.1561063 0.5565507 0.1878615 NA NA
## 1093 0.1523849 -0.11836350 0.2074843 0.4224770 0.1871531 NA NA
## 1097 NA NA NA NA NA NA NA
## drift stderr_drift xreg stderr_xreg n_valid n_params
## 1012 NA NA 0.12065437 0.09956313 70 3
## 1023 NA NA -0.07586349 0.06909986 70 2
## 1041 NA NA -0.38913527 0.25994727 70 4
## 1048 NA NA -0.04450127 0.09638572 70 2
## 1058 NA NA -0.21370442 0.08344608 70 2
## 1060 NA NA -0.60718198 0.12511763 70 3
## 1070 NA NA -0.11478323 0.07394199 70 3
## 1076 NA NA -0.31296938 0.13968190 70 7
## 1093 NA NA -0.32692416 0.07358591 70 6
## 1097 NA NA -0.14676851 0.12551572 70 3
## raw_correlation
## 1012 0.14757968
## 1023 -0.13010690
## 1041 -0.25153892
## 1048 -0.32394239
## 1058 -0.29269216
## 1060 -0.56392109
## 1070 -0.30429110
## 1076 -0.50149472
## 1093 -0.45324015
## 1097 -0.09043521
# Simulated data i-ARIMAX responsiveness results results
print(hoard.iarimax1sim[[3]]$results_df)
## ID nAR nI nMA intercept AR1 stderr_AR1 AR2 stderr_AR2
## 1 1 0 0 0 NA NA NA NA NA
## 2 2 0 0 0 NA NA NA NA NA
## 3 3 2 0 0 NA 0.2370843 0.08258643 0.212002168 0.08026632
## 4 4 1 1 1 NA 0.3514425 0.08506797 NA NA
## 5 5 0 0 0 NA NA NA NA NA
## 6 6 3 0 1 NA 1.0759260 0.08736158 -0.007943248 0.12194141
## 7 7 0 0 1 NA NA NA NA NA
## 8 8 1 1 1 NA -0.1436153 0.08646250 NA NA
## 9 9 2 0 1 NA 1.2026635 0.07809906 -0.343084083 0.07716419
## 10 10 1 0 0 NA 0.4609646 0.07260343 NA NA
## AR3 stderr_AR3 AR4 stderr_AR4 AR5 stderr_AR5 MA1 stderr_MA1
## 1 NA NA NA NA NA NA NA NA
## 2 NA NA NA NA NA NA NA NA
## 3 NA NA NA NA NA NA NA NA
## 4 NA NA NA NA NA NA -0.9657084 0.02354659
## 5 NA NA NA NA NA NA NA NA
## 6 -0.2280746 0.0818029 NA NA NA NA -0.9191988 0.03991853
## 7 NA NA NA NA NA NA 0.3189976 0.07433243
## 8 NA NA NA NA NA NA -0.9559014 0.02219455
## 9 NA NA NA NA NA NA -0.9893986 0.04555955
## 10 NA NA NA NA NA NA NA NA
## MA2 stderr_MA2 MA3 stderr_MA3 MA4 stderr_MA4 MA5 stderr_MA5 drift
## 1 NA NA NA NA NA NA NA NA NA
## 2 NA NA NA NA NA NA NA NA NA
## 3 NA NA NA NA NA NA NA NA NA
## 4 NA NA NA NA NA NA NA NA NA
## 5 NA NA NA NA NA NA NA NA NA
## 6 NA NA NA NA NA NA NA NA NA
## 7 NA NA NA NA NA NA NA NA NA
## 8 NA NA NA NA NA NA NA NA NA
## 9 NA NA NA NA NA NA NA NA NA
## 10 NA NA NA NA NA NA NA NA NA
## stderr_drift xreg stderr_xreg n_valid n_params raw_correlation
## 1 NA 0.246343193 0.11122892 150 1 0.172857652
## 2 NA -0.010243512 0.06814560 150 1 -0.011575102
## 3 NA -0.026117192 0.24087186 150 3 -0.086973965
## 4 NA 0.003517583 0.09732864 150 3 -0.164078894
## 5 NA -0.269805905 0.08094288 150 1 -0.251369658
## 6 NA -0.676458516 0.10679631 150 5 -0.430189133
## 7 NA -0.037385563 0.07258341 150 2 -0.082986609
## 8 NA -0.633124429 0.10171299 150 3 -0.436867133
## 9 NA -0.377710848 0.11374486 150 4 -0.278187222
## 10 NA -0.066911597 0.10701488 150 2 0.006911397
# Compare meta-analysis results (responsiveness results)
# Raw data
print(hoard.iarimax1[[3]]$meta_analysis)
##
## Random-Effects Model (k = 10; tau^2 estimator: REML)
##
## tau^2 (estimated amount of total heterogeneity): 0.0275 (SE = 0.0183)
## tau (square root of estimated tau^2 value): 0.1657
## I^2 (total heterogeneity / total variability): 74.86%
## H^2 (total variability / sampling variability): 3.98
##
## Test for Heterogeneity:
## Q(df = 9) = 31.4548, p-val = 0.0002
##
## Model Results:
##
## estimate se zval pval ci.lb ci.ub
## -0.1906 0.0629 -3.0311 0.0024 -0.3138 -0.0673 **
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Simulated data
print(hoard.iarimax1sim[[3]]$meta_analysis)
##
## Random-Effects Model (k = 10; tau^2 estimator: REML)
##
## tau^2 (estimated amount of total heterogeneity): 0.0783 (SE = 0.0426)
## tau (square root of estimated tau^2 value): 0.2798
## I^2 (total heterogeneity / total variability): 89.41%
## H^2 (total variability / sampling variability): 9.45
##
## Test for Heterogeneity:
## Q(df = 9) = 75.3787, p-val < .0001
##
## Model Results:
##
## estimate se zval pval ci.lb ci.ub
## -0.1885 0.0953 -1.9784 0.0479 -0.3753 -0.0018 *
##
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Seems like for the results, AR and MA coefficients are quite difference between raw and simulated data. xreg coefficients and correlations are similar but still can be quite a difference at times.
Meta-analysis results are somewhat similar.
First we run BORUTA on the raw data looping it for each individual. Results are stored in a dataframe (confirmed_results) with 1 representing it is confirmed as an important variable and 0 as unimportant or tentative.
#Running BORUTA on raw data first
library(Boruta)
## Warning: package 'Boruta' was built under R version 4.3.3
# Initialize a list to store the Boruta results for each individual
BORUTAraw <- vector("list", 10)
# Loop through each individual and apply the Boruta feature selection
for(i in 1:10) {
BORUTAraw[[i]] <- Boruta(depressedmood_state ~ loneliness_state_pmc +
socintsatisfaction_state_pmc + responsiveness_state_pmc,
data = rawdata_list[[i]])
}
# Print which features are important for each individual
print(BORUTAraw)
## [[1]]
## Boruta performed 58 iterations in 0.7024071 secs.
## 1 attributes confirmed important: socintsatisfaction_state_pmc;
## 2 attributes confirmed unimportant: loneliness_state_pmc,
## responsiveness_state_pmc;
##
## [[2]]
## Boruta performed 19 iterations in 0.2374229 secs.
## No attributes deemed important.
## 3 attributes confirmed unimportant: loneliness_state_pmc,
## responsiveness_state_pmc, socintsatisfaction_state_pmc;
##
## [[3]]
## Boruta performed 9 iterations in 0.108454 secs.
## 2 attributes confirmed important: loneliness_state_pmc,
## socintsatisfaction_state_pmc;
## 1 attributes confirmed unimportant: responsiveness_state_pmc;
##
## [[4]]
## Boruta performed 99 iterations in 1.156376 secs.
## 2 attributes confirmed important: loneliness_state_pmc,
## socintsatisfaction_state_pmc;
## No attributes deemed unimportant.
## 1 tentative attributes left: responsiveness_state_pmc;
##
## [[5]]
## Boruta performed 99 iterations in 1.168491 secs.
## 2 attributes confirmed important: loneliness_state_pmc,
## socintsatisfaction_state_pmc;
## No attributes deemed unimportant.
## 1 tentative attributes left: responsiveness_state_pmc;
##
## [[6]]
## Boruta performed 9 iterations in 0.103497 secs.
## 3 attributes confirmed important: loneliness_state_pmc,
## responsiveness_state_pmc, socintsatisfaction_state_pmc;
## No attributes deemed unimportant.
##
## [[7]]
## Boruta performed 99 iterations in 1.164967 secs.
## 2 attributes confirmed important: loneliness_state_pmc,
## socintsatisfaction_state_pmc;
## No attributes deemed unimportant.
## 1 tentative attributes left: responsiveness_state_pmc;
##
## [[8]]
## Boruta performed 12 iterations in 0.1410499 secs.
## 3 attributes confirmed important: loneliness_state_pmc,
## responsiveness_state_pmc, socintsatisfaction_state_pmc;
## No attributes deemed unimportant.
##
## [[9]]
## Boruta performed 99 iterations in 1.203344 secs.
## 2 attributes confirmed important: loneliness_state_pmc,
## responsiveness_state_pmc;
## No attributes deemed unimportant.
## 1 tentative attributes left: socintsatisfaction_state_pmc;
##
## [[10]]
## Boruta performed 12 iterations in 0.144587 secs.
## 1 attributes confirmed important: loneliness_state_pmc;
## 2 attributes confirmed unimportant: responsiveness_state_pmc,
## socintsatisfaction_state_pmc;
# Initialize a data frame to store the results
Confirmed_results_raw <- data.frame(
loneliness_state_pmc = numeric(10),
socintsatisfaction_state_pmc = numeric(10),
responsiveness_state_pmc = numeric(10)
)
# Loop through each individual's results and fill the data frame
for(i in 1:10) {
# Access final decision for each predictor and check if it's confirmed
Confirmed_results_raw$loneliness_state_pmc[i] <- ifelse(BORUTAraw[[i]]$finalDecision["loneliness_state_pmc"] == "Confirmed", 1, 0)
Confirmed_results_raw$socintsatisfaction_state_pmc[i] <- ifelse(BORUTAraw[[i]]$finalDecision["socintsatisfaction_state_pmc"] == "Confirmed", 1, 0)
Confirmed_results_raw$responsiveness_state_pmc[i] <- ifelse(BORUTAraw[[i]]$finalDecision["responsiveness_state_pmc"] == "Confirmed", 1, 0)
}
# Print the resulting data frame
print(Confirmed_results_raw)
## loneliness_state_pmc socintsatisfaction_state_pmc responsiveness_state_pmc
## 1 0 1 0
## 2 0 0 0
## 3 1 1 0
## 4 1 1 0
## 5 1 1 0
## 6 1 1 1
## 7 1 1 0
## 8 1 1 1
## 9 1 0 1
## 10 1 0 0
Can also check for sensitivity and specificity. With higher numbers indicating better sensitivity and specificty.
# Calculate specificity and sensitivity
specificity_raw <- 1 - sum(Confirmed_results_raw == 0) / (10 * 3)
sensitivity_raw <- sum(Confirmed_results_raw == 1) / (10 * 3)
# Print specificity and sensitivity
print(specificity_raw) # False positives make this lower
## [1] 0.6
print(sensitivity_raw) # False negatives make this lower
## [1] 0.6
Next we do the same thing for the simulated data.
# Running BORUTA for simulated data
# Initialize a list to store the Boruta results for each individual
BORUTAsim <- vector("list", 10)
# Turning simulated data frame into a data_list that can be used with BORUTA
simulated_data_list5 <- split(combined_simulated_data_list5, combined_simulated_data_list5$ID)
# Loop through each individual and apply the Boruta feature selection
for(i in 1:10) {
BORUTAsim[[i]] <- Boruta(depressedmood_state ~ loneliness_state_pmc +
socintsatisfaction_state_pmc + responsiveness_state_pmc,
data = simulated_data_list5[[i]])
}
# Print which features are important for each individual
print(BORUTAsim)
## [[1]]
## Boruta performed 45 iterations in 0.7248728 secs.
## 1 attributes confirmed important: socintsatisfaction_state_pmc;
## 2 attributes confirmed unimportant: loneliness_state_pmc,
## responsiveness_state_pmc;
##
## [[2]]
## Boruta performed 99 iterations in 1.604369 secs.
## No attributes deemed important.
## 2 attributes confirmed unimportant: responsiveness_state_pmc,
## socintsatisfaction_state_pmc;
## 1 tentative attributes left: loneliness_state_pmc;
##
## [[3]]
## Boruta performed 16 iterations in 0.242008 secs.
## 3 attributes confirmed important: loneliness_state_pmc,
## responsiveness_state_pmc, socintsatisfaction_state_pmc;
## No attributes deemed unimportant.
##
## [[4]]
## Boruta performed 70 iterations in 1.135025 secs.
## 2 attributes confirmed important: loneliness_state_pmc,
## socintsatisfaction_state_pmc;
## 1 attributes confirmed unimportant: responsiveness_state_pmc;
##
## [[5]]
## Boruta performed 12 iterations in 0.2146649 secs.
## 2 attributes confirmed important: loneliness_state_pmc,
## responsiveness_state_pmc;
## 1 attributes confirmed unimportant: socintsatisfaction_state_pmc;
##
## [[6]]
## Boruta performed 96 iterations in 1.70665 secs.
## 3 attributes confirmed important: loneliness_state_pmc,
## responsiveness_state_pmc, socintsatisfaction_state_pmc;
## No attributes deemed unimportant.
##
## [[7]]
## Boruta performed 27 iterations in 0.4260869 secs.
## 1 attributes confirmed important: loneliness_state_pmc;
## 2 attributes confirmed unimportant: responsiveness_state_pmc,
## socintsatisfaction_state_pmc;
##
## [[8]]
## Boruta performed 9 iterations in 0.145591 secs.
## 3 attributes confirmed important: loneliness_state_pmc,
## responsiveness_state_pmc, socintsatisfaction_state_pmc;
## No attributes deemed unimportant.
##
## [[9]]
## Boruta performed 79 iterations in 1.263106 secs.
## 3 attributes confirmed important: loneliness_state_pmc,
## responsiveness_state_pmc, socintsatisfaction_state_pmc;
## No attributes deemed unimportant.
##
## [[10]]
## Boruta performed 33 iterations in 0.5287709 secs.
## 1 attributes confirmed important: loneliness_state_pmc;
## 2 attributes confirmed unimportant: responsiveness_state_pmc,
## socintsatisfaction_state_pmc;
# Initialize a data frame to store the results
Confirmed_results_sim <- data.frame(
loneliness_state_pmc = numeric(10),
socintsatisfaction_state_pmc = numeric(10),
responsiveness_state_pmc = numeric(10)
)
# Loop through each individual's results and fill the data frame
for(i in 1:10) {
# Access final decision for each predictor and check if it's confirmed
Confirmed_results_sim$loneliness_state_pmc[i] <- ifelse(BORUTAsim[[i]]$finalDecision["loneliness_state_pmc"] == "Confirmed", 1, 0)
Confirmed_results_sim$socintsatisfaction_state_pmc[i] <- ifelse(BORUTAsim[[i]]$finalDecision["socintsatisfaction_state_pmc"] == "Confirmed", 1, 0)
Confirmed_results_sim$responsiveness_state_pmc[i] <- ifelse(BORUTAsim[[i]]$finalDecision["responsiveness_state_pmc"] == "Confirmed", 1, 0)
}
# Print the resulting data frame
print(Confirmed_results_sim)
## loneliness_state_pmc socintsatisfaction_state_pmc responsiveness_state_pmc
## 1 0 1 0
## 2 0 0 0
## 3 1 1 1
## 4 1 1 0
## 5 1 0 1
## 6 1 1 1
## 7 1 0 0
## 8 1 1 1
## 9 1 1 1
## 10 1 0 0
# Calculate specificity and sensitivity
specificity_sim <- 1 - sum(Confirmed_results_sim == 0) / (10 * 3)
sensitivity_sim <- sum(Confirmed_results_sim == 1) / (10 * 3)
# Print specificity and sensitivity
print(specificity_sim) # False positives make this lower
## [1] 0.6333333
print(sensitivity_sim) # False negatives make this lower
## [1] 0.6333333
Finally we can then combined the confirmed_results of the raw and simulated data into one data frame for easier comparison.
# Combine the confirmed results from raw and simulated data side by side
combined_results_BORUTA <- data.frame(loneliness_state_pmc_raw = Confirmed_results_raw$loneliness_state_pmc,
socintsatisfaction_state_pmc_raw = Confirmed_results_raw$socintsatisfaction_state_pmc,
responsiveness_state_pmc_raw = Confirmed_results_raw$responsiveness_state_pmc,
loneliness_state_pmc_sim = Confirmed_results_sim$loneliness_state_pmc,
socintsatisfaction_state_pmc_sim = Confirmed_results_sim$socintsatisfaction_state_pmc,
responsiveness_state_pmc_sim = Confirmed_results_sim$responsiveness_state_pmc
)
# Print the combined results
print(combined_results_BORUTA)
## loneliness_state_pmc_raw socintsatisfaction_state_pmc_raw
## 1 0 1
## 2 0 0
## 3 1 1
## 4 1 1
## 5 1 1
## 6 1 1
## 7 1 1
## 8 1 1
## 9 1 0
## 10 1 0
## responsiveness_state_pmc_raw loneliness_state_pmc_sim
## 1 0 0
## 2 0 0
## 3 0 1
## 4 0 1
## 5 0 1
## 6 1 1
## 7 0 1
## 8 1 1
## 9 1 1
## 10 0 1
## socintsatisfaction_state_pmc_sim responsiveness_state_pmc_sim
## 1 1 0
## 2 0 0
## 3 1 1
## 4 1 0
## 5 0 1
## 6 1 1
## 7 0 0
## 8 1 1
## 9 1 1
## 10 0 0