segunda-feira, 5 de junho de 2023

Exercícios:

 Exercícios:


Enviar os exercícios para o e-mail da disciplina.

E-Mail da Disciplina:

gestao.estat.cert@gmail.com


 

Exercício 1 A – Obrigatório

Satisfação do Cliente com Numero USP em sinais de interrogação (Rodar em SAS - Weka - Libre Office). DL: 22/5/2023

 

Bu_Unit

Sales

Price

Qu_level

Claims

NPS

PV

Satisfac

1

65,??108

97,??22

96,??419

13,??025

98,??11

19

97,??609

2

15,8371

98,9011

98,3871

12,34568

97,8022

29

98,91304

3

8,885232

100

100

11,11111

100

21

100

4

12,46401

98,9011

95,16129

12,34568

96,7033

94

96,73913

5

80,66639

21,97802

19,35484

100

2,197802

34

21,73913

6

32,16783

23,07692

22,58065

97,53086

3,296703

64

23,91304

7

23,44714

24,17582

24,19355

96,2963

2,747253

61

25

8

89,96298

24,17582

19,35484

95,06173

2,197802

25

26,08696

9

31,4274

64,83516

56,45161

50,61728

65,93407

10

65,21739

10

11,22995

65,93407

51,6129

49,38272

71,42857

3

66,30435

11

77,45784

70,32967

53,22581

46,91358

63,73626

56

68,47826

12

23,89963

68,13187

51,6129

45,67901

61,53846

4

67,3913

13

7,40436

86,81319

80,64516

25,92593

90,10989

90

86,95652

14

0,287947

87,91209

79,03226

24,69136

85,71429

48

85,86957

15

83,42246

87,91209

77,41935

22,22222

90,10989

78

88,04348

16

100

86,81319

75,80645

25,92593

84,61538

88

84,78261

 


@RELATION Customer

@ATTRIBUTE U_Neg REAL

@ATTRIBUTE Vendas REAL

@ATTRIBUTE Preco REAL

@ATTRIBUTE Niv_Qual REAL

@ATTRIBUTE Reclama REAL

@ATTRIBUTE NPS REAL

@ATTRIBUTE Satisf REAL

@DATA

1,65.??107775,97.??21978,96.??419355,13.??024691,98.??10989,97.??608696

2,15.83710407,98.9010989,98.38709677,12.34567901,97.8021978,98.91304348

3,8.885232415,100,100,11.11111111,100,100

4,12.46400658,98.9010989,95.16129032,12.34567901,96.7032967,96.73913043

5,80.66639243,21.97802198,19.35483871,100,2.197802198,21.73913043

6,32.16783217,23.07692308,22.58064516,97.5308642,3.296703297,23.91304348

7,23.44714109,24.17582418,24.19354839,96.2962963,2.747252747,25

8,89.9629782,24.17582418,19.35483871,95.0617284,2.197802198,26.08695652

9,31.42739613,64.83516484,56.4516129,50.61728395,65.93406593,65.2173913

10,11.22994652,65.93406593,51.61290323,49.38271605,71.42857143,66.30434783

11,77.45783628,70.32967033,53.22580645,46.91358025,63.73626374,68.47826087

12,23.89962978,68.13186813,51.61290323,45.67901235,61.53846154,67.39130435

13,7.404360346,86.81318681,80.64516129,25.92592593,90.10989011,86.95652174

14,0.287947347,87.91208791,79.03225806,24.69135802,85.71428571,85.86956522

15,83.42245989,87.91208791,77.41935484,22.22222222,90.10989011,88.04347826

16,100,86.81318681,75.80645161,25.92592593,84.61538462,84.7826087


Data Customer;

Input Bu_Unit  Sales  Price Qu_level Claims NPS Satisfac;

Cards;

1 65.??107775 97.??21978 96.??419355 13.??024691 98.??10989 97.??608696

2 15.83710407 98.9010989 98.38709677 12.34567901 97.8021978 98.91304348

3 8.885232415 100 100 11.11111111 100 100

4 12.46400658 98.9010989 95.16129032 12.34567901 96.7032967 96.73913043

5 80.66639243 21.97802198 19.35483871 100 2.197802198 21.73913043

6 32.16783217 23.07692308 22.58064516 97.5308642 3.296703297 23.91304348

