function varargout = samplesize(varargin) % SAMPLESIZE MATLAB code for samplesize.fig % SAMPLESIZE, by itself, creates a new SAMPLESIZE or raises the existing % singleton*. % % H = SAMPLESIZE returns the handle to a new SAMPLESIZE or the handle to % the existing singleton*. % % SAMPLESIZE('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in SAMPLESIZE.M with the given input arguments. % % SAMPLESIZE('Property','Value',...) creates a new SAMPLESIZE or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before samplesize_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to samplesize_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help samplesize % Last Modified by GUIDE v2.5 28-Oct-2012 15:19:50 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @samplesize_OpeningFcn, ... 'gui_OutputFcn', @samplesize_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before samplesize is made visible. function samplesize_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to samplesize (see VARARGIN) % Choose default command line output for samplesize handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes samplesize wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = samplesize_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; % --- Executes during object creation, after setting all properties. %Select test-type function popupmenu2_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in popupmenu2. function popupmenu2_Callback(hObject, eventdata, handles) % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) val=get(handles.popupmenu2,'Value'); if val==2 set(handles.pushbutton1,'Visible','on') set(handles.pushbutton2,'Visible','on') set(handles.pushbutton5,'Visible','on') set(handles.pushbutton6,'Visible','on') set(handles.pushbutton7,'Visible','on') set(handles.pushbutton8,'Visible','on') set(handles.pushbutton9,'Visible','on') set(handles.pushbutton10,'Visible','on') set(handles.pushbutton11,'Visible','on') set(handles.edit1,'Visible','on','Enable','off','String','Number of treatments') set(handles.edit3,'Visible','on','Enable','off','String','Significance level') set(handles.edit2,'Visible','on','Enable','off','String','Power') set(handles.edit4,'Visible','on','String','Correlation between parameters','Enable','off') set(handles.edit5,'Visible','on','String','Sphericity parameter','Enable','off') set(handles.edit6,'Visible','on','String','Sample size per cell','Enable','off') set(handles.popupmenu1,'Visible','on') set(handles.checkbox1,'Visible','on') set(handles.uipanel2,'Visible','on','Title','For repeated measures only') set(handles.uipanel3,'Visible','on') set(handles.uipanel4,'Visible','on') set(handles.popupmenu3,'Visible','off') set(handles.edit7,'Visible','off') set(handles.edit9,'Visible','off') set(handles.text1,'Visible','off') set(handles.text2,'Visible','off') set(handles.text3,'Visible','off') set(handles.text4,'Visible','off') set(handles.text5,'Visible','off') set(handles.text6,'Visible','off') set(handles.popupmenu4,'Visible','off') set(handles.pushbutton12,'Visible','off') elseif val==3 set(handles.pushbutton1,'Visible','on') set(handles.pushbutton2,'Visible','on') set(handles.pushbutton5,'Visible','on') set(handles.pushbutton6,'Visible','on') set(handles.pushbutton7,'Visible','off') set(handles.pushbutton8,'Visible','on') set(handles.pushbutton9,'Visible','on') set(handles.pushbutton10,'Visible','on') set(handles.pushbutton11,'Visible','off') set(handles.edit1,'Visible','off') set(handles.edit3,'Visible','on','Enable','off','String','Significance level') set(handles.edit2,'Visible','on','Enable','off','String','Power') set(handles.edit4,'Visible','on','String','Difference in Means','Enable','off') set(handles.edit5,'Visible','on','String','Standard Deviation','Enable','off') set(handles.edit6,'Visible','on','String','Samples used','Enable','off') set(handles.popupmenu1,'Visible','off') set(handles.checkbox1,'Visible','off') set(handles.uipanel2,'Visible','off') set(handles.uipanel3,'Visible','off') set(handles.uipanel4,'Visible','off') set(handles.popupmenu3,'Visible','on') set(handles.text1,'Visible','off') set(handles.text2,'Visible','off') set(handles.text3,'Visible','off') set(handles.text4,'Visible','off') set(handles.text5,'Visible','off') set(handles.text6,'Visible','off') set(handles.popupmenu4,'Visible','off') set(handles.pushbutton12,'Visible','off') elseif val==4 set(handles.pushbutton1,'Visible','on') set(handles.pushbutton2,'Visible','on') set(handles.pushbutton5,'Visible','on') set(handles.pushbutton6,'Visible','on') set(handles.pushbutton7,'Visible','off') set(handles.pushbutton8,'Visible','on') set(handles.pushbutton9,'Visible','on') set(handles.pushbutton10,'Visible','on') set(handles.pushbutton11,'Visible','off') set(handles.edit1,'Visible','off') set(handles.edit3,'Visible','on','Enable','off','String','Significance level') set(handles.edit2,'Visible','on','Enable','off','String','Power') set(handles.edit4,'Visible','on','String','Proportion 0','Enable','off') set(handles.edit5,'Visible','on','String','Proportion 1','Enable','off') set(handles.edit6,'Visible','on','String','Samples used','Enable','off') set(handles.popupmenu1,'Visible','off') set(handles.checkbox1,'Visible','off') set(handles.uipanel2,'Visible','off') set(handles.uipanel3,'Visible','off') set(handles.uipanel4,'Visible','off') set(handles.popupmenu3,'Visible','off') set(handles.text1,'Visible','off') set(handles.text2,'Visible','off') set(handles.text3,'Visible','off') set(handles.text4,'Visible','off') set(handles.text5,'Visible','off') set(handles.text6,'Visible','off') set(handles.edit7,'Visible','off') set(handles.edit9,'Visible','off') set(handles.popupmenu4,'Visible','off') set(handles.pushbutton12,'Visible','off') elseif val==5 set(handles.pushbutton1,'Visible','on') set(handles.pushbutton2,'Visible','on') set(handles.pushbutton5,'Visible','on') set(handles.pushbutton6,'Visible','on') set(handles.pushbutton7,'Visible','off') set(handles.pushbutton8,'Visible','on') set(handles.pushbutton9,'Visible','on') set(handles.pushbutton10,'Visible','on') set(handles.pushbutton11,'Visible','off') set(handles.edit1,'Visible','off') set(handles.edit3,'Visible','on','Enable','off','String','Significance level') set(handles.edit2,'Visible','on','Enable','off','String','Power') set(handles.edit4,'Visible','on','String','Hypothesis','Enable','off') set(handles.edit5,'Visible','on','String','Actual mean','Enable','off') set(handles.edit6,'Visible','on','String','Samples used','Enable','off') set(handles.popupmenu1,'Visible','off') set(handles.checkbox1,'Visible','off') set(handles.uipanel2,'Visible','off') set(handles.uipanel3,'Visible','off') set(handles.uipanel4,'Visible','off') set(handles.popupmenu3,'Visible','off') set(handles.text1,'Visible','off') set(handles.text2,'Visible','off') set(handles.text3,'Visible','off') set(handles.text4,'Visible','off') set(handles.text5,'Visible','off') set(handles.text6,'Visible','off') set(handles.edit9,'Visible','on','Enable','off','String','Standard deviation') set(handles.edit7,'Visible','off') set(handles.popupmenu4,'Visible','on') set(handles.pushbutton12,'Visible','on') else end % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu2 % --- Executes on button press in pushbutton1. %Calculate sample size function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) val=get(handles.popupmenu2,'Value'); if val==2 eps=str2num(get(handles.edit5,'String')); rho=str2num(get(handles.edit4,'String')); prob=str2num(get(handles.edit2,'String')); alpha=str2num(get(handles.edit3,'String')); k=str2num(get(handles.edit1,'String')); f=get(handles.popupmenu1,'Value'); if f==2 f2=.1^2; elseif f==3 f2=.25^2; elseif f==4 f2=.5^2; elseif f==5 fa=inputdlg('What would like f to be?'); fa=str2num(fa{1}); f2=fa^2; else f2=[]; end if isempty(k) & get(handles.checkbox1,'Value')==0 errordlg('Please either check ''Multiple Factors'' or enter number of treatments') return end if isempty(alpha)|isempty(f2)|isempty(prob) errordlg('Make sure you have selected probability of rejection, significance level, and Cohen''s effect size') return end if alpha>1 | alpha<0 errordlg('Significance level outside bounds') return end if prob>1 | prob<0 errordlg('Probability of rejection outside bounds') return end if get(handles.checkbox1,'Value')==0 count=1; p=0; if isempty(eps) & isempty(rho) while p1 ma=2; end hold off axes(handles.axes1) plot(0:.05:5,ncfpdf(0:.05:5,k-1,tot-k,lambda)) hold on axes(handles.axes1) area(0:.01:finv(1-alpha,(k-1),(count-1)*k),ncfpdf(0:.01:finv(1-alpha,(k-1),(count-1)*k),k-1,tot-k,lambda),'FaceColor',[.8,.8,.8]) hold on axes(handles.axes1) area(finv(1-alpha,(k-1),(count-1)*k):.01:5,fpdf(finv(1-alpha,(k-1),(count-1)*k):.01:5,k-1,tot-k),'FaceColor',[1,.6,.78]) hold on axes(handles.axes1) plot(0:.05:5,fpdf(0:.05:5,k-1,tot-k),'r') hold on axes(handles.axes1) plot(finv(1-alpha,(k-1),(count-1)*k)*ones(1,length(0:.01:ma)),0:.01:ma,'g','LineWidth',2) set(handles.text7,'Visible','on','String',['The critical F-value is ' num2str(finv(1-alpha,(k-1),(count-1)*k)) '. The red shaded area represents significance region (alpha) and blue shaded area represents 1-power (beta).']) elseif val==3 val=get(handles.popupmenu3,'Value'); s=str2num(get(handles.edit5,'String')); du=str2num(get(handles.edit4,'String')); prob=str2num(get(handles.edit2,'String')); alpha=str2num(get(handles.edit3,'String')); if alpha>1 | alpha<0 errordlg('Significance level outside bounds') return end if prob>1 | prob<0 errordlg('Probability of rejection outside bounds') return end if val==1 p=0; n=2; while p1 ma=2; end hold off axes(handles.axes1) plot(-5:.1:5,nctpdf(-5:.1:5,n-1,abs(du)/(s/sqrt(n)))) hold on axes(handles.axes1) area(-5:.01:tinv(1-alpha,n-1),nctpdf(-5:.01:tinv(1-alpha,n-1),n-1,abs(du)/(s/sqrt(n))),'FaceColor',[.8,.8,.8]) hold on axes(handles.axes1) area(tinv(1-alpha,n-1):.01:5,tpdf(tinv(1-alpha,n-1):.01:5,n-1),'FaceColor',[1,.6,.78]) hold on axes(handles.axes1) plot(-5:.1:5,tpdf(-5:.1:5,n-1),'r') hold on axes(handles.axes1) plot(tinv(1-alpha,n-1)*ones(1,length(0:.01:ma)),0:.01:ma,'g','LineWidth',2) set(handles.text7,'Visible','on','String',['The critical t-value is ' num2str(tinv(1-alpha,n-1)) '. The red shaded area represents significance region (alpha) and blue shaded area represents 1-power (beta).']) elseif val==2 n2=str2num(get(handles.edit7,'String')); s2=str2num(get(handles.edit9,'String')); for n=40:42 p=0; n2=2; while psn(3) n=ns(1); n2=n2s(1); p=ps(1); elseif sn(1)==sn(2) && sn(2)==sn(3) n=ns(2); n2=n2s(2); p=ps(2); end set(handles.text2,'String',num2str(n),'Visible','on') set(handles.text1,'Visible','on','String','Samples in population 1') set(handles.text3,'Visible','on') set(handles.text4,'String',num2str(p),'Visible','on') set(handles.text5,'Visible','on','String','Samples in population 2') set(handles.text6,'String',num2str(n2),'Visible','on') ma=max(tpdf(-5:.1:5,n+n2-2)); if ma<=.4 ma=.4; elseif .41 ma=2; end hold off axes(handles.axes1) plot(-5:.1:5,nctpdf(-5:.1:5,n+n2-2,abs(du)/(sqrt(s^2/n+s2^2/n2)))) hold on axes(handles.axes1) area(-5:.01:tinv(1-alpha,n+n2-2),nctpdf(-5:.01:tinv(1-alpha,n+n2-2),n+n2-2,abs(du)/(sqrt(s^2/n+s2^2/n2))),'FaceColor',[.8,.8,.8]) hold on axes(handles.axes1) area(tinv(1-alpha,n+n2-2):.01:5,tpdf(tinv(1-alpha,n+n2-2):.01:5,n+n2-2),'FaceColor',[1,.6,.78]) hold on axes(handles.axes1) plot(-5:.1:5,tpdf(-5:.1:5,n+n2-2),'r') hold on axes(handles.axes1) plot(tinv(1-alpha,n+n2-2)*ones(1,length(0:.01:ma)),0:.01:ma,'g','LineWidth',2) set(handles.text7,'Visible','on','String',['The critical t-value is ' num2str(tinv(1-alpha,n+n2-2)) '. The red shaded area represents significance region (alpha) and blue shaded area represents 1-power (beta).']) elseif val==3 n=ceil(s^2*(norminv(1-alpha)+norminv(prob))^2/(abs(du)^2)); p=normcdf(sqrt(n)*abs(du)/s-norminv(1-alpha)); set(handles.text2,'String',num2str(n),'Visible','off') set(handles.text1,'Visible','off') set(handles.text3,'Visible','on') set(handles.text4,'String',num2str(p),'Visible','on') set(handles.text5,'Visible','on') set(handles.text6,'String',num2str(n),'Visible','on') ma=max(tpdf(-5:.1:5,n-1)); if ma<=.4 ma=.4; elseif .41 ma=2; end hold off axes(handles.axes1) plot(-5:.1:5,nctpdf(-5:.1:5,n-1,abs(du)/(s/sqrt(n)))) hold on axes(handles.axes1) area(-5:.01:tinv(1-alpha,n-1),nctpdf(-5:.01:tinv(1-alpha,n-1),n-1,abs(du)/(s/sqrt(n))),'FaceColor',[.8,.8,.8]) hold on axes(handles.axes1) area(tinv(1-alpha,n-1):.01:5,tpdf(tinv(1-alpha,n-1):.01:5,n-1),'FaceColor',[1,.6,.78]) hold on axes(handles.axes1) plot(-5:.1:5,tpdf(-5:.1:5,n-1),'r') hold on axes(handles.axes1) plot(tinv(1-alpha,n-1)*ones(1,length(0:.01:ma)),0:.01:ma,'g','LineWidth',2) set(handles.text7,'Visible','on','String',['The critical t-value is ' num2str(tinv(1-alpha,n-1)) '. The red shaded area represents significance region (alpha) and blue shaded area represents 1-power (beta).']) end elseif val==4 p1=str2num(get(handles.edit5,'String')); p0=str2num(get(handles.edit4,'String')); prob=str2num(get(handles.edit2,'String')); alpha=str2num(get(handles.edit3,'String')); n=ceil(p0*(1-p0)*(norminv(1-alpha)+norminv(prob)*sqrt(p1*(1-p1)/(p0*(1-p0))))^2/(p0-p1)^2); p=normcdf((sqrt(n)*abs(p0-p1)/(sqrt(p0*(1-p0)))-norminv(1-alpha))/sqrt(p1*(1-p1)/(p0*(1-p0)))); set(handles.text2,'String',num2str(n),'Visible','off') set(handles.text1,'Visible','off') set(handles.text3,'Visible','on') set(handles.text4,'String',num2str(p),'Visible','on') set(handles.text5,'Visible','on') set(handles.text6,'String',num2str(n),'Visible','on') elseif val==5 u1=str2num(get(handles.edit5,'String')); u0=str2num(get(handles.edit4,'String')); prob=str2num(get(handles.edit2,'String')); alpha=str2num(get(handles.edit3,'String')); s=str2num(get(handles.edit9,'String')); val=get(handles.popupmenu4,'Value'); if val==1 n=ceil(s^2*(norminv(1-alpha)+norminv(prob))^2/(u0-u1)^2); p=normcdf(abs(u0-u1)/(s/sqrt(n))-norminv(1-alpha)); elseif val==2 n=ceil(s^2*(norminv(1-alpha/2)+norminv(prob))^2/(u0-u1)^2); p=normcdf(abs(u0-u1)/(s/sqrt(n))-norminv(1-alpha/2)); end set(handles.text2,'String',num2str(n),'Visible','off') set(handles.text1,'Visible','off') set(handles.text3,'Visible','on') set(handles.text4,'String',num2str(p),'Visible','on') set(handles.text5,'Visible','on') set(handles.text6,'String',num2str(n),'Visible','on') end % --- Executes on button press in pushbutton2. %Calculate power function pushbutton2_Callback(hObject, eventdata, handles) % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) val=get(handles.popupmenu2,'Value'); axes(handles.axes1) cla set(handles.axes1,'Visible','off') if val==2 eps=str2num(get(handles.edit5,'String')); rho=str2num(get(handles.edit4,'String')); prob=str2num(get(handles.edit2,'String')); alpha=str2num(get(handles.edit3,'String')); k=str2num(get(handles.edit1,'String')); ss=str2num(get(handles.edit6,'String')); f=get(handles.popupmenu1,'Value'); if f==2 f2=.1^2; elseif f==3 f2=.25^2; elseif f==4 f2=.5^2; elseif f==5 fa=inputdlg('What would like f to be?'); fa=str2num(fa{1}); f2=fa^2; else f2=[]; end if isempty(k) & get(handles.checkbox1,'Value')==0 errordlg('Please either check ''Multiple Factors'' or enter number of treatments') return end if isempty(alpha)|isempty(f2) errordlg('Make sure you have selected significance level and Cohen''s effect size') return end if alpha>1 | alpha<0 errordlg('Significance level outside bounds') return end if get(handles.checkbox1,'Value')==0 if isempty(eps) & isempty(rho) p=1-ncfcdf(finv(1-alpha,(k-1),(ss-1)*k),k-1,(ss-1)*k,ss*k*f2); else if isempty(eps) eps=1; end if isempty(rho) rho=1; end p=1-ncfcdf(finv(1-alpha,eps*(k-1),eps*(ss-1)*(k-1)),eps*(k-1),eps*(ss-1)*(k-1),eps*ss*k*f2/(1-rho)); end else k=[]; answers=inputdlg('List number of treatments per factor (ex. If testing factor A with a levels while factor B is present with b levels, you would enter a,b)'); answers=answers{1}; count=1; while ~isempty(answers) [a,answers]=strtok(answers,','); k(count)=str2num(a); count=count+1; end k2=1; for i=1:length(k) k2=k(i)*k2; end p=1-ncfcdf(finv(1-alpha,(k(1)-1),(ss-1)*k2),k(1)-1,(ss-1)*k2,ss*k2*f2); end elseif val==3 val=get(handles.popupmenu3,'Value'); s=str2num(get(handles.edit5,'String')); du=str2num(get(handles.edit4,'String')); n=str2num(get(handles.edit6,'String')); alpha=str2num(get(handles.edit3,'String')); if alpha>1 | alpha<0 errordlg('Significance level outside bounds') return end if val==1 p=1-nctcdf(tinv(1-alpha,n-1),n-1,abs(du)/(s/sqrt(n))); elseif val==2 n2=str2num(get(handles.edit7,'String')); s2=str2num(get(handles.edit9,'String')); sp=sqrt(((n-1)*s^2+(n2-1)*s2^2)/(n+n2-2)); p=1-nctcdf(tinv(1-alpha,n+n2-2),n+n2-2,abs(du)/(sp*sqrt(1/n+1^2/n2))); elseif val==3 n2=str2num(get(handles.edit7,'String')); s2=str2num(get(handles.edit9,'String')); p=normcdf(sqrt(n)*abs(du)/s-norminv(1-alpha)); end elseif val==4 p1=str2num(get(handles.edit5,'String')); p0=str2num(get(handles.edit4,'String')); prob=str2num(get(handles.edit2,'String')); alpha=str2num(get(handles.edit3,'String')); n=str2num(get(handles.edit6,'String')); p=normcdf((sqrt(n)*abs(p0-p1)/(sqrt(p0*(1-p0)))-norminv(1-alpha))/sqrt(p1*(1-p1)/(p0*(1-p0)))); elseif val==5 u1=str2num(get(handles.edit5,'String')); u0=str2num(get(handles.edit4,'String')); prob=str2num(get(handles.edit2,'String')); alpha=str2num(get(handles.edit3,'String')); s=str2num(get(handles.edit9,'String')); n=str2num(get(handles.edit6,'String')); val=get(handles.popupmenu4,'Value'); if val==1 p=normcdf(abs(u0-u1)/(s/sqrt(n))-norminv(1-alpha)); elseif val==2 p=normcdf(abs(u0-u1)/(s/sqrt(n))-norminv(1-alpha/2)); end end set(handles.text3,'Visible','on') set(handles.text4,'String',num2str(p),'Visible','on') set(handles.text1,'Visible','off') set(handles.text2,'Visible','off') set(handles.text5,'Visible','off') set(handles.text6,'Visible','off') set(handles.text7,'Visible','off') function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit1 as text % str2double(get(hObject,'String')) returns contents of edit1 as a double % --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit2_Callback(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit2 as text % str2double(get(hObject,'String')) returns contents of edit2 as a double % --- Executes during object creation, after setting all properties. function edit2_CreateFcn(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit3_Callback(hObject, eventdata, handles) % hObject handle to edit3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit3 as text % str2double(get(hObject,'String')) returns contents of edit3 as a double % --- Executes during object creation, after setting all properties. function edit3_CreateFcn(hObject, eventdata, handles) % hObject handle to edit3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit4_Callback(hObject, eventdata, handles) % hObject handle to edit4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit4 as text % str2double(get(hObject,'String')) returns contents of edit4 as a double % --- Executes during object creation, after setting all properties. function edit4_CreateFcn(hObject, eventdata, handles) % hObject handle to edit4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit5_Callback(hObject, eventdata, handles) % hObject handle to edit5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit5 as text % str2double(get(hObject,'String')) returns contents of edit5 as a double % --- Executes during object creation, after setting all properties. function edit5_CreateFcn(hObject, eventdata, handles) % hObject handle to edit5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in popupmenu1. function popupmenu1_Callback(hObject, eventdata, handles) % hObject handle to popupmenu1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu1 % --- Executes during object creation, after setting all properties. function popupmenu1_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in checkbox1. function checkbox1_Callback(hObject, eventdata, handles) % hObject handle to checkbox1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of checkbox1 function edit6_Callback(hObject, eventdata, handles) % hObject handle to edit6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit6 as text % str2double(get(hObject,'String')) returns contents of edit6 as a double % --- Executes during object creation, after setting all properties. function edit6_CreateFcn(hObject, eventdata, handles) % hObject handle to edit6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over edit1. function edit1_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.edit1,'String','','Enable','on'); % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over edit1. function edit2_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.edit2,'String','','Enable','on'); % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over edit1. function edit3_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.edit3,'String','','Enable','on'); % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over edit1. function edit4_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.edit4,'String','','Enable','on'); % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over edit1. function edit5_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.edit5,'String','','Enable','on'); % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over edit1. function edit6_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.edit6,'String','','Enable','on'); % --- Executes on button press in pushbutton5. function pushbutton5_Callback(hObject, eventdata, handles) % hObject handle to pushbutton5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) warndlg('Alpha Value (ie. 0.05, 0.01, etc)','Significance level help') % --- Executes on button press in pushbutton6. function pushbutton6_Callback(hObject, eventdata, handles) % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) warndlg('1-Beta (ie. 0.9, 0.95, etc)','Power help') % --- Executes on button press in pushbutton7. function pushbutton7_Callback(hObject, eventdata, handles) % hObject handle to pushbutton7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) warndlg('Expected variation from H0=0. Calculated as (mean)/(standard deviation)','Effect size help') % --- Executes on button press in pushbutton8. function pushbutton8_Callback(hObject, eventdata, handles) % hObject handle to pushbutton8 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) val=get(handles.popupmenu2,'Value'); if val==2 warndlg('Sample size per cell (eg. if your total sample was 280 broken into 7 factors, enter 40)','Sample size help') elseif val==3 warndlg('Sample size in population', 'Sample size help') elseif val==4 warndlg('Sample size in population', 'Sample size help') elseif val==5 warndlg('Sample size in population', 'Sample size help') end % --- Executes on button press in pushbutton9. function pushbutton9_Callback(hObject, eventdata, handles) % hObject handle to pushbutton9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) val=get(handles.popupmenu2,'Value'); if val==2 warndlg('Relatedness of measures (ranges from 0 to 1)','Correlation help') elseif val==3 warndlg('Difference in sample mean from H0', 'Difference in means help') elseif val==4 warndlg('Estimated Proportion', 'Proportion 0 help') elseif val==5 warndlg('Hypothesis the test is comparing to', 'Hypothesis help') end % --- Executes on button press in pushbutton10. function pushbutton10_Callback(hObject, eventdata, handles) % hObject handle to pushbutton10 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) val=get(handles.popupmenu2,'Value'); if val==2 warndlg('Relation of variances between pairwise comparisons (Uses Greenhouse-Geisser correction)','Sphericity help') elseif val==3 warndlg('Sample standard deviation', 'Standard deviation help') elseif val==4 warndlg('Sample proportion', 'Proportion 1 help') elseif val==5 warndlg('Sample mean', 'Actual mean help') end % --- Executes on button press in pushbutton11. function pushbutton11_Callback(hObject, eventdata, handles) % hObject handle to pushbutton11 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) warndlg('Number of treatment groups. Not sample size.','Number of treatments help') % --- Executes on selection change in popupmenu3. function popupmenu3_Callback(hObject, eventdata, handles) % hObject handle to popupmenu3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) val=get(handles.popupmenu3,'Value'); if val==1 set(handles.edit6,'Visible','on','String','Samples used','Enable','off') set(handles.edit7,'Visible','off','String','Samples in second population','Enable','off') set(handles.edit5,'Visible','on','String','Standard deviation','Enable','off') set(handles.edit9,'Visible','off','String','Standard deviation 2','Enable','off') elseif val==2 set(handles.edit6,'Visible','on','String','Samples in first population','Enable','off') set(handles.edit7,'Visible','on','String','Samples in second population','Enable','off') set(handles.edit5,'Visible','on','String','Standard deviation 1','Enable','off') set(handles.edit9,'Visible','on','String','Standard deviation 2','Enable','off') elseif val==3 set(handles.edit6,'Visible','on','String','Samples in first population','Enable','off') set(handles.edit7,'Visible','off','String','Samples in second population','Enable','off') set(handles.edit5,'Visible','on','String','Standard deviation of differences','Enable','off') set(handles.edit9,'Visible','off','String','Standard deviation 2','Enable','off') end % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu3 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu3 % --- Executes during object creation, after setting all properties. function popupmenu3_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function edit7_Callback(hObject, eventdata, handles) % hObject handle to edit7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit7 as text % str2double(get(hObject,'String')) returns contents of edit7 as a double % --- Executes during object creation, after setting all properties. function edit7_CreateFcn(hObject, eventdata, handles) % hObject handle to edit7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over edit7. function edit7_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to edit7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.edit7,'String','','Enable','on'); function edit9_Callback(hObject, eventdata, handles) % hObject handle to edit9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit9 as text % str2double(get(hObject,'String')) returns contents of edit9 as a double % --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, eventdata, handles) % hObject handle to edit9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- If Enable == 'on', executes on mouse press in 5 pixel border. % --- Otherwise, executes on mouse press in 5 pixel border or over edit9. function edit9_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to edit9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.edit9,'String','','Enable','on'); % --- Executes on selection change in popupmenu4. function popupmenu4_Callback(hObject, eventdata, handles) % hObject handle to popupmenu4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu4 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu4 % --- Executes during object creation, after setting all properties. function popupmenu4_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in pushbutton12. function pushbutton12_Callback(hObject, eventdata, handles) % hObject handle to pushbutton12 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) val=get(handles.popupmenu2,'Value'); if val==2 elseif val==3 elseif val==4 elseif val==5 warndlg('Sample standard deviation', 'Standard deviation help') end