graph customizing - Statistica Visual Basic - Statistica - Dell Community

graph customizing

graph customizing

This question is not answered

Hi guys,

I have a problem regarding customizing graph but since I'm new to Statistica i thought you might help me. I have few time series and I need to make a box and whisker plot with mean values as middle point and standard deviation as whiskers. This part is clear to me and I have no problem with that, but I also have to subtract certain value from those mean values which I don't know how to do. I tried something with macros after making a plot, but failed to do anything. Here's what shows up when I open macro after choosing in graph window what I want to do. Hope you'll be able to solve this problem of mine.

Regards,

Jerko

 

Sub Main

    Dim newanalysis As Analysis
    Set newanalysis = Analysis (sc2dBoxPlots, ActiveDataSet)
    Dim oGD1 As BoxPlot2D - 127,5
    Set oGD1 = newanalysis.Dialog

    oGD1.DependentVariable = "2 3 4 5"
    oGD1.GraphType = scBox2DWhiskers
    oGD1.FitType = scFitOff
    oGD1.BoxMode = scBoxMultipleMode
    oGD1.MiddlePointValue = scBoxMidPointMean
    oGD1.MiddlePointStyle = scBoxMidPoint
    oGD1.MiddlePointPooledVariance = False
    oGD1.MultipleBoxLayout = scMultiPlotOverlaid
    oGD1.TrimDistribExtremes = 0
    oGD1.ConnectMiddlePoint = True
    oGD1.ShowRawData = False
    oGD1.Jitter = scJitterOff
    oGD1.JitterWidth = 50
    oGD1.MeanBoxValue = scMeanBoxStdError
    oGD1.MeanWhiskerValue = scMeanWhiskerStdDev
    oGD1.Outliers = scBoxOutlierOff
    oGD1.OutliersCoefficient = 1.5
    oGD1.DisplayFTestAndP = False
    oGD1.DisplayKruskalWallisTest = False
    oGD1.BoxCoefficient(scBoxMidPointMean) = 1
    oGD1.WhiskerCoefficient(scBoxMidPointMean) = 1
    
    
    With oGD1.Intervals
        .EnableCategory = True
        .CategoryType = scUniqueValues
        .Variable = "1"
        .CatUniqueSort = CatUnsorted
    End With
    
    
    With oGD1.CategoryOne
        .EnableCategory = False
    End With
    
    
    With oGD1.CategoryTwo
        .EnableCategory = False
    End With
    
    
    With oGD1.Options
        .DisplayDefaultTitle = True
        .TitlePosition = scTitleTop
        .Title = ""
        .DisplayDefaultFootnote = False
        .Footnote = ""
        .DisplayCaseLabels = scCaseLabelSpreadsheet
        .DisplayCaseLabelsOnOff = False
        .CaseLabelsVariable = "1"
        .DisplayTextValuesAsAxisValues = True
        .CoordinateSystem = scCoordinateStandard
        .XYAxisPosition = scAxisStandard
        .DisplayFitExpressionInTitle = scFitOptionInTitle
        .PolynomialOrder = scQuadraticOrder
        .LogBase = scLogOptionTenBase
        .DisplayProgressBar = True
        .RandomSampling = False
        .RandomSamplingMethod = scByNumberOfCase
        .RandomSamplingSubsetSize = 1
        .AxisType(scX) = scLinearScale
        .AxisType(scY) = scLinearScale
        .AxisType(scZ) = scLinearScale
        .AxisType(scV) = scLinearScale
        .AutoUpdateType = scSpreadsheetUpdate
        .SpreadSheetUpdateMethod = scAuto
        .UpdateFromDialogWhenDataChanged = True
    End With
    
    
    newanalysis.RouteOutput(oGD1.Graphs).Visible = True
    
    
    
End Sub

 

 

