Skip to content

Commit

Permalink
Update Module 6 step1 and 2. More details of the difference between V…
Browse files Browse the repository at this point in the history
…sx and Vs.
  • Loading branch information
Haycen committed May 30, 2016
1 parent 7c7a50d commit 2c5e2da
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ span(

#Individual-specific response to an environmental effect (random slopes) variance (VS)
fluidRow(
column(8,getSliderInput("Mod6Step1_Vs", Modules_VAR$Vs)),
column(8,getSliderInput("Mod6Step1_Vs", Modules_VAR$Vsx)),
column(4,textOutput("Mod6Step1_Vs_proportion", inline = TRUE))
),

Expand Down
5 changes: 3 additions & 2 deletions inst/shiny-squid/source/pages/modules/module6/UIMod6Step2.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ span(

#Individual-specific response to an environmental effect (random slopes) variance (Vs)
fluidRow(
column(8,getSliderInput("Mod6Step2_Vs", Modules_VAR$Vs)),
column(8,getSliderInput("Mod6Step2_Vs", Modules_VAR$Vsx)),
column(4,textOutput("Mod6Step2_Vs_proportion", inline = TRUE))
),

Expand All @@ -86,6 +86,7 @@ span(

# Table : display true and measured values (Vp, Vi and mean)
uiOutput("Mod6Step2_summary_table"),
div(info_msg(Mod6Step2_txt$note1)), # Text: note 1

(HTML(Mod6Step2_txt$para5)), # Text: paragraph 5

Expand All @@ -103,7 +104,7 @@ span(
p("where"),
p(paste0("$$COV_{",NOT$devI,",",NOT$devS,NOT$env,"}=
E(",NOT$env,")Cov(",NOT$devI,",",NOT$devS,")$$")),
div(info_msg(Mod6Step2_txt$note)), # Text: note
div(info_msg(Mod6Step2_txt$note2)), # Text: note 2

p(HTML(Mod6Step2_txt$para7)), # Text: paragraph 7

Expand Down
8 changes: 4 additions & 4 deletions inst/shiny-squid/source/server/modules/module6/SVRMod6Step1.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ c(
paste("Mean of the trait ($",EQ3$mean0,"$) =",round(input$Mod6Step1_B[1],2)),
paste("Population-specific slope of the environmental effect ($",NOT$mean,"$) =",round(input$Mod6Step1_B[2],2)),
"$\\text{Random effects}$",
paste("Individual variance ($V_",NOT$devI,"$) =",input$Mod6Step1_Vi),
paste("Individual-specific response to an environmental effect (random slopes) variance ($V_{",NOT$devS,NOT$env,"}$) =",input$Mod6Step1_Vs),
paste("Among-individual variance in intercept ($V_",NOT$devI,"$) =",input$Mod6Step1_Vi),
paste("Variance due to individual-specific responses to an environmental factor (random slopes; $V_{",NOT$devS,NOT$env,"}$) =",input$Mod6Step1_Vs),
paste("Residual variance ($V_",NOT$residualUpper,"$) =",input$Mod6Step1_Ve)),
"Estimated" = c("$\\text{Fixed effects}$",
paste("Sampled mean of the trait ($",NOT$mean,"'_0$) =",ifelse(!is.null(data),paste(data$B0,"\U00b1", data$se.B0, sep=" "),"...")),
paste("Estimated population-specific slope of the environmental effect ($",NOT$mean,"'$) =",ifelse(!is.null(data),paste(data$B1,"\U00b1", data$se.B1, sep=" "),"...")),
"$\\text{Random effects}$",
paste("Individual variance in sample ($V'_",NOT$devI,"$) = ", ifelse(!is.null(data),data$Vi,"...")),
paste("Individual-specific response to an environmental effect (random slopes) variance ($V'_{",NOT$devS,NOT$env,"}$) = ", ifelse(!is.null(data),data$Vs,"...")),
paste("Sampled among-individual variance in intercept ($V'_",NOT$devI,"$) = ", ifelse(!is.null(data),data$Vi,"...")),
paste("Variance due to individual-specific responses to an environmental factor (random slopes; $V'_{",NOT$devS,NOT$env,"}$) = ", ifelse(!is.null(data),data$Vs,"...")),
paste("Residual variance of sample ($V'_",NOT$residualUpper,"$) = ", ifelse(!is.null(data),data$Vr,"...")))
)

Expand Down
8 changes: 4 additions & 4 deletions inst/shiny-squid/source/server/modules/module6/SVRMod6Step2.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ c(
paste("Mean of the trait ($",EQ3$mean0,"$) =",round(input$Mod6Step2_B[1],2)),
paste("Population-specific slope of the environmental effect ($",NOT$mean,"$) =",round(input$Mod6Step2_B[2],2)),
"$\\text{Random effects}$",
paste("Individual variance ($V_",NOT$devI,"$) =",input$Mod6Step2_Vi),
paste("Individual-specific response to an environmental effect (random slopes) variance ($V_{",NOT$devS,NOT$env,"}$) =",input$Mod6Step2_Vs),
paste("Among individual variance in intercept ($V_",NOT$devI,"$) =",input$Mod6Step2_Vi),
paste("Among-individual variance in slopes (random slopes; $V_",NOT$devS,"$) =",input$Mod6Step2_Vs),
paste("Correlation between individual specific intercepts and slopes ($Cor_{",NOT$devI,",",NOT$devS,"}$) =",input$Mod6Step2_CorIS),
paste("Residual variance ($V_",NOT$residualUpper,"$) =",input$Mod6Step2_Ve)),
"Estimated" = c("$\\text{Fixed effects}$",
paste("Sampled mean of the trait ($",NOT$mean,"'_0$) =",ifelse(!is.null(data),data$B0,"...")),
paste("Estimated population-specific slope of the environmental effect ($",NOT$mean,"'$) =",ifelse(!is.null(data),data$B1,"...")),
"$\\text{Random effects}$",
paste("Individual variance in sample ($V'_",NOT$devI,"$) = ", ifelse(!is.null(data),data$Vi,"...")),
paste("Individual-specific response to an environmental effect (random slopes) variance ($V'_{",NOT$devS,NOT$env,"}$) = ", ifelse(!is.null(data),data$Vs,"...")),
paste("Sampled among-individual variance in intercept ($V'_",NOT$devI,"$) = ", ifelse(!is.null(data),data$Vi,"...")),
paste("Sampled among-individual variance in slope ($V'_",NOT$devS,"$) = ", ifelse(!is.null(data),data$Vs,"...")),
paste("Correlation between individual specific intercepts and slopes ($Cor'_{",NOT$devI,",",NOT$devS,"}$) =", ifelse(!is.null(data),data$CorIS,"...")),
paste("Residual variance of sample ($V'_",NOT$residualUpper,"$) = ", ifelse(!is.null(data),data$Vr,"...")))
)
Expand Down
12 changes: 9 additions & 3 deletions inst/shiny-squid/source/text/modules/TXTmodule6.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Mod6Step1_txt <- list(
on the measure of phenotype in the <i>i <sup>th</sup></i> individual.
Accordingly, we can apply the following parameterization regimes:"),
"note" = "Note: you can consider residual variance as solely measurement error variance,
or you could consider it in which case it might also include some
unknown environmental variance in addition to the known environmental variance determined below.",
or you could consider that it might also include some unknown environmental
variance in addition to the known environmental variance determined below.",
"para3" = "Set in the background is the environmental variable and its sampling.
Here we should use uniform sampling, where each individual is sampled
at the same time so there are no biases. By definition,
Expand Down Expand Up @@ -117,6 +117,12 @@ Mod6Step2_txt <- list(
"para4" = "We will then examine the appearance of the resulting data.",

"results" = "<b>Results:</b> A mixed-effects statistical model estimates these parameters:",
"note1" = paste0("Note that we have slightly changed what is presented in the table above.
Whereas earlier we presented the phenotypic variance due to a particular term
(e.g., the variance due to individual differences in response to an environmental
factor, or $V_{",NOT$devS,NOT$env,"}$), above we present what many statistical packages produce,
which in the case of random slope, is the variance in slope $(V_",NOT$devS,")$
rather than the phenotypic variance due to slope."),
"para5" = "The best way to develop an intuition about what the covariance represents
is to compare a graph with and without it. Below are two panels of simulated data.
The one on the left shows your simulated individuals without the covariance,
Expand All @@ -132,7 +138,7 @@ Mod6Step2_txt <- list(
the relationship between two parameters in the equation—that is,
how they behave across individuals.
The covariance does normally appear in a partitioning of variance:",
"note" = paste0("Note: In SQuID $E(",NOT$env,")=0$ and hence the covariance does not contribute to total phenotypic variance."),
"note2" = paste0("Note: In SQuID $E(",NOT$env,")=0$ and hence the covariance does not contribute to total phenotypic variance."),
"para7" = "The biology of the covariance is just beginning to be explored
(e.g., <a href='http://onlinelibrary.wiley.com/doi/10.1111/j.1461-0248.2011.01698.x/abstract' target='_blank'>Mathot et al. 2011</a>).
Undoubtedly further understanding of it will contribute to understanding
Expand Down
10 changes: 5 additions & 5 deletions inst/shiny-squid/source/variables/modules/VARmodules.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ Modules_VAR <- list(
),

# Individual-specific response to an environmental effect (random slopes) variance (VS)
"Vs" = list( "label" = paste0("Individual-specific response to an environmental effect (random slopes) variance ($V_{",NOT$devS,NOT$env,"}$): "),
"infoTxt" = "Individual-specific response to an environmental effect (random slopes) variance",
"Vsx" = list( "label" = paste0("Variance due to individual-specific responses to an environmental factor (random slopes; $V_{",NOT$devS,NOT$env,"}$): "),
"infoTxt" = "Variance due to individual-specific responses to an environmental factor (random slopes)",
"value" = 0.2,
"min" = 0,
"max" = 1,
Expand Down Expand Up @@ -120,13 +120,13 @@ Modules_VAR <- list(
),

# Variance of population mean response to an environmental effect x
"Vbx" = list( "label" = paste("Variance of population mean response to an environmental effect $(V_{",NOT$mean," ",NOT$env,"})$:",sep=""),
"infoTxt" = "Variance of population mean response to an environmental effect.",
"Vbx" = list( "label" = paste0("Variance due to population mean effect of an environmental factor $(V_{",NOT$mean," ",NOT$env,"})$:"),
"infoTxt" = "Variance due to population mean effect of an environmental factor.",
"value" = 0.5,
"min" = 0,
"max" = 1,
"step" = 0.01,
"errorTxt" = paste("Variance of population mean response to an environmental effect $(V_{",NOT$mean," ",NOT$env,"})$
"errorTxt" = paste("Variance due to population mean effect of an environmental factor $(V_{",NOT$mean," ",NOT$env,"})$
must be a number between 0 and 1.
Try to decrease other variances.",sep="")
),
Expand Down

0 comments on commit 2c5e2da

Please sign in to comment.