LaraVolski / Foxlights

0 stars 0 forks source link

Determinig vif # #5

Closed LaraVolski closed 4 years ago

LaraVolski commented 4 years ago

https://github.com/LaraVolski/Foxlights/blob/5eccef517ddebf50702fd9172c9f3ca961e32580/foxlight_model_selection.Rmd#L181

When I run the vif for the fit8, I'm given the following:

Foxlight 1174.365798 rugged25.clean 714.263852 fence.dist.clean 2.899344 Foxlight:rugged25.clean 724.536089 Foxlight:fence.dist.clean 1158.692912 rugged25.clean:fence.dist.clean 688.176027 Foxlight:rugged25.clean:fence.dist.clean 703.057188

Which is the VIF? Is it 2.899344?

kaitlyngaynor commented 4 years ago

Weird, because when I run that model, I get this error: Error: Invalid grouping factor specification, Camera Are you not getting this?

At any rate, this model is INSANE and probably not appropriate, haha. It is suggesting that there is a three-way interaction between foxlights, fence distance, and road distance. The more appropriate model would be foxlight fence distance + foxlight road distance but even this is a little bit wacky.

What approach are you using to decide which models to test?

(Also, have you invited Alex to the repo yet?)

kaitlyngaynor commented 4 years ago

I'm also getting a convergence error with fit7—do you see that, too?

LaraVolski commented 4 years ago

I did invite Alex, yes! There were two possible usernames so I'll try the other one.

I get the convergence error with fit7. And I wasn't getting the Error: Invalid grouping factor specification, Camera, but now that I go back to the code, I am. Even when I try to tweak it.

LaraVolski commented 4 years ago

Fixed the Error: Invalid grouping factor specification, Camera error! I had to run the code to create the RAI datatable in the foxlight_data_analysis.rmd.

LaraVolski commented 4 years ago

I will tone down the models and think more strategically about which ones to test. I was just having fun just plugging in random variables :)

kaitlyngaynor commented 4 years ago

Haha okay :) I figured out the problem, let me fix the code and push it to you

kaitlyngaynor commented 4 years ago

Okay, have a look at my change in this commit here.

The problem was that all of the raster metadata (ruggedness, fence distance, etc) was completely full of NAs. I went back to figure out why, and the issue is that when we joined the RAI dataframe with the raster metadata dataframe, R got confused because the Latitude and Longitude column values were not the same in the RAI vs metadata files anymore (since they were scaled). So I removed these columns from the raster metadata file before scaling and merging.

Does that make sense? Always good to just look under the hood at the raw data that is going into the models, and check for error/warning messages along the way. There was a warning message that popped up when merging rai and rasters about Lat & Long that we had both ignored!

kaitlyngaynor commented 4 years ago

Also, to go back to your original question, it seems like VIF may be high for interaction terms, but that's okay.

kaitlyngaynor commented 4 years ago

Fixed the Error: Invalid grouping factor specification, Camera error! I had to run the code to create the RAI datatable in the foxlight_data_analysis.rmd.

Actually, Lara, this won't work because this just merges it with the UNSCALED raster metadata! So use the fix that I came up with :)

LaraVolski commented 4 years ago

Thank you Kaitlyn!