Extremely new to Rstudio, don't know where to begin with data

Hello! I am a new grad student who is entirely new to R and stats in general.

I am trying to find a way to analyze my count data in R using a poisson regression. I am struggling with figuring out how to setup my data and my formulas to get the outputs I want.

My data consists of days since treatment (0, 5 and 14 days), plot number, treatment (the names of the treatments), and the counts (all whole numbers)
I was trying to utilize a glm poisson but I can't seem to really understand what I'm doing
my code is extremely simple and probably not at all what I need it to be,

my_data <-FieldData

glm(count~ trt, data = my_data, family = 'poisson')

Call: glm(formula = total ~ trt, family = "poisson", data = ricesb)

(Intercept) trt_1 trt_2 trt_3
3.365e-01 2.989e-08 5.798e-01 6.751e-01

Degrees of Freedom: 79 Total (i.e. Null); 76 Residual
Null Deviance: 204.8
Residual Deviance: 189.4 AIC: 345.2

I am trying to figure out how to get the correlation of the different treatments on count size as well as factoring in the days since the treatment was administered. The output also does not seem to have counted one of my treatments, as I had 4 total treatments. Does anyone have any suggestions?

To add days treated you'd write something like

glm(formula = total ~ trt+days_treated, family = "poisson", data = ricesb)

(adding the proper variable name, of course.)

Your results give you an intercept plus three differences from the intercept. So if the left out category is trt_0, then the intercept gives you the answer for that treatment. For trt_1 the answer is the estimated intercept plus the estimated coefficient on trt_1. You have all four.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.