coding of statistics software

Upload: qanitazakir

Post on 06-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Coding of Statistics Software

    1/21

    Statistics & Probability Qanita Zakir

    1|P a g e

    Jinnah University for Women

  • 8/3/2019 Coding of Statistics Software

    2/21

    Statistics & Probability Qanita Zakir

    2|P a g e

    Jinnah University for Women

    TableofContentsAcknowledgements: .................................................................................................................... 3Abstract: ..................................................................................................................................... 3Requirement engineering: ........................................................................................................... 3

    FeasibilityStudies:.................................................................................................................................... 3Elicitationandanalysis.............................................................................................................................. 3

    ForUngroupedData:............................................................................................................................ 3ForGroupedData:................................................................................................................................ 3

    Ungrouped Data program ........................................................................................................... 5Grouped Data program ............................................................................................................. 12

    References ............................................................................................................................... 21

  • 8/3/2019 Coding of Statistics Software

    3/21

    Statistics & Probability Qanita Zakir

    3|P a g e

    Jinnah University for Women

    Acknowledgements:The students of BS(IT) 2010 and our teacher Miss Saima assigned us to prepare a software that

    performs statistical calculations and automate the generation of frequency distribution table. We

    were given freedom of choice. This software mainly focuses grouped data but it can also performcalculations regarding ungrouped data

    Thanks to Miss Saima who has taught us Statistics in this semester, Miss Sana Mehdi who has

    taught us programming, Miss Narmeen Shawoo Bawani for her utmost effort in present

    algorithms.

    Thanks also to my parents and siblings who supported me when I was preparing this report.

    Abstract:This software automates the statistical calculations and help user in giving quick and accurate

    answers.

    This software can calculate Arithmetic Mean, Geometric Mean, Harmonic Mean, Median and

    Mode for Grouped and Ungrouped Data. Not only that, it can also calculate Variance, Standard

    Deviation, Co-efficient of Variance, Mean Deviation about Mean and Median and Quartile

    Deviations for Grouped Data

    Requirement engineering:Feasibility Studies:

    Ungrouped Data only works for integer raw data. Useful for every technical or non-technical Statistics student. Can be used even in outdated computers. No as such hardware requirements.

    Elicitation and analysisFor Ungrouped Data:

    1.2.3.4.5.

    For Grouped Data:1.

  • 8/3/2019 Coding of Statistics Software

    4/21

    Statistics & Probability Qanita Zakir

    4|P a g e

    Jinnah University for Women

    2.3.4.5.6.7.8.9.10.11.12.13.

  • 8/3/2019 Coding of Statistics Software

    5/21

    Statistics & Probability Qanita Zakir

    5|P a g e

    Jinnah University for Women

    Ungrouped Data programinclude //header files#include#include#include#include#includevoid getdata(); //takes input from the uservoid sorting(); //arranging the values in ascending ordervoid printlist(); //prints the listvoid printtable(void); //prints the frequency distribution tableint location(int,int*, int);void calculation(void); //calculates Frequency, Cumulative frequency etcint no_of_classes(); //number of classes to be made with an intervalint maximum(int *);int minimum(int *);void classboundry(int); //calculating class boundriesvoid classinterval(int ); //calculating class intervalsvoid midpoint(int); //calculating mid pointsvoid frequency(int ); //calculating frequencyvoid relativefrequency(int ); //calculating relative frequencyvoid cumulativefrequency(int ); //calculating cumulative frequencyvoid FD(); //frequency distributionvoid arithmetic(); //calculates AMvoid harmonic(); //calculates HMvoid geometric(); //calculates GMvoid mode(); //calculates Modevoid median(); //calculates Medianstruct ClassBoundry{float lowest;float highest;};struct ClassInterval{float lowest;float highest;};int list[100]={(int)NULL}; //array of dataint max=(int)NULL; //no of raw figures availableint LB=(int)NULL; //declarations of Lowest boundryint h=(int)NULL;int n=(int)NULL;double AM, HM, GM, Mode, Median;struct ClassBoundry CB[100]={(float)NULL,(float)NULL};struct ClassInterval CI[100]={(int)NULL,(int)NULL};float Midpoint[100]={(float)NULL};float RF[100]={(float)NULL};int F[100]={(int)NULL};int CF[100]={(int)NULL};int main() //main program{clrscr(); //clear the screenint will=1, opchoice=0;

  • 8/3/2019 Coding of Statistics Software

    6/21

    Statistics & Probability Qanita Zakir

    6|P a g e

    Jinnah University for Women

    char YN;while(will==1){clrscr();getdata(); //get data from the userclrscr();printlist(); //printing the list after sortinggetch();opchoice=0;while(opchoice!=7){clrscr(); //clearing the screencout

  • 8/3/2019 Coding of Statistics Software

    7/21

    Statistics & Probability Qanita Zakir

    7|P a g e

    Jinnah University for Women

    r=1;while(r

  • 8/3/2019 Coding of Statistics Software

    8/21

    Statistics & Probability Qanita Zakir

    8|P a g e

    Jinnah University for Women

    cout

  • 8/3/2019 Coding of Statistics Software

    9/21

    Statistics & Probability Qanita Zakir

    9|P a g e

    Jinnah University for Women

    classinterval(a+1);}//--------------------------------------------------------------function-------------------------------------------------------------------------------void midpoint(int a){if(a

  • 8/3/2019 Coding of Statistics Software

    10/21

    Statistics & Probability Qanita Zakir

    10|P a g e

    Jinnah University for Women

    int maximum(int list1[]){int maxn=list1[0];for(int loop=0;loopmaxn)maxn=list1[loop];return maxn;}//--------------------------------------------------------------function-------------------------------------------------------------------------------int minimum(int list1[]){int minn=list1[0];for(int loop=0;loop

  • 8/3/2019 Coding of Statistics Software

    11/21

    Statistics & Probability Qanita Zakir

    11|P a g e

    Jinnah University for Women

    //--------------------------------------------------------------function-------------------------------------------------------------------------------void mode(){int maxn;int fre[100];int counter,loc;for(int a=0;a

  • 8/3/2019 Coding of Statistics Software

    12/21

    Statistics & Probability Qanita Zakir

    12|P a g e

    Jinnah University for Women

    Grouped Data program#include //header files#include#include#include#include#includevoid get_grouped_data(); //This function takes input of frequency from theuservoid printtable(void); //prints the frequency distribution tableint location(float, float*, int); //find out the location of given frequencyvoid FD(); //frequency distributionvoid calculation(void); //calculates Frequency, Cumulative frequency etcint no_of_classes(); //number of classes to be made with an intervalfloat maximum(float*); //find out maximum no in a given listvoid classboundry(int); //calculating class boundriesvoid classinterval(int ); //calculating class intervalsvoid midpoint(int); //calculating mid pointsvoid frequency(int ); //calculating frequencyvoid relativefrequency(int ); //calculating relative frequencyvoid cumulativefrequency(int ); //calculating cumulative frequencyvoid arithmetic(); //calculates AMvoid harmonic(); //calculates HMvoid geometric(); //calculates GMvoid mode(); //calculates Modevoid median(); //calculates Medianvoid sdeviation(); //calculates Standard Deviationvoid variance(); //calculates Variancevoid qdeviation();void mdeviation();struct ClassBoundry{float lowest;float highest;};struct ClassInterval{float lowest;float highest;};float LI=(float)NULL, diff=(float)NULL; //declarations of Lowest Interval and difference//for classes 110-119,120-129 diff=120-119=1int n=(int)NULL; //class interval, number of classesfloat h=(float)NULL;float AM, HM, GM, Mode, Median, Var, SD, Q,MD,C;float sumfx,sumflogx,sumf_x, sum,sumfxMD, sumfxAM; //summation of fx, flogx, 1/fx, fstruct ClassBoundry CB[100]={(float)NULL,(float)NULL};struct ClassInterval CI[100]={(float)NULL,(float)NULL};float Midpoint[100]={(float)NULL};float RF[100]={(float)NULL};float F[100]={(float)NULL};float CF[100]={(float)NULL};float fx[100]={(float)NULL};float flogx[100]={(float)NULL};float f_x[100]={(float)NULL};float fxMD[100]={(float)NULL};float fxAM[100]={(float)NULL};

  • 8/3/2019 Coding of Statistics Software

    13/21

    Statistics & Probability Qanita Zakir

    13|P a g e

    Jinnah University for Women

    int main() //main program{clrscr(); //clear the screenint will=1, opchoice=(int)NULL; //whileloop variable, choice of operation e.g 1 forAMchar YN; //stores y if user wants to enter main menuwhile(will==1){clrscr(); //clearing the screencout

  • 8/3/2019 Coding of Statistics Software

    14/21

    Statistics & Probability Qanita Zakir

    14|P a g e

    Jinnah University for Women

    void get_grouped_data(){cout

  • 8/3/2019 Coding of Statistics Software

    15/21

    Statistics & Probability Qanita Zakir

    15|P a g e

    Jinnah University for Women

    cout

  • 8/3/2019 Coding of Statistics Software

    16/21

    Statistics & Probability Qanita Zakir

    16|P a g e

    Jinnah University for Women

    RF[a]=F[a];RF[a]=RF[a]/sum;}else return;relativefrequency(a+1);}//--------------------------------------------------------------function-------------------------------------------------------------------------------void cumulativefrequency(int a){if(a

  • 8/3/2019 Coding of Statistics Software

    17/21

    Statistics & Probability Qanita Zakir

    17|P a g e

    Jinnah University for Women

    //--------------------------------------------------------------function-------------------------------------------------------------------------------void harmonic(){for(int a=0;a

  • 8/3/2019 Coding of Statistics Software

    18/21

    Statistics & Probability Qanita Zakir

    18|P a g e

    Jinnah University for Women

    cout

  • 8/3/2019 Coding of Statistics Software

    19/21

    Statistics & Probability Qanita Zakir

    19|P a g e

    Jinnah University for Women

    }cout

  • 8/3/2019 Coding of Statistics Software

    20/21

    Statistics & Probability Qanita Zakir

    20|P a g e

    Jinnah University for Women

    cout

  • 8/3/2019 Coding of Statistics Software

    21/21

    Statistics & Probability Qanita Zakir

    21|P a g e

    }}//--------------------------------------------------------------function-------------------------------------------------------------------------------int location(float item, float* list1, int loop){int loc=(int)NULL;for(int a=0;a