# Visitation Model: Linear model is under constrained with DOF=-1

**URL:** https://community.naturalcapitalalliance.org/t/visitation-model-linear-model-is-under-constrained-with-dof-1/3305
**Category:** Software Support
**Tags:** recreation
**Created:** [December 20, 2022, 3:32am UTC](https://community.naturalcapitalalliance.org/t/visitation-model-linear-model-is-under-constrained-with-dof-1/3305 "2022-12-20T03:32:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![emmer](https://avatars.discourse-cdn.com/v4/letter/e/f14d63/32.png) [@emmer](https://community.naturalcapitalalliance.org/u/emmer)
#### Post date: [December 20, 2022, 3:32am UTC](https://community.naturalcapitalalliance.org/t/visitation-model-linear-model-is-under-constrained-with-dof-1/3305/1 "2022-12-20T03:32:08Z")

</div>

When running the regression, I keep getting the warning that the regression is using the mean of an empty slice, followed by an error that the model runs into an invalid value encountered in double\_scalars and that the linear model is under constrained with DOF=-1.

This leads to all empty outputs. I first ran into this problem when using fewer inputs and thought that it might have to do with a cell size that is too small or a lack of data, and that the error in double scalars might have been a division by 0. However, I later added additional inputs to more fully populate the country boundary and played around with the cell size (10km-100km), but have encountered the same error. I then tried this with different countries and have gotten the same result.

logfile:  
[InVEST-natcap.invest.recreation.recmodel\_client-log-2022-12-19–21\_31\_00.txt](https://community.naturalcapitalalliance.org/uploads/short-url/hf3xMY1qdi2hklm3imAGo1WE6xD.txt) (6.8 KB)

---

<div class="post-metadata">

### Author: ![esoth](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@esoth](https://community.naturalcapitalalliance.org/u/esoth)
#### Post date: [December 20, 2022, 5:59pm UTC](https://community.naturalcapitalalliance.org/t/visitation-model-linear-model-is-under-constrained-with-dof-1/3305/2 "2022-12-20T17:59:21Z")

</div>

@emmer,  
I can’t be sure without seeing your data, but this could happen if your predictor table isn’t filled out correctly.

---

<div class="post-metadata">

### Author: ![emmer](https://avatars.discourse-cdn.com/v4/letter/e/f14d63/32.png) [@emmer](https://community.naturalcapitalalliance.org/u/emmer)
#### Post date: [December 20, 2022, 6:27pm UTC](https://community.naturalcapitalalliance.org/t/visitation-model-linear-model-is-under-constrained-with-dof-1/3305/3 "2022-12-20T18:27:29Z")

</div>

@esoth,

My predictor table is shown below. I looked over it again but don’t notice anything glaring. Could it be that I should not have labelled the tab? (I also took two variables out here so that the model would run quicker)

![PredictorTable](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/2/24a47b32f170ab3f54cc42c80bd6528e0d6d1c03.png)

Thanks,  
Emmer

---

<div class="post-metadata">

### Author: ![dcdenu4](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dcdenu4/32/544_2.png) [@dcdenu4](https://community.naturalcapitalalliance.org/u/dcdenu4)
#### Post date: [January 4, 2023, 6:57pm UTC](https://community.naturalcapitalalliance.org/t/visitation-model-linear-model-is-under-constrained-with-dof-1/3305/4 "2023-01-04T18:57:48Z")

</div>

Hi @emmer,

Sorry for the delay over the end of year break. Are you still experiencing this issue? Could you zip up your input data and share it with us so we can try to reproduce it on our end? If it can’t be uploaded here you can use a file sharing service like Google Drive or email to ddenu@stanford.edu.

Thanks!

---

<div class="post-metadata">

### Author: ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)
#### Post date: [January 4, 2023, 7:40pm UTC](https://community.naturalcapitalalliance.org/t/visitation-model-linear-model-is-under-constrained-with-dof-1/3305/5 "2023-01-04T19:40:33Z")

</div>

I would also examine the attribute table of `predictor_data.shp` output. If there are a lot missing values, that could be the cause of the error, I think. It’s hard to say what the cause of the missing values would be, but it could be something like a predictor that doesn’t overlap with the AOI.
