`generate_networks.Rd`

This function uses repeated calls to `var_main`

to find a fitting model for the data provided and then calls `convert_to_graph`

to return a JSON representation of best valid model found.

generate_networks(data, timestamp, always_include = NULL, pairs = NULL, positive_variables = NULL, negative_variables = NULL, pick_best_of = NULL, incident_to_best_of = NULL, labels = list(), measurements_per_day = 3, max_network_size = 6, include_model = FALSE, second_significances = c(0.05, 0.01, 0.005))

data | a data frame. Each row is a measurement. Each column is an endogenous variable. |
---|---|

timestamp | the date of the first measurement in the format |

always_include | a vector of variable names that should always be included in the network if possible. Can also be |

pairs | a vector of variable names in the form |

positive_variables | a vector of names of variables that measure a positive affect (e.g., happiness). Variable names not occurring in the |

negative_variables | a vector of names of variables that measure a negative affect (e.g., sadness). Variable names not occurring in the |

pick_best_of | a vector of variable names of which one should always be included in the network. Can also be |

incident_to_best_of | if |

labels | a list where keys are variable names and values are labels. |

measurements_per_day | an integer in [1,16] denoting the number of measurements per day. Defaults to 3. |

max_network_size | an integer in [2,6] denoting the number of nodes to include in the networks initially. Defaults to 6. |

include_model | determines whether the imputed data set and coefficients of the best model should be returned in the network JSON. Defaults to |

second_significances | is the vector of significance levels to be used after the first attempt. |

This function returns a string representing a json array of two networks and an array of the top links.

# NOT RUN { GN_COLUMNS <- c('ontspanning', 'opgewektheid', 'hier_en_nu', 'concentratie', 'beweging', 'iets_betekenen', 'humor', 'buiten_zijn', 'eigenwaarde', 'levenslust', 'onrust', 'somberheid', 'lichamelijk_ongemak', 'tekortschieten', 'piekeren', 'eenzaamheid', 'uw_eigen_factor') d<-load_file("../data/input/DataDndN_nonimputed_voorAndo.sav",log_level=3) d<-d$raw_data[,GN_COLUMNS] timestamp <- '2014-03-01' cat(generate_networks(data = d, timestamp = timestamp, always_include = 'uw_eigen_factor', pairs = c('opgewektheid','onrust', 'somberheid','ontspanning', 'somberheid','onrust'), positive_variables = c('opgewektheid','ontspanning','hier_en_nu', 'concentratie', 'beweging','iets_betekenen', 'humor', 'buiten_zijn','eigenwaarde', 'levenslust'), negative_variables = c('onrust','somberheid','lichamelijk_ongemak', 'tekortschieten','piekeren','eenzaamheid'), labels = list(ontspanning = "Ontspanning", opgewektheid = "Opgewektheid", hier_en_nu = "In het hier en nu leven", concentratie = "Concentratie", beweging = "Beweging", iets_betekenen = "Iets betekenen", humor = "Humor", buiten_zijn = "Buiten zijn", eigenwaarde = "Eigenwaarde", levenslust = "Levenslust", onrust = "Onrust", somberheid = "Somberheid", lichamelijk_ongemak = "Lichamelijk ongemak", tekortschieten = "Tekortschieten", piekeren = "Piekeren", eenzaamheid = "Eenzaamheid", uw_eigen_factor = "Mijn eigen factor"), measurements_per_day = 3, max_network_size = 6)) # }