// response variable transform natural log public void lnT(object o, EventArgs e) { double[] newvals = new double[dt.Rows.Count]; string newcolname = "LN[" + dt.Columns[intSelectedColIndex].Caption + "]"; performTOperation(dt, newcolname, intSelectedColIndex, newvals); dt.Columns[newcolname].ExtendedProperties[VBCommon.Globals.DEPENDENTVARIBLEDEFINEDTRANSFORM] = VBCommon.DependentVariableTransforms.Ln.ToString(); depVarTransform = VBCommon.DependentVariableTransforms.Ln; state = dtState.dirty; NotifyContainer(); }
// response variable transform power(exp) public void powerT(object o, EventArgs e) { frmPowerExponent frmExp = new frmPowerExponent(dt, intSelectedColIndex); DialogResult dlgr = frmExp.ShowDialog(); if (dlgr != DialogResult.Cancel) { double[] newvals = new double[dt.Rows.Count]; newvals = frmExp.TransformedValues; if (frmExp.TransformMessage != "") { MessageBox.Show("Cannot Power transform variable. " + frmExp.TransformMessage, "VB Transform Rule", MessageBoxButtons.OK); return; } string sexp = frmExp.Exponent.ToString("n2"); string newcolname = "POWER" + "[" + sexp + "," + dt.Columns[intSelectedColIndex].Caption + "]"; performTOperation(dt, newcolname, intSelectedColIndex, newvals); dt.Columns[newcolname].ExtendedProperties[VBCommon.Globals.DEPENDENTVARIBLEDEFINEDTRANSFORM] = VBCommon.DependentVariableTransforms.Power.ToString() + "," + sexp; depVarTransform = VBCommon.DependentVariableTransforms.Power; dblPowerTransformExp = Convert.ToDouble(sexp); state = dtState.dirty; NotifyContainer(); } }
public void defineTransformForRV(object o, EventArgs e) { //menu response from right click, determine which transform was selected MenuItem mi = (MenuItem)o; string transform = mi.Text; if (transform == VBCommon.DependentVariableTransforms.Power.ToString()) { frmPowerExponent frmExp = new frmPowerExponent(dt, intSelectedColIndex); DialogResult dlgr = frmExp.ShowDialog(); if (dlgr != DialogResult.Cancel) { string sexp = frmExp.Exponent.ToString("n2"); transform += "," + sexp; depVarTransform = VBCommon.DependentVariableTransforms.Power; dblPowerTransformExp = Convert.ToDouble(sexp); dt.Columns[intSelectedColIndex].ExtendedProperties[VBCommon.Globals.DEPENDENTVARIBLEDEFINEDTRANSFORM] = transform; state = dtState.dirty; NotifyContainer(); } } else { if (String.Compare(transform, "Log10", true) == 0) depVarTransform = VBCommon.DependentVariableTransforms.Log10; else if (String.Compare(transform, "Ln", true) == 0) depVarTransform = VBCommon.DependentVariableTransforms.Ln; else if (String.Compare(transform, "none", true) == 0) depVarTransform = VBCommon.DependentVariableTransforms.none; dt.Columns[intSelectedColIndex].ExtendedProperties[VBCommon.Globals.DEPENDENTVARIBLEDEFINEDTRANSFORM] = transform; state = dtState.dirty; NotifyContainer(); } }