Overlap of axis labels - r

I am conducting a multi level regression model where I look at how house prices vary based on the number of rooms with my level 2 predictor being districts. When I plot the residuals using the dotplot() function I have trouble looking at the variable numbers on the axis because they are too closely spaced together. Any help would be appreciated. Thank you

Related

Interpretation of dispersion between groups using ordihull

I have difficulty interpreting my data in regards to dispersion and composition. I have 6 groups and used adonis2() to test the compositional difference between them. Futhermore, I used betadisper() to check dispersion per group and compared the groups with anova. Now I want to visualize this and an elegant way seemed to use ordihull() in my NMDS plot.
Now my question, can I use ordihull to visualize group dispersion in an NMDS ordination? It looks like this:
Could I interpret and say that groups with largest surface area in ordihull (indicated by the coloured outlining) have the highest dispersion?

How can I model and plot the trend of growth in children i.e weight Vs age, Height vs Age using multilevel linear splines in R?

A longitudinal data with 6 repeated measurements of weight and height for each individual child. There are three treatment groups. Need to compare the growth trend between groups.
-How can I plot all three groups in one?
-what could be more intuitive knot positions? the idea was to place knots at time interval of four months defined by visits. When I used b-splines bs(), it seemed could only place it conditioning on the x-variable (the age).
so far I have tried to run the codes,
gam_bs<-gam((weight[study_group==1])~bs((age[study_group==1]),knots = mean(age,na.rm=TRUE)),data=na.omit(visit_no_NA))
lm1<-lm((weight[study_group==1])~bs((age[study_group==1]),df=5),data=visit_no_NA)

Fit survival-like data or inversed S-curves

I am dealing with some data producing survival-like curves where, instead of time vs survival, I have the log concentration of a substrate against bacterial optical density. The higher the concentration, the lower the OD. And lethal concentration varies with bacterial strain. I am attaching a plot to illustrate all that, where I show five bacterial strains. Each point in the graphic represents three independent replicates. I did not plot them for clarity purposes.
The questions are:
1- Can I use survival and survminer libraries, which are devoted to survival studies?
2- If not, how can I adjust such curves? An alternative would be to focus on the part of the curves where OD starts decreasing, but I do not fancy that idea that much.
Any help would be hugely appreciated.
Best,
David

R question: How to compute area under the curve with respect to increase?

I'm looking to illustrate an effect using area under the curve (AUC) in r. Specifically, I need to illustrate the AUC with respect to increase from baseline over 5 days.
I'm looking at biological data where the outcome is not coded as 0,1 but rather as continuous over time. I'm interested in creating this graph described in Fekedulegn et al., 2007 (https://www.ncbi.nlm.nih.gov/pubmed/17766693) with my own data.
I've seen several wonderful packages for AUC so far, but none to compute the AUC with respect to increase from baseline with the exception of one answer, described here: Incremental Area Under the Curve (iAUC) in R). This didn't quite work for my problem though.
The variables are as follows in a long-form dataset:
Baseline: total # of predictive biomarker produced when assessed at baseline
Panel_value: total # of predictive biomarker produced over 5 days (continuous)
Reap: frequency of cognitive reappraisal (continuous), but needed to bin this variable
Reap.quantiles: mutated reappraisal variables to plot values for each quantile
Reap.hilo: mutated reappraisal variable to plot values for those at top and bottom quantile for the frequency of cognitive reappraisal
Day: day of infection
I would greatly appreciate it if anyone can provide insight on any packages to compute AUC with respect to increase from baseline or recommend any alternative methods - bonus points if I can do it in ggplot as plotted here! Thanks in advance!

How can I plot my lmer() mixed model growth curves in r?

I have constructed a mixed effect model using lmer() with the aim of comparing the growth in reading scores for four different groups of children as they age.
I would like to plot a graph of the 4 different slopes with confidence intervals in R in order to visualize this relationship but I keep getting stuck.
I have tried to use the plot function and some versions of the ggplot as I have done for previous lm() models but it isn't working so far. Here is my attempted model which I hope looks at how the change in reading scores over time(age) interacts with a child's SESDLD grouping (this indicated whether a child has a language problem and whether or not they are high or low income).
AgeSES.model <- lmer(ReadingMeasure ~ Age.c*SESDLD1 + (1|childid), data = reshapedomit, REML = FALSE)
The ReadingMeasure is a continuous score, age.c is centered age measured in months. SESDLD1 is a categorical measure which has 4 levels. I would expect four positive slopes of ReadingMeasure growth with different intercepts and probably differing slopes.
I would really appreciate any pointers on how to do this!
Thank you so much!!
The type of plot I would like to achieve - this was done in Stata

Resources