[R-sig-ME] Questions regarding bs() interaction in lmer()
Ben Bolker
bbo|ker @end|ng |rom gm@||@com
Sat May 28 02:06:38 CEST 2022
On 2022-05-27 2:17 p.m., Hedyeh Ahmadi wrote:
> Hello All,
> I am running a lmer() model as follows. The following model gives all the interactions for before and after knots shown below. I have 3 questions:
>
> 1. I would like to suppress the highlighted interactions that is before and after the knot. I have tried the update() command with -bs(reshist, knots = 7, degree = 1)2:bs(age, knots = 126, degree = 1)1, which did not work.
It's not clear to me that there's an easy way to suppress particular
components of such an interaction.
> 2. How would I define the knots for the interaction term and is what I have a correct specification?
The knots would be constructed from the interaction.
> 3. Is there a package that would take this model and output interpretable parameter estimates for splines?
I don't really know of *any* spline framework that gives readily
interpretable parameter estimates. In my experience people usually look
at a variety of different kinds of prediction plots.
If you're going to do a lot of stuff with splines I would recommend
the mgcv package, which allows a broad range of flexible spline
parameterizations, along with the 'gratia' package for post-processing
and the paper by Pedersen et al on hierarchical GAMs:
Pedersen, Eric J., David L. Miller, Gavin L. Simpson, and Noam Ross.
“Hierarchical Generalized Additive Models in Ecology: An Introduction
with Mgcv.” PeerJ 7 (May 27, 2019): e6876.
https://doi.org/10.7717/peerj.6876.
You might get more useful advice from the list if you give a little
bit more context / reasons *why* you want to do these particular things ...
cheers
Ben Bolker
>
> Thank you in advance for your time
>
> smri_left <-
> lmer(smri ~ 1 +
> bs(reshist, knots=7, degree = 1)+
> bs(age, knots=126, degree = 1)+
> bs(reshist, knots=7.787, degree = 1)*bs(age, knots=126, degree = 1)+
> ethnicity.1_bl + high.bl + neighb_avg_p_bl
> (1|site/subject) ,
> REML = FALSE,
> control = lmerControl(optimizer = "Nelder_Mead"),
> data=WG)
>
> Fixed effects:
> Estimate Std. Error df t value Pr(>|t|)
> (Intercept) 2.6679353 0.0114634 652.5132635 232.736 < 0.0000000000000002 ***
> bs(reshist, knots = 7, degree = 1)1 0.0090600 0.0100475 1059.5955954 0.902 0.36741
> bs(reshist, knots = 7, degree = 1)2 0.0082266 0.0132667 559.1847547 0.620 0.53545
> bs(age, knots = 126, degree = 1)1 -0.0137868 0.0081986 6143.2470351 -1.682 0.09270 .
> bs(age, knots = 126, degree = 1)2 -0.0834209 0.0094686 5534.8186306 -8.810 < 0.0000000000000002 ***
> ethnicity.1_blHispanic 0.0154627 0.0030354 3492.3232613 5.094 0.00000036893 ***
> ethnicity.1_blOther 0.0158286 0.0033031 8304.5129245 4.792 0.00000167908 ***
> high.blBachelor 0.0022701 0.0044227 8691.0032954 0.513 0.60777
> high.blHS Diploma/GED -0.0009402 0.0045056 8757.0427133 -0.209 0.83472
> neighb_avg_p_bl 0.0001371 0.0009128 8628.5294654 0.150 0.88060
> bs(reshist, knots = 7, degree = 1)1:bs(age, knots = 126, degree = 1)1 -0.0091887 0.0095058 6161.8339520 -0.967 0.33376
> bs(reshist, knots = 7, degree = 1)2:bs(age, knots = 126, degree = 1)1 -0.0148081 0.0128074 6412.6567741 -1.156 0.24764
> bs(reshist, knots = 7, degree = 1)1:bs(age, knots = 126, degree = 1)2 0.0080632 0.0109929 5538.9731189 0.733 0.46329
> bs(reshist, knots = 7, degree = 1)2:bs(age, knots = 126, degree = 1)2 -0.0592144 0.0150237 5595.8147976 -3.941 0.00008199861 ***
> ---
> Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
>
> Best,
>
> Hedyeh Ahmadi, Ph.D.
> Statistician
> Keck School of Medicine
> Department of Preventive Medicine
> University of Southern California
>
> LinkedIn
> www.linkedin.com/in/hedyeh-ahmadi<http://www.linkedin.com/in/hedyeh-ahmadi>
> <http://www.linkedin.com/in/hedyeh-ahmadi><http://www.linkedin.com/in/hedyeh-ahmadi>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
--
Dr. Benjamin Bolker
Professor, Mathematics & Statistics and Biology, McMaster University
Director, School of Computational Science and Engineering
(Acting) Graduate chair, Mathematics & Statistics
More information about the R-sig-mixed-models
mailing list