7 23.44714109 24.17582418 24.19354839 96.2962963 2.747252747 25

8 89.9629782 24.17582418 19.35483871 95.0617284 2.197802198 26.08695652

9 31.42739613 64.83516484 56.4516129 50.61728395 65.93406593 65.2173913

10 11.22994652 65.93406593 51.61290323 49.38271605 71.42857143 66.30434783

11 77.45783628 70.32967033 53.22580645 46.91358025 63.73626374 68.47826087

12 23.89962978 68.13186813 51.61290323 45.67901235 61.53846154 67.39130435

13 7.404360346 86.81318681 80.64516129 25.92592593 90.10989011 86.95652174

14 0.287947347 87.91208791 79.03225806 24.69135802 85.71428571 85.86956522

15 83.42245989 87.91208791 77.41935484 22.22222222 90.10989011 88.04347826

16 100 86.81318681 75.80645161 25.92592593 84.61538462 84.7826087

;

proc print; run;

/* Input Bu_Unit  Sales  Price Qu_level Claims NPS Satisfac; */

proc reg;

   model  Satisfac = Sales  Price Qu_level Claims NPS;

Run;

proc robustreg;

model Satisfac = Sales  Price Qu_level Claims NPS;

Run;








 



 Exercício 1 B – Facultativo, opcional. Criar um exemplo proprio de voces de ML S para Predição. 

. DL: 29/5/2023 



Exercício 2 A – Obrigatório. Data Crunching e ML Não Superv. para Clasificação

 UML - Cluster Analysis - ANOVA 


UML - Unsupervised Machine Learning: Machine Learning Não Supervisionado


Dados:

    - Categoria: Variável Classificatória

    - IMC: Primeira Variável Preditora - Indice de Massa Corporal

    - Movim: Segunda Variável Preditora - Movimentação caminhando ou correndo por semana (Km)

    - KCal: Quilocalorias consumidas por dia


Categ

IMC

Movim

KCal

ATL

20,?

60,?

32??

ATL

21,3

54,8

3100

ATL

19,3

49,6

2800

ATL

21,1

52,3

3300

SEMI

22,4

14,9

2600

SEMI

21,9

17,8

2700

SEMI

23,8

18,6

3200

SEMI

24,1

15,1

3300

SEDE

27,3

2,5

2700

SEDE

23,4

4,3

2300

SEDE

25,2

2,3

2600

SEDE

26,4

2,6

3200

PROF

26,2

4,1

2600

PROF

24,2

2,1

2700

PROF

25,4

1,9

2650

Obter as Médias por Data Crunching - Pivot Table


Obtaining Cluster Analysis

data  People;
input Categ $ BMI Movm kcal;
cards;

AT 20.5 54.4 3100

PR 25.3 2.7 2650

SE 25.6 2.9 2700

SEM 23.1 16.6 2950

;
proc cluster outtree = Dendrog method = average;
var BMI Movm kcal;
id Categ;
run;
PROC TREE DATA = Dendrog;

RUN; 







Program to do ANOVA


data People;

/* BMI: body mass index --> Índice de M. Corporal = Peso / (Altura * Altura)
     Movm: Movement (Km por semana)
     KCal : Kilocalories (ingeridas por dia)
     ATL: Athletes
     SEMI: Semi-athletes
     SEDE: Sedentary
     PROF: Professor

*/
input Categ $ BMI Movm Kcal;
cards;
ATL 20.? 60.? 32??
ATL 21.3 54.8 3100
ATL 19.3 49.6 2800
ATL 21.1 52.3 3300
SEMI 22.4 14.9 2600
SEMI 21.9 17.8 2700
SEMI 23.8 18.6 3200
SEMI 24.1 15.1 3300
SEDE  27.3 2.5 2700
SEDE 23.4 4.3 2300
SEDE  25.2 2.3 2600
SEDE  26.4 2.6 3200
PROF 26.2 4.1 2600
PROF 24.2 2.1 2700
PROF 25.4 1.9 2650
;
Proc ANOVA;
     Class Categ;
      Model BMI Movm Kcal = Categ;
     Means Categ / Duncan Lines;
Run;
















Exercício 2 B – Optativo. Elabore um exemplo analogo ao apresentado no Exercício 2 A

