BYOM function startvals.m
Syntax: [Y0,ECx,logc] = startvals(DATA,W)
This function calculates starting values for fitting a dose-response curve, and ranges for plotting model curves, from the data set entered.
As input, it gets:
- DATA is the data matrix
- W the weight matrix (used for survival data only)
Output is * Y0 initial value for control response * ECx initial value for ECx (uses the EC50) * logc range for plotting the model curve on log-scale
Copyright (c) 2012-2019, Tjalling Jager, all rights reserved. This source code is licensed under the MIT-style license found in the LICENSE.txt file in the root directory of BYOM.
function [Y0,ECx,logc] = startvals(DATA,W) if DATA(1,1) < 0 % then we have survival data mn_resp = mean(DATA(2:end,2:end)./W,2,'omitnan'); % calculate mean response over all replicates (ignore NaNs) % Note: recalculate the mean response to a survival probability Y0 = mn_resp(1); % initial value for control response is mean of control (as probability) else mn_resp = mean(DATA(2:end,2:end),2,'omitnan'); % calculate mean response over all replicates (ignore NaNs) Y0 = mn_resp(1); % initial value for control response (before scaling) mn_resp = mn_resp / mn_resp(1); % scale the mean response to that in the control treatment end ind_1 = find(mn_resp > 0.5,1,'last'); % find highest concentration that has less than 50% effect ind_2 = find(mn_resp < 0.5,1,'first'); % find lowest concentration that has more than 50% effect c = DATA(2:end,1); % take concentrations from data set (first column) ECx = geomean(c([ind_1 ind_2])); % initial value for ECx around 50% effect logc = [log10(c(2)) - 2.4*mean(diff(log10(c(c>0)))) log10(1.2*c(end))]; % useful range for plotting the model curve on log-scale