fit_to_constraints {autohrf} | R Documentation |

A helper function for fitting a model to constraints.

```
fit_to_constraints(
model_id,
d,
model_constraints,
tr,
roi_weights,
allow_overlap,
population,
iter,
mutation_rate,
mutation_factor,
elitism,
hrf,
t,
p_boynton,
p_spm,
f,
autohrf = NULL,
verbose = TRUE
)
```

`model_id` |
ID of the model. |

`d` |
A dataframe with the signal data: roi, t and y. ROI is the name of the region, t is the timestamp and y the value of the signal. |

`model_constraints` |
A list of model specifications to use for fitting. Each specification is represented as a data frame containing information about it (event, start_time, end_time, min_duration and max_duration). |

`tr` |
MRI's repetition time. |

`roi_weights` |
A data frame with ROI weights: roi, weight. ROI is the name of the region, weight a number that defines the importance of that roi, the default weight for a ROI is 1. If set to 2 for a particular ROI that ROI will be twice as important. |

`allow_overlap` |
Whether to allow overlap between events. |

`population` |
The size of the population in the genetic algorithm. |

`iter` |
Number of iterations in the genetic algorithm. |

`mutation_rate` |
The mutation rate in the genetic algorithm. |

`mutation_factor` |
The mutation factor in the genetic algorithm. |

`elitism` |
The degree of elitism (promote a percentage of the best solutions) in the genetic algorithm. |

`hrf` |
Method to use for HRF generation. |

`t` |
The t parameter for Boynton or SPM HRF generation. |

`p_boynton` |
Parameters for the Boynton's HRF. |

`p_spm` |
Parameters for the SPM HRF. |

`f` |
Upsampling factor. |

`autohrf` |
Results of a previous autohrf run to continue. |

`verbose` |
Whether to print progress of the fitting process. |

Returns the best model given provided constraints.

[Package *autohrf* version 1.1.2 Index]