Exercício 3 A – Optativo. Testar os clusters utilizando MANOVA


Program to do MANOVA

data imc_dat;

input cat $ imc corr kcal;
cards;
DADOS
;
proc print;
run;
proc glm;
 class cat;
 model imc corr kcal  = cat;
 contrast " Atl e Semiat Vs Seden e Prof"  cat 1 -1 -1 1;
 contrast " Professor Vs Sedentario" cat  0 1 -1 0;
 contrast " Atleta Vs Semiatleta" cat -1 0 0 1;
 manova h=_all_ / printe printh;
 contrast " Atl e Semiat Vs Seden e Prof"  cat 1 -1 -1 1;
 contrast " Professor Vs Sedentario" cat  0 1 -1 0;
 contrast " Atleta Vs Semiatleta" cat -1 0 0 1;
run;

Elaboração de Contraste:



AT PR  SE SEM
1  -1 -1   1 Atleta e Semiatleta Vs Professor e Sedentario
0   1 -1   0 Professor Vs Sedentario
1   0  0  -1 Atleta Vs Semiatleta
3  -1 -1  -1  Atleta Vs Outras Categorias


Exercício 3 B – Optativo. Elabore um exemplo analogo ao apresentado no Exercício 3 A


Exercício 4 A – Obrigatório

 ML Supervisionado para Classificação:  troque os sinais de interrogação pelos últimos dígitos do seu numero USP  no arquivo do Dinheiro Falsificado, Dead Line: 5/6/2023 . Rode uma rede neural com 1-2-3 camadas de neurônios:



@RELATION banco


@ATTRIBUTE Length REAL

@ATTRIBUTE Left REAL

@ATTRIBUTE Right REAL

@ATTRIBUTE Bottom REAL

@ATTRIBUTE Top REAL

@ATTRIBUTE Diagonal REAL

@ATTRIBUTE Class {FALSE,TRUE}


@DATA      


214.?,13?,13?.?,9,9.?,141,FALSE

214.6,129.7,129.7,8.1,9.5,141.7,FALSE

214.8,129.7,129.7,8.7,9.6,142.2,FALSE

214.8,129.7,129.6,7.5,10.4,142,FALSE

215,129.6,129.7,10.4,7.7,141.8,FALSE

215.7,130.8,130.5,9,10.1,141.4,FALSE

215.5,129.5,129.7,7.9,9.6,141.6,FALSE

214.5,129.6,129.2,7.2,10.7,141.7,FALSE

214.9,129.4,129.7,8.2,11,141.9,FALSE

215.2,130.4,130.3,9.2,10,140.7,FALSE

215.3,130.4,130.3,7.9,11.7,141.8,FALSE

215.1,129.5,129.6,7.7,10.5,142.2,FALSE

215.2,130.8,129.6,7.9,10.8,141.4,FALSE

214.7,129.7,129.7,7.7,10.9,141.7,FALSE

215.1,129.9,129.7,7.7,10.8,141.8,FALSE

214.5,129.8,129.8,9.3,8.5,141.6,FALSE

214.6,129.9,130.1,8.2,9.8,141.7,FALSE

215,129.9,129.7,9,9,141.9,FALSE

215.2,129.6,129.6,7.4,11.5,141.5,FALSE

214.7,130.2,129.9,8.6,10,141.9,FALSE

215,129.9,129.3,8.4,10,141.4,FALSE

215.6,130.5,130,8.1,10.3,141.6,FALSE

215.3,130.6,130,8.4,10.8,141.5,FALSE

215.7,130.2,130,8.7,10,141.6,FALSE

215.1,129.7,129.9,7.4,10.8,141.1,FALSE

215.3,130.4,130.4,8,11,142.3,FALSE

215.5,130.2,130.1,8.9,9.8,142.4,FALSE

215.1,130.3,130.3,9.8,9.5,141.9,FALSE

215.1,130,130,7.4,10.5,141.8,FALSE

214.8,129.7,129.3,8.3,9,142,FALSE

215.2,130.1,129.8,7.9,10.7,141.8,FALSE

214.8,129.7,129.7,8.6,9.1,142.3,FALSE

215,130,129.6,7.7,10.5,140.7,FALSE

215.6,130.4,130.1,8.4,10.3,141,FALSE

215.9,130.4,130,8.9,10.6,141.4,FALSE

