Learn R Programming

embryogrowth (version 7.1)

STRN: Estimate the parameters that best describe the sexualisation thermal reaction norm within the TSP

Description

Estimate the parameters that best describe the sexualisation thermal reaction norm within the TSP. The Temperatures parameter is a character string which can be:

  • TimeWeighted.temperature.mean

  • TSP.TimeWeighted.temperature.mean

  • TSP.MassWeighted.temperature.mean

  • TSP.STRNWeighted.temperature.mean

  • TSP.MassWeighted.STRNWeighted.temperature.mean

  • MiddleThird.TimeWeighted.temperature.mean

If information for sex is not known for some timeseries, set NA for Sexed. Sexed, Males and Females must be vectors with names. The names must be the same as the names of timeseries of temperatures in EmbryoGrowthTRN. Only two of these 3 parameters are required: Males, Females and Sexed

Usage

STRN(Initial_STRN = NULL, fixed.parameters = NULL,
  EmbryoGrowthTRN = stop("Embryo Growth Thermal Reaction Norm must be provided"),
  tsd = stop("A result from the function tsd() must be provided"),
  Sexed = NULL, Males = NULL, Females = NULL,
  Temperatures = "TSP.MassWeighted.STRNWeighted.temperature.mean",
  SE = TRUE, parallel = TRUE, itnmax = 1000, method = c("Nelder-Mead",
  "BFGS"), control = list(trace = 1, REPORT = 10))

Arguments

Initial_STRN

Values for initial model of Sexualisation Thermal Reaction Norm

fixed.parameters

Value for Sexualisation Thermal Reaction Norm model that will not be changed

EmbryoGrowthTRN

The Embryo Growth Thermal Reaction Norm obtained with searchR()

tsd

The model used to predict sex ratio, obtained from tsd()

Sexed

The number of sexed embryos with names identifying timeseries

Males

The number of males embryos with names identifying timeseries

Females

The number of females embryos with names identifying timeseries

Temperatures

The temperature from out of info.nests to be used

SE

Should standard error of parameters and Hessian matrix be estimated ? TRUE or FALSE

parallel

Should parallel computing for info.nests() be used

itnmax

Maximum number of iterations for each method

method

Methods to be used with optimx

control

List for control parameters for optimx

Value

The list with object return by optim()

Details

STRN estimates the parameters that best describe the sexualisation thermal reaction norm within the TSP

Examples

Run this code
# NOT RUN {
library(embryogrowth)
MedIncubation_Cc <- subset(DatabaseTSD, Species=="Caretta caretta" & 
RMU=="Mediterranean" & Sexed!=0)
Med_Cc <- with(MedIncubation_Cc, tsd(males=Males, females=Females, 
 temperatures=Incubation.temperature, par=c(P=29.5, S=-0.01)))
plot(Med_Cc, xlim=c(25, 35))
males <- c(7, 0, 0, 0, 0, 5, 6, 3, 5, 3, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0)
names(males) <- rev(rev(names(resultNest_4p_SSM4p$data))[-(1:2)])
sexed <- rep(10, length(males))
names(sexed) <- rev(rev(names(resultNest_4p_SSM4p$data))[-(1:2)])
Initial_STRN <- resultNest_4p_SSM4p$par[c("DHA", "DHH", "T12H")]
Initial_STRN <- structure(c(582.567096666926, 2194.0806711639, 3475.28414940385), 
                          .Names = c("DHA", "DHH", "T12H"))
fp <- c(Rho25=100)
fitSTRN <- STRN(Initial_STRN=Initial_STRN, 
                EmbryoGrowthTRN=resultNest_4p_SSM4p, tsd=Med_Cc, 
                Sexed=sexed, Males=males, 
                fixed.parameters=fp, 
                SE=TRUE, 
                Temperatures="TSP.MassWeighted.STRNWeighted.temperature.mean")
plotR(fitSTRN, curves ="ML quantiles", ylim=c(0,2))
CTE <- info.nests(NestsResult=resultNest_4p_SSM4p, 
                  SexualisationTRN=fitSTRN,
                  SexualisationTRN.CI="Hessian",
                  CI="Hessian", 
                  replicate.CI=100, 
                  progress=TRUE, 
                  warnings=TRUE, 
                  out="summary")$summary
# CTE with growth-weighted temperature average
plot(Med_Cc, xlim=c(25, 35))
points(x=CTE$TSP.MassWeighted.temperature.mean, y=males/sexed, 
         col="red", pch=19)
legend("topright", legend=c("CTE with growth-weighted TRN"), 
         pch=19, col=c("red"))
# CTE with sexualisation TRN and growth-weighted temperature average
plot(Med_Cc, xlim=c(25, 35))
points(x=CTE$TSP.MassWeighted.STRNWeighted.temperature.mean, y=males/sexed, 
         col="red", pch=19)
legend("topright", legend=c("CTE with growth-weighted TRN and Sex. TRN"), 
       pch=19, col=c("red"))
xx <- seq(from=20, to=35, by=0.1)
plot(x=xx, 
         y=log10(getFromNamespace(".SSM", ns="embryogrowth")(xx, 
                            c(fitSTRN$par, fitSTRN$fixed.parameters))[[1]]), 
         type="l", bty="n", xlim=c(20, 35), ylim=c(-20, 20), 
         xlab="Temperature", ylab="Sexualisation thermal reaction norm (log10)")
         
# Using only the sexualisation thermal reaction norm within TSP to calculate CTE

Initial_STRN <- resultNest_4p_SSM4p$par[c("DHA", "DHH", "T12H")]
Initial_STRN <- structure(c(3678.94960547096, -301.436485427701, 912.595953854977), 
                          .Names = c("DHA", "DHH", "T12H"))
fp <- c(Rho25=100)
fitSTRN_2 <- STRN(Initial_STRN=Initial_STRN, 
                EmbryoGrowthTRN=resultNest_4p_SSM4p, tsd=Med_Cc, 
                Sexed=sexed, Males=males, 
                fixed.parameters=fp,  
                Temperatures="TSP.STRNWeighted.temperature.mean")
CTE <- info.nests(NestsResult=resultNest_4p_SSM4p, 
                  SexualisationTRN=fitSTRN_2,
                  SexualisationTRN.CI="Hessian",
                  CI="Hessian", 
                  replicate.CI=100, 
                  progress=TRUE, 
                  warnings=TRUE, 
                  out="summary")$summary
# CTE with sexualisation TRN
plot(Med_Cc, xlim=c(25, 35))
points(x=CTE$TSP.STRNWeighted.temperature.mean, y=males/sexed, 
         col="red", pch=19)
legend("topright", legend=c("CTE with Sexualisation TRN"), 
       pch=19, col=c("red"))
xx <- seq(from=20, to=35, by=0.1)
plot(x=xx, 
         y=getFromNamespace(".SSM", ns="embryogrowth")(xx, 
                            c(fitSTRN$par, fitSTRN$fixed.parameters))[[1]], 
         type="l", bty="n", xlim=c(20, 35), ylim=c(0, 1E-18), 
         xlab="Temperature", ylab="Sexualisation thermal reaction norm")
# }

Run the code above in your browser using DataLab