crtahlin / medplot

Functions for drawing graphs in R visualizing medical information.
4 stars 2 forks source link

Extend Mixed model tables for Measurement #97

Closed crtahlin closed 10 years ago

crtahlin commented 10 years ago

Output coefficients for each of the levels

crtahlin commented 10 years ago

The formula gets constructed as:

 formula <- as.formula(paste(symptom, "~", as.factor(measurementVar),"+", groupingVar, "+(1|", subjectIDVar, ")"))

And the result is (for one concrete symptom case):

 Fatigue ~ Measurement + Sex + (1 | PersonID)

Which if of probably not OK, since only one coefficient is output for Measurement as a result. The as.factor() should be used on the data frame, will try that...

crtahlin commented 10 years ago

Coeficients are now calculated for each measurement level above first one (first level used as reference), and can be reached via (perhaps a better way exist):

coef(model)$PersonID[["Measurement14"]][1]

Now just to figure out how to package them in a table.

crtahlin commented 10 years ago

This is the better way to reach the coefficients:

 summary(model)$coef
crtahlin commented 10 years ago

Implemented, closing.