214.6,130.2,130.2,9.4,9.7,141.8,FALSE

215.5,130.3,130,8.4,9.7,141.8,FALSE

215.3,129.9,129.4,7.9,10,142,FALSE

215.3,130.3,130.1,8.5,9.3,142.1,FALSE

213.9,130.3,129,8.1,9.7,141.3,FALSE

214.4,129.8,129.2,8.9,9.4,142.3,FALSE

214.8,130.1,129.6,8.8,9.9,140.9,FALSE

214.9,129.6,129.4,9.3,9,141.7,FALSE

214.9,130.4,129.7,9,9.8,140.9,FALSE

214.8,129.4,129.1,8.2,10.2,141,FALSE

214.3,129.5,129.4,8.3,10.2,141.8,FALSE

214.8,129.9,129.7,8.3,10.2,141.5,FALSE

214.8,129.9,129.7,7.3,10.9,142,FALSE

214.6,129.7,129.8,7.9,10.3,141.1,FALSE

214.5,129,129.6,7.8,9.8,142,FALSE

214.6,129.8,129.4,7.2,10,141.3,FALSE

215.3,130.6,130,9.5,9.7,141.1,FALSE

214.5,130.1,130,7.8,10.9,140.9,FALSE

215.4,130.2,130.2,7.6,10.9,141.6,FALSE

214.5,129.4,129.5,7.9,10,141.4,FALSE

215.2,129.7,129.4,9.2,9.4,142,FALSE

215.7,130,129.4,9.2,10.4,141.2,FALSE

215,129.6,129.4,8.8,9,141.1,FALSE

215.1,130.1,129.9,7.9,11,141.3,FALSE

215.1,130,129.8,8.2,10.3,141.4,FALSE

215.1,129.6,129.3,8.3,9.9,141.6,FALSE

215.3,129.7,129.4,7.5,10.5,141.5,FALSE

215.4,129.8,129.4,8,10.6,141.5,FALSE

214.5,130,129.5,8,10.8,141.4,FALSE

215,130,129.8,8.6,10.6,141.5,FALSE

215.2,130.6,130,8.8,10.6,140.8,FALSE

214.6,129.5,129.2,7.7,10.3,141.3,FALSE

214.8,129.7,129.3,9.1,9.5,141.5,FALSE

215.1,129.6,129.8,8.6,9.8,141.8,FALSE

214.9,130.2,130.2,8,11.2,139.6,FALSE

213.8,129.8,129.5,8.4,11.1,140.9,FALSE

215.2,129.9,129.5,8.2,10.3,141.4,FALSE

215,129.6,130.2,8.7,10,141.2,FALSE

214.4,129.9,129.6,7.5,10.5,141.8,FALSE

215.2,129.9,129.7,7.2,10.6,142.1,FALSE

214.1,129.6,129.3,7.6,10.7,141.7,FALSE

214.9,129.9,130.1,8.8,10,141.2,FALSE

214.6,129.8,129.4,7.4,10.6,141,FALSE

215.2,130.5,129.8,7.9,10.9,140.9,FALSE

214.6,129.9,129.4,7.9,10,141.8,FALSE

215.1,129.7,129.7,8.6,10.3,140.6,FALSE

214.9,129.8,129.6,7.5,10.3,141,FALSE

215.2,129.7,129.1,9,9.7,141.9,FALSE

215.2,130.1,129.9,7.9,10.8,141.3,FALSE

215.4,130.7,130.2,9,11.1,141.2,FALSE

215.1,129.9,129.6,8.9,10.2,141.5,FALSE

215.2,129.9,129.7,8.7,9.5,141.6,FALSE

215,129.6,129.2,8.4,10.2,142.1,FALSE

214.9,130.3,129.9,7.4,11.2,141.5,FALSE

215,129.9,129.7,8,10.5,142,FALSE

214.7,129.7,129.3,8.6,9.6,141.6,FALSE

215.4,130,129.9,8.5,9.7,141.4,FALSE

214.9,129.4,129.5,8.2,9.9,141.5,FALSE

214.5,129.5,129.3,7.4,10.7,141.5,FALSE

214.7,129.6,129.5,8.3,10,142,FALSE

215.6,129.9,129.9,9,9.5,141.7,FALSE

