DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Linear Regression with limits

I have a data set that is plotted with X Axis = Load(kg) (range 100kg to 1500kg) and Y Axis = Wheel Z Height Displacement (mm) (range -75mm to +100mm).  Is there a way to limit a linear regression to the data range of -20mm to +20mm or 20% to 80% of the Y values on the Y axis?  Would it be best to create a data set that was only in the desired range and do the regression on the reduced data set?  If that is the case what would be a good way to copy the reduced data set to a new channel?
 
Thanks,
 
Wayne
0 Kudos
Message 1 of 4
(3,885 Views)

Hi Wayne,

As far as I know, the only way to limit the regression is to filter the data channel so that the undesired values are set to NoValues or deleted.  You could use a Calculator expression to do this quite easily-- let me know if you need assistance with that.  The result of the Calculator execution could be a new filtered channel or the same channel with edited values.

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 4
(3,871 Views)

I think I have an idea as to what to do.  I still need to retain the integrity of the original data, therefore I will be creating new channels. 

In a script you could do a loop looking for a value that is within the range then copy that data set to the new channel.  Are there any builtin commands that would make this process quicker or more streamlined?  All I know to do is to look at each value with CHD and make the decision from there. 

Thanks,

Wayne

0 Kudos
Message 3 of 4
(3,866 Views)

Hi Wayne,

For this use case I'm going to recommend the old FormulaCalc() function and syntax instead of the newer ChnCalculate():

R1 = -0.5 ' lower Y threshold
R2 = 1.5  ' upper Y threshold
L1 = CNo("[2]/Noise_3") ' raw data channel
Call FormulaCalc("Ch('Fit Data'):= Ch(L1) + NoValue*(Ch(L1)<R1) + NoValue*(Ch(L1)>R2)")

Ask if you have additional questions,
Brad Turpin
Product Support Engineer
National Instruments

0 Kudos
Message 4 of 4
(3,851 Views)