Exemplo n.º 1
0
 // 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();
     }
 }
Exemplo n.º 2
0
        // response variable transform PowerT
        private void PowerT(object o, EventArgs e)
        {
            dgvObs.EndEdit();
            DataTable _dt = (DataTable)dgvObs.DataSource;
            DataTable _dtCopy = _dt.Copy();
            if (_dt == null) return;
            dtObsOrig = _dt;

            frmPowerExponent frmExp = new frmPowerExponent(_dt, 1);
            DialogResult dlgr = frmExp.ShowDialog();
            if (dlgr != DialogResult.Cancel)
            {
                double[] dblNewvals = new double[_dt.Rows.Count];
                dblNewvals = frmExp.TransformedValues;
                if (frmExp.TransformMessage != "")
                {
                    MessageBox.Show("Cannot Power transform variable. " + frmExp.TransformMessage, "VB Transform Rule", MessageBoxButtons.OK);
                    return;
                }

                boolObsTransformed = true;
                string strSexp = frmExp.Exponent.ToString("n2");
                for (int i = 0; i < _dtCopy.Rows.Count; i++)
                {
                    _dtCopy.Rows[i][1] = dblNewvals[i];
                }

                DataColumn dc = _dtCopy.Columns["Observation"];
                dc.ColumnName = "POWER[" + strSexp+ ",Observation]";
                dgvObs.DataSource = _dtCopy;
            }
        }
Exemplo n.º 3
0
        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();
            }
        }