T O P I C R E V I E W |
zknauss |
Posted - 07/28/2022 : 11:49:41 AM Hello, I am trying to put together a script to auto run linear fit and regression analysis. I have already have a user defined templet for the linear fit dialog but due to our data requirements we've been finding this route to be very time consuming. I have included below a rough outline of what I think the script could look like with the first set on input and output designations. The issue I'm having is how to set it up so that it 1. loops through each independent x,y set on the reference worksheets and 2. so that two outputs are created one which is set for further analysis and the other a final version that can be used in the final publication and includes fitted curves and residual plots. I've included below an example of the file paths I'd like them saved under as well as examples of the input data and of each of the outputs that I need. I know this is a rather large fuction to code so thanks in advance for any help.
//--Linear fit with regression analysis and two outputs--
//Navigate to the book/output worksheet sheet //pe_cd path:="/"; //pe_cd path:="/25MINCONTROL/NEUO/PeakData/N_CON_T1/"; //win -a NCONT1Peak; page.active$ = Frequency_N_CON_T1;
//Set up fitting loop (example using Fit LR) and create a results tree //FitLR doesn't seem to have all of the outputs I need //LCL and UCL should be set to 99.5 not 99 as in the examples //Y and X are independent but should be in a consolidated report for (int i = 2; i <= wks.ncols; i++ ){ //Y-values See example worksheets range aa = [NCONT1Peak]"CenterMax"!$(i); //X-values See example worksheets range bb = [NCONT1Peak]"Peak Index"!$(i); FitLR iy:=(bb,aa)
//first output: Worksheet formatted for further analysis //path:="/25MINCONTROL/NEUO/Peak Data/N_CON_T1/"; //Sheet to append output:[NCONT1Peak]"Frequency_N_CON_T1" //outputs should start in column 2 with labels in column 1 //row 1 already has a calculated values so enteries should start in //row 2 (See example output worksheet) wcol(i)[2]$ = $; //Number of Points wcol(i)[3]$ = $; //Degrees of Freedom wcol(i)[4]$ = $; //Reduced Chi-Sqr wcol(i)[5]$ = $; //Residual Sum of Squares wcol(i)[6]$ = $; //Pearson's r wcol(i)[7]$ = $; //R-Square (COD) wcol(i) $ = $; //Adj. R-Square wcol(i)[9]$ = $; //Root-MSE (SD) wcol(i)[10]$ = $; //slope or Inter event time wcol(i)[11]$ = $; //Standard Error wcol(i)[12]$ = $; //t-Value wcol(i)[13]$ = $; //Prob>|t| wcol(i)[14]$ = $; //99.5% LCL wcol(i)[15]$ = $; //99.5% UCL
// 2nd output: Report Sheet formatted for publication //path:="/Updated template 7_27_22/25MIN CONTROL/NEUO/Peak //Data/2_Statistics_N_CON/Within T/"; //Book to output:[StatsT1] new report sheet name:"<new //name:=Frequency_N_CON_T1>" }
https://my.originlab.com/ftp/forum_and_kbase/Images/Input%20Examples.ziphttps://my.originlab.com/ftp/forum_and_kbase/Images/Report%20Sheet%20Example.ziphttps://my.originlab.com/ftp/forum_and_kbase/Images/Worksheet%20Output%20Example.ogwu
ZTK |
3 L A T E S T R E P L I E S (Newest First) |
zknauss |
Posted - 07/29/2022 : 1:51:48 PM Would it be possible in script to call the GUI with a defined user template and run it that way?
I'm also running into this issue with ANOVAS each statistical test needs to be run dozens of times.
ZTK |
zknauss |
Posted - 07/29/2022 : 11:17:42 AM unfortunately batch will not work as this is a intermediate step of a much larger analysis and we'd prefer not to go the route of an inflexible analysis templet.
ZTK |
Shirley_GZ |
Posted - 07/29/2022 : 03:38:18 AM Hi ZTK,
I think the Batch Processing tool can handle this task well. Once you created an analysis template and arrange your input data into one worksheet, you don't need write the script lines, but just use the Batch Processing tool, you can get the summary result sheet as you desired.
https://www.originlab.com/doc/Origin-Help/Batch-Processing https://www.originlab.com/doc/Tutorials/Batch-Processing
https://www.originlab.com/index.aspx?go=PRODUCTS/Origin#For_Analysis https://www.originlab.com/videos/details.aspx?id=130
Thanks, Shirley OriginLab
Originlab Technical Service Team |