215,130.4,130.3,9.1,10.2,141.1,FALSE

214.4,129.7,129.5,8,10.3,141.2,FALSE

215.1,130,129.8,9.1,10.2,141.5,FALSE

214.7,130,129.4,7.8,10,141.2,FALSE

214.4,130.1,130.3,9.7,11.7,139.8,TRUE

214.9,130.5,130.2,11,11.5,139.5,TRUE

214.9,130.3,130.1,8.7,11.7,140.2,TRUE

215,130.4,130.6,9.9,10.9,140.3,TRUE

214.7,130.2,130.3,11.8,10.9,139.7,TRUE

215,130.2,130.2,10.6,10.7,139.9,TRUE

215.3,130.3,130.1,9.3,12.1,140.2,TRUE

214.8,130.1,130.4,9.8,11.5,139.9,TRUE

215,130.2,129.9,10,11.9,139.4,TRUE

215.2,130.6,130.8,10.4,11.2,140.3,TRUE

215.2,130.4,130.3,8,11.5,139.2,TRUE

215.1,130.5,130.3,10.6,11.5,140.1,TRUE

215.4,130.7,131.1,9.7,11.8,140.6,TRUE

214.9,130.4,129.9,11.4,11,139.9,TRUE

215.1,130.3,130,10.6,10.8,139.7,TRUE

215.5,130.4,130,8.2,11.2,139.2,TRUE

214.7,130.6,130.1,11.8,10.5,139.8,TRUE

214.7,130.4,130.1,12.1,10.4,139.9,TRUE

214.8,130.5,130.2,11,11,140,TRUE

214.4,130.2,129.9,10.1,12,139.2,TRUE

214.8,130.3,130.4,10.1,12.1,139.6,TRUE

215.1,130.6,130.3,12.3,10.2,139.6,TRUE

215.3,130.8,131.1,11.6,10.6,140.2,TRUE

215.1,130.7,130.4,10.5,11.2,139.7,TRUE

214.7,130.5,130.5,9.9,10.3,140.1,TRUE

214.9,130,130.3,10.2,11.4,139.6,TRUE

215,130.4,130.4,9.4,11.6,140.2,TRUE

215.5,130.7,130.3,10.2,11.8,140,TRUE

215.1,130.2,130.2,10.1,11.3,140.3,TRUE

214.5,130.2,130.6,9.8,12.1,139.9,TRUE

214.3,130.2,130,10.7,10.5,139.8,TRUE

214.5,130.2,129.8,12.3,11.2,139.2,TRUE

214.9,130.5,130.2,10.6,11.5,139.9,TRUE

214.6,130.2,130.4,10.5,11.8,139.7,TRUE

214.2,130,130.2,11,11.2,139.5,TRUE

214.8,130.1,130.1,11.9,11.1,139.5,TRUE

214.6,129.8,130.2,10.7,11.1,139.4,TRUE

214.9,130.7,130.3,9.3,11.2,138.3,TRUE

214.6,130.4,130.4,11.3,10.8,139.8,TRUE

214.5,130.5,130.2,11.8,10.2,139.6,TRUE

214.8,130.2,130.3,10,11.9,139.3,TRUE

214.7,130,129.4,10.2,11,139.2,TRUE

214.6,130.2,130.4,11.2,10.7,139.9,TRUE

215,130.5,130.4,10.6,11.1,139.9,TRUE

214.5,129.8,129.8,11.4,10,139.3,TRUE

214.9,130.6,130.4,11.9,10.5,139.8,TRUE

215,130.5,130.4,11.4,10.7,139.9,TRUE

215.3,130.6,130.3,9.3,11.3,138.1,TRUE

214.7,130.2,130.1,10.7,11,139.4,TRUE

214.9,129.9,130,9.9,12.3,139.4,TRUE

214.9,130.3,129.9,11.9,10.6,139.8,TRUE

214.6,129.9,129.7,11.9,10.1,139,TRUE

214.6,129.7,129.3,10.4,11,139.3,TRUE

214.5,130.1,130.1,12.1,10.3,139.4,TRUE

214.5,130.3,130,11,11.5,139.5,TRUE

215.1,130,130.3,11.6,10.5,139.7,TRUE

214.2,129.7,129.6,10.3,11.4,139.5,TRUE