All Replies
  • instead of trying to subtract a value from the mean in a mean plot, I would make a new column in the input data spreadsheet where I subtract off this value from all observations. then make a mean plot of the new column. this is effectively the same thing.

  • i thought of that, too, but that's not what i need. you obviously didn't completely understand my problem, but thanks anyway.

  • Hi, Jerry,

    I'm not quite certain what you're trying to do, but if all you need is to capture the mean values for the box and whisker plots, the recorded basic statistics macro below may be helpful.  It outputs just the mean values for the measurement variables grouped by the grouping variable selected into a single spreadsheet.  You should find it fairly simple to incorporate this code into the box and whisker plot macro that you're trying to write.  Because of the 'black-box' nature of the box and whisker plot analysis and graph objects, it's not possible to grab this information directly.  However, the basic statistics macro generates identical mean values.

    I do hope that you find this information helpful.

    Neptune,

    God of Water and the Sea, Ruler of the Briny Deep and All Creatures Dwelling Therein


    '#Language "WWB-COM"
    Option Base 1
    Option Explicit
    Sub Main
     ' Macro recorded on 11/30/2012 3:23:10 PM
     Dim AO As AnalysisOutput
     Dim AWB As Workbook

     Dim S1 As Spreadsheet
     Set S1 = ActiveDataSet

     Dim newanalysis2 As Analysis
     Set newanalysis2 = Analysis (scBasicStatistics, S1)
     Dim oStaDocs2 As StaDocuments

     Dim oAD1 As STABasicStatistics.BasStartup
     Set oAD1 = newanalysis2.Dialog
     oAD1.Statistics = scBasDescriptives

     newanalysis2.Run
     newanalysis2.ByGroupEnabled = True
     newanalysis2.ByGroupVariables = " 1"
     newanalysis2.ByGroupOutputToSingleFolder = True
     newanalysis2.ByGroupOutputAllGroupsResults = False
     newanalysis2.ByGroupAccumulateTabularResults = True


     Dim oAD2 As STABasicStatistics.BasDescriptiveStatistics
     Set oAD2 = newanalysis2.Dialog
     oAD2.Variables = "2-5"
     oAD2.PairwiseDeletionOfMD = True
     oAD2.DisplayLongVariableNames = False
     oAD2.ExtendedPrecisionCalculations = False
     oAD2.PlotMedianQuartileRange = False
     oAD2.PlotMeanSEAndSD = False
     oAD2.PlotMeanSD196TimesSD = True
     oAD2.PlotMeanSE196TimesSE = False
     oAD2.UserDefinedPercentiles = False
     oAD2.ValidN = False
     oAD2.PercentOfValidObservation = False
     oAD2.Mean = True
     oAD2.Median = False
     oAD2.Mode = False
     oAD2.GeometricMean = False
     oAD2.HarmonicMean = False
     oAD2.ConfLimitsForMeans = False
     oAD2.ConfLimitsForSD = False
     oAD2.TrimmedMean = False
     oAD2.WinsorizedMean = False
     oAD2.GrubbsTest = False
     oAD2.Sum = False
     oAD2.StandardDeviation = False
     oAD2.CoefficientofVariation = False
     oAD2.Variance = False
     oAD2.StandardErrorOfMean = False
     oAD2.MinimumMaximum = False
     oAD2.LowerUpperQuartiles = False
     oAD2.Range = False
     oAD2.QuartileRange = False
     oAD2.Skewness = False
     oAD2.Kurtosis = False
     oAD2.StandardErrorOfSkewness = False
     oAD2.StandardErrorOfKurtosis = False
     oAD2.UseNumberOfIntervals = True
     oAD2.NumberOfIntervals = 10
     oAD2.NormalExpectedFrequencies = False
     oAD2.KSAndLillieforsTestForNormality = True
     oAD2.ShapiroWilkWTest = False
     oAD2.ConfidenceIntervalForMeansPlot = 95
     oAD2.CompressedStemAndLeaf = False

     Set oStaDocs2 = oAD2.Summary
     Set AO = newanalysis2.RouteOutput(oStaDocs2)
     AO.Visible = True
     If AO.HasWorkbook Then
      Set AWB = AO.Workbook
     Else
      Set AWB = Nothing
     End If
     Set oStaDocs2 = Nothing


    End Sub

  • thank you Neptune for your effort, but i'm not quite sure this will work for me. obviously i didn't express myself quite well, but since i'm from croatia my english is limited. i don't have a problem with this basic statistics part, but with making a graph out of it.  i have to translate all mean values for a certain value. basically, although incorect to write like this, this is what i need:

    scBoxMidPointMean-N

     

    thank you one more time for your effort,

    jerry

     

  • Hi, Jerry,

    So if I read you correctly, you need the Box Plot Mid Points to be the variable mean value minus some constant, correct? Do you also need the whiskers offset by the same (or a different) value?

    Neptune,

    God of Water and the Sea, Ruler of the Briny Deep and All Creatures Dwelling Therein

  • i think you understood it correctly now. whiskers should represent standard deviation without any offsets, so just standard deviation of original data.

     

    Jerry

  • Hi, Jerry,

    As Lt. Columbo used say, "Just one more thing...."  What version of STATISTICA are you using?  V8, V9, etc.?  This may actually be the most important question.

    Neptune,

    God of Water and the Sea, Ruler of the Briny Deep and All Creatures Dwelling Therein

  • i have version 8, and trial version of STATISTICA 10

     

    Jerry