dmcglinn / quant_methods

Applied Quantitative Methods course at the College of Charleston
http://dmcglinn.github.io/quant_methods/
Other
18 stars 26 forks source link

Spatial Modeling Assignment #63

Closed millertp1 closed 4 years ago

millertp1 commented 4 years ago

Confused on #2 building a model that only looks at one variable, has anyone successfully generated a linear model using the codes from the lesson?

dmcglinn commented 4 years ago

can you please provide some code for what you have tried so that we can better understand where you are having trouble.

mosscr commented 4 years ago

I am also having this issue. It gives me the error: "invalid type (list) for variable" no matter what variable I try.

dmcglinn commented 4 years ago

Can you please post your code snippet

Dan

On Feb 17, 2020, at 4:59 PM, mosscr notifications@github.com wrote:

 I am also having this issue. It gives me the error: "invalid type (list) for variable" no matter what variable I try.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

NicoleStrauss commented 4 years ago

I think I had the same issue here, but I'm on my phone and can't access R at the moment. I'll try to explain - Make sure that the first two variables are the response and the predictor. So (Drypetes.standleyi ~ other.tree, data = data.frame). It didnt work for me until I just used the column names alone, kept getting the same "list" error.

mosscr commented 4 years ago

@NicoleStrauss That seems to have worked for me! Thank you!

jtgood commented 4 years ago

2 questions: 1) Does anyone have a code to use a spherical model for the second question? 2) How can I fix my ANOVA to have a 'form' with a two sided formula when comparing the statistics of my models?

dmcglinn commented 4 years ago

Hey @jtgood

  1. can you share what you've tried for the spherical model so that we can help you trouble shoot it?
  2. I think by ANOVA you mean the coefficient summary table that is output by the function summary. If you want to use the form argument remember you have use the function nlme::gls.
jtgood commented 4 years ago

Hi @dmcglinn, Thank you for the suggestions for summary and nlme::gls! As for the spherical model, I don't know how to begin a function modeled after the given equation in the spatial modeling lesson. I have been using exponential and quadratic equations, but I can always see you before/after class.

Thanks!

dmcglinn commented 4 years ago

Hey @jtgood ahh I understand now! I didn't demonstrate corSpher in the lesson - I'll have to add that. Check out the documentation of nlme::corClasses:

https://www.rdocumentation.org/packages/nlme/versions/3.1-144/topics/corClasses

This lists every builtin model for correlation structure. No need to build your own in this case although they do have helper functions if that is something you decide to pursue.