214.4,130.1,130,11.3,10.7,139.2,TRUE

214.8,130.4,130.6,12.5,10,139.3,TRUE

214.6,130.6,130.1,8.1,12.1,137.9,TRUE

215.6,130.1,129.7,7.4,12.2,138.4,TRUE

214.9,130.5,130.1,9.9,10.2,138.1,TRUE

214.6,130.1,130,11.5,10.6,139.5,TRUE

214.7,130.1,130.2,11.6,10.9,139.1,TRUE

214.3,130.3,130,11.4,10.5,139.8,TRUE

215.1,130.3,130.6,10.3,12,139.7,TRUE

216.3,130.7,130.4,10,10.1,138.8,TRUE

215.6,130.4,130.1,9.6,11.2,138.6,TRUE

214.8,129.9,129.8,9.6,12,139.6,TRUE

214.9,130,129.9,11.4,10.9,139.7,TRUE

213.9,130.7,130.5,8.7,11.5,137.8,TRUE

214.2,130.6,130.4,12,10.2,139.6,TRUE

214.8,130.5,130.3,11.8,10.5,139.4,TRUE

214.8,129.6,130,10.4,11.6,139.2,TRUE

214.8,130.1,130,11.4,10.5,139.6,TRUE

214.9,130.4,130.2,11.9,10.7,139,TRUE

214.3,130.1,130.1,11.6,10.5,139.7,TRUE

214.5,130.4,130,9.9,12,139.6,TRUE

214.8,130.5,130.3,10.2,12.1,139.1,TRUE

214.5,130.2,130.4,8.2,11.8,137.8,TRUE

215,130.4,130.1,11.4,10.7,139.1,TRUE

214.8,130.6,130.6,8,11.4,138.7,TRUE

215,130.5,130.1,11,11.4,139.3,TRUE

214.6,130.5,130.4,10.1,11.4,139.3,TRUE

214.7,130.2,130.1,10.7,11.1,139.5,TRUE

214.7,130.4,130,11.5,10.7,139.4,TRUE

214.5,130.4,130,8,12.2,138.5,TRUE

214.8,130,129.7,11.4,10.6,139.2,TRUE

214.8,129.9,130.2,9.6,11.9,139.4,TRUE

214.6,130.3,130.2,12.7,9.1,139.2,TRUE

215.1,130.2,129.8,10.2,12,139.4,TRUE

215.4,130.5,130.6,8.8,11,138.6,TRUE

214.7,130.3,130.2,10.8,11.1,139.2,TRUE

215,130.5,130.3,9.6,11,138.5,TRUE

214.9,130.3,130.5,11.6,10.6,139.8,TRUE

215,130.4,130.3,9.9,12.1,139.6,TRUE

215.1,130.3,129.9,10.3,11.5,139.7,TRUE

214.8,130.3,130.4,10.6,11.1,140,TRUE

214.7,130.7,130.8,11.2,11.2,139.4,TRUE

214.3,129.9,129.9,10.2,11.5,139.6,TRUE


Exercício 4 B – Optativo. Elabore um exemplo analogo ao apresentado no Exercício 4 A

Exercício 5 A  – Resolva o problema utilizando ML Não Supervisionado para Redução de Dimenção - Principal Componentes Analysis com Boplot

data pca_1;

input Categ $ IMC Movim KCal Colesterol Ac_Urico;

cards;

ATL 20.?1666667 53.?6666667 30?6.5 11?.26 5.???666667

PROF 25.16 2.64 2655 202.346 4.158

SEDE 25.33333333 3.066666667 2625 191.4966667 5.246666667

SEMI 22.88333333 16.83333333 2900 145.7366667 4.641666667

;

proc print; run;

/* input Categ $ IMC Movim KCal Colesterol Ac_Urico; */

title "PCA - Biplots";

title "Melhor fazer com Medias ou Medianas ou Trimedias";

proc prinqual plots=(MDPref)

                 /* project onto Prin1 and Prin2 */

              ; /* use COV scaling */

   transform identity(IMC Movim Colesterol);  /* identity transform */

   id Categ;

ods select MDPrefPlot;

run;

Exercício 5 B – Optativo. Elabore um exemplo analogo ao apresentado no Exercício 5 A


 

Fim dos Exercicios

Nenhum comentário:

Postar um comentário