[R] ​Message from Lanzhou University, China. (Help)

Jue Lin-Ye jl.iccp at gmail.com
Tue Nov 15 11:26:00 CET 2016

​
​
Dear Mr. Song,

S
​​
orry for the late response.

​My response to you, is that, first, y
ou are not assuming a linear relationship in your formula, because the
argument k of your smooth term s() is not 1.

​Now, ​
I cannot see figure 1, but you can obtain figure 2 from the formula that
you describe here. In order to obtain a
​plot with the ​
derivative, you have to create a ne
​w​
column in your matrix or data-frame that is the derivative of the blood
pressure, and then apply gam()
​ as in

​
​
ct=gam(
​derivative(​
Blood pressure
​)​
~s(Temp,k=5)+s(BMI,k=4)+s(Age,k=6)+s(RH,k=4)+s(Pa,k=
5)+Gender+Season,family=gaussian,data=mydata)
​
.

H
​ope that helps​
. Best regards,

Jue

On Saturday, 12 November 2016, <r-help-request at r-project.org> wrote:
>
>
> Date: Fri, 11 Nov 2016 17:31:23 +0800 (GMT+08:00)
> From: ??? <songxp15 at lzu.edu.cn>
> To: r-help at r-project.org
> Subject: [R]
> ​​
> Message from Lanzhou University, China. (Help)
> Message-ID: <6f90a404.73da.15852ba30a2.Coremail.songxp15 at lzu.edu.cn>
> Content-Type: text/plain; charset="utf-8"
>
> Dear moderators,
> I am a student come from Lanzhou University, Gansu, China. I have two
> questions on R (mgcv), which puzzled me for a long time. I did not find
> post it in R-help. Thank you very much.
>
>  Xuping Song
>
> 2016.11.11
> We want to investigate the association between exposure to ambient
> temperature and blood pressure. The ?mgcv? package was used to perform GAM
> analyses in R. This is the formula.
> ​​
> ct=gam(Blood pressure~s(Temp,k=5)+s(BMI,k=4)+s(Age,k=6)+s(RH,k=4)+s(Pa,k=
> 5)+Gender+Season,family=gaussian,data=mydata)
>
> I have two questions. Firstly, personal characteristic (Age, Gender, BMI
> and Season) could influence blood pressure. How to control these variables?
> BMI and Age are continuous variable. I smoothed these two variables like
> formula 1. Season (1,2,3,4) and Gender(0,1) were add to formula, which were
> assumed as linear relationship. Is that right?
>
> Secondly, I want to get plot 2, which x-axis presented ?Temperature? and
> y-axis presented ?Change in Blood Pressure for every 1?C decrease of
> temperature?. Plot 2 came from a paper published recently (see appendix).
> Therefore, I ran formula 1 in R and run ?plot(ct)?. Then I get plot 1. I
> don?t understand the meaning of ?s?Tmean?3.87?? in y-axis. Does it
> represent ?Blood pressure?? If the hypothesis is right, plot 2 is the
> derivative of plot 1. However, I don?t know the specific code. I am a
> Thank you very much.
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: Paper (plot 2).pdf
> Type: application/pdf
> Size: 913655 bytes
> Desc: not available
> URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20161111/
> 4c9d7aec/attachment.pdf>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: Plot 2.png
> Type: image/png
> Size: 37455 bytes
> Desc: not available
> URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20161111/
> 4c9d7aec/attachment.png>
>
>
[[alternative HTML version deleted]]