You can "misuse" the tool join attributes by nearest
for this purpose. This tool is available since version 3.8 and can be found in processing toolbox. If you are using an older version, you can use the plugin NNJoin
, which does the same.
First make sure your both layers are in the correct CRS with meters as unit (or whatever you wish to measure in). Then simply choose your points as input layer and your roads as input layer 2 as seen below.
The output layer will contain a field called distance, which is filled with the distance in CRS units to the next road. In field calculator you can now calculate the mean (or other indicators like min, max, and so on) by creating a new field and using the expression mean("distance")
.
(it is the minimum distance to a line segment, not to the next line-vertex or something, so the actual real minimum distance).
To visualize the result or as a proof it is working, you could buffer your joined layer by distance field: