Comenzamos con las librerias:
library(stats)
library(MASS)
library(dplyr)
library(ggplot2)
library(GGally)
library(car)
library(ISLR)
library(tidyverse)
library(vcd)
library(gmodels)
library(ggeffects)
library(ggplot2)
library(carData)
El objetivo es analizar que factores se relacionan con **la elección del tipo de programa (academico, vocacional o general) que los estudiantes cursan el bachillerato.
Consideramos los programas de bachillerato acádemico, vocacional
library(faraway)
##
## Adjuntando el paquete: 'faraway'
## The following objects are masked from 'package:car':
##
## logit, vif
## The following object is masked from 'package:GGally':
##
## happy
data(hsb)
str(hsb)
## 'data.frame': 200 obs. of 11 variables:
## $ id : int 70 121 86 141 172 113 50 11 84 48 ...
## $ gender : Factor w/ 2 levels "female","male": 2 1 2 2 2 2 2 2 2 2 ...
## $ race : Factor w/ 4 levels "african-amer",..: 4 4 4 4 4 4 1 3 4 1 ...
## $ ses : Factor w/ 3 levels "high","low","middle": 2 3 1 1 3 3 3 3 3 3 ...
## $ schtyp : Factor w/ 2 levels "private","public": 2 2 2 2 2 2 2 2 2 2 ...
## $ prog : Factor w/ 3 levels "academic","general",..: 2 3 2 3 1 1 2 1 2 1 ...
## $ read : int 57 68 44 63 47 44 50 34 63 57 ...
## $ write : int 52 59 33 44 52 52 59 46 57 55 ...
## $ math : int 41 53 54 47 57 51 42 45 54 52 ...
## $ science: int 47 63 58 53 53 63 53 39 58 50 ...
## $ socst : int 57 61 31 56 61 61 61 36 51 51 ...
summary(hsb)
## id gender race ses schtyp
## Min. : 1.00 female:109 african-amer: 20 high :58 private: 32
## 1st Qu.: 50.75 male : 91 asian : 11 low :47 public :168
## Median :100.50 hispanic : 24 middle:95
## Mean :100.50 white :145
## 3rd Qu.:150.25
## Max. :200.00
## prog read write math science
## academic:105 Min. :28.00 Min. :31.00 Min. :33.00 Min. :26.00
## general : 45 1st Qu.:44.00 1st Qu.:45.75 1st Qu.:45.00 1st Qu.:44.00
## vocation: 50 Median :50.00 Median :54.00 Median :52.00 Median :53.00
## Mean :52.23 Mean :52.77 Mean :52.65 Mean :51.85
## 3rd Qu.:60.00 3rd Qu.:60.00 3rd Qu.:59.00 3rd Qu.:58.00
## Max. :76.00 Max. :67.00 Max. :75.00 Max. :74.00
## socst
## Min. :26.00
## 1st Qu.:46.00
## Median :52.00
## Mean :52.41
## 3rd Qu.:61.00
## Max. :71.00
hsb$id<- as.character(hsb$id)
summary(hsb)
## id gender race ses schtyp
## Length:200 female:109 african-amer: 20 high :58 private: 32
## Class :character male : 91 asian : 11 low :47 public :168
## Mode :character hispanic : 24 middle:95
## white :145
##
##
## prog read write math science
## academic:105 Min. :28.00 Min. :31.00 Min. :33.00 Min. :26.00
## general : 45 1st Qu.:44.00 1st Qu.:45.75 1st Qu.:45.00 1st Qu.:44.00
## vocation: 50 Median :50.00 Median :54.00 Median :52.00 Median :53.00
## Mean :52.23 Mean :52.77 Mean :52.65 Mean :51.85
## 3rd Qu.:60.00 3rd Qu.:60.00 3rd Qu.:59.00 3rd Qu.:58.00
## Max. :76.00 Max. :67.00 Max. :75.00 Max. :74.00
## socst
## Min. :26.00
## 1st Qu.:46.00
## Median :52.00
## Mean :52.41
## 3rd Qu.:61.00
## Max. :71.00
datschac <- hsb[hsb$prog=="academic" ,]
datschac
## id gender race ses schtyp prog read write math science
## 5 172 male white middle public academic 47 52 57 53
## 6 113 male white middle public academic 44 52 51 63
## 8 11 male hispanic middle public academic 34 46 45 39
## 10 48 male african-amer middle public academic 57 55 52 50
## 12 60 male white middle public academic 57 65 51 63
## 13 95 male white high public academic 73 60 71 61
## 14 104 male white high public academic 54 63 57 55
## 15 38 male african-amer low public academic 45 57 50 31
## 17 76 male white high public academic 47 52 51 50
## 19 114 male white high public academic 68 65 62 55
## 23 41 male african-amer middle public academic 50 40 45 55
## 24 20 male hispanic high public academic 60 52 57 61
## 27 154 male white high public academic 65 65 66 61
## 29 196 male white high private academic 44 38 49 39
## 32 103 male white high public academic 76 52 64 64
## 33 192 male white high private academic 65 67 63 66
## 35 199 male white high private academic 52 59 50 61
## 37 200 male white middle private academic 68 54 75 66
## 38 80 male white high public academic 65 62 68 66
## 41 176 male white middle private academic 47 47 41 42
## 42 177 male white middle private academic 55 59 62 58
## 43 168 male white middle public academic 52 54 57 55
## 48 136 male white middle public academic 65 59 70 63
## 49 189 male white middle private academic 47 59 63 53
## 50 7 male hispanic middle public academic 57 54 59 47
## 51 27 male asian middle public academic 53 61 61 57
## 52 128 male white high public academic 39 33 38 47
## 54 183 male white middle private academic 63 59 49 55
## 55 132 male white middle public academic 73 62 73 69
## 59 185 male white middle private academic 63 57 55 58
## 61 181 male white middle private academic 50 46 45 58
## 62 170 male white high public academic 47 62 61 69
## 65 197 male white high private academic 50 42 50 36
## 67 171 male white middle public academic 60 54 60 55
## 69 81 male white low public academic 63 43 59 65
## 72 97 male white high public academic 60 54 58 58
## 73 68 male white middle public academic 73 67 71 63
## 76 5 male hispanic low public academic 47 40 43 45
## 77 159 male white high public academic 55 61 54 49
## 80 14 male hispanic high public academic 47 41 54 42
## 81 127 male white high public academic 63 59 57 55
## 83 174 male white middle private academic 68 59 71 66
## 84 3 male hispanic low public academic 63 65 48 63
## 86 146 male white high public academic 55 62 64 63
## 87 102 male white high public academic 52 41 51 53
## 90 94 male white high public academic 55 49 61 61
## 91 24 male asian middle public academic 52 62 66 47
## 93 82 female white high public academic 68 62 65 69
## 94 8 female hispanic low public academic 39 44 52 44
## 97 57 female white middle public academic 71 65 72 66
## 98 100 female white high public academic 63 65 71 69
## 100 194 female white high private academic 63 63 69 61
## 101 88 female white high public academic 68 60 64 69
## 103 47 female african-amer low public academic 47 46 49 33
## 104 120 female white high public academic 63 52 54 50
## 105 166 female white middle public academic 52 59 53 61
## 106 65 female white middle public academic 55 54 66 42
## 107 101 female white high public academic 60 62 67 50
## 110 180 female white high private academic 71 65 69 58
## 112 4 female hispanic low public academic 44 50 41 39
## 113 131 female white high public academic 65 59 57 46
## 114 125 female white low public academic 68 65 58 59
## 115 34 female hispanic high private academic 73 61 57 55
## 118 93 female white high public academic 73 67 62 58
## 119 163 female white low public academic 52 57 64 58
## 123 73 female white middle public academic 50 52 53 39
## 126 152 female white high public academic 55 57 56 58
## 127 105 female white middle public academic 50 41 45 44
## 131 116 female white middle public academic 57 59 54 50
## 132 33 female asian low public academic 57 65 72 54
## 135 77 female white low public academic 61 59 49 44
## 136 61 female white high public academic 76 63 60 67
## 137 190 female white middle private academic 47 59 54 58
## 140 55 female african-amer middle private academic 52 49 49 44
## 142 90 female white high public academic 42 54 50 50
## 144 17 female hispanic middle public academic 47 57 48 44
## 145 122 female white middle public academic 52 59 58 53
## 146 191 female white high private academic 47 52 43 48
## 148 182 female white middle private academic 44 52 43 44
## 149 6 female hispanic low public academic 47 41 46 40
## 150 46 female african-amer low public academic 45 55 44 34
## 151 43 female african-amer low public academic 47 37 43 42
## 152 96 female white high public academic 65 54 61 58
## 156 139 female white middle public academic 68 59 61 55
## 160 39 female african-amer high public academic 66 67 67 61
## 161 147 female white low public academic 47 62 53 53
## 162 74 female white middle public academic 57 50 50 51
## 163 198 female white high private academic 47 61 51 63
## 164 161 female white low public academic 57 62 72 61
## 165 112 female white middle public academic 52 59 48 55
## 167 156 female white middle public academic 50 59 53 61
## 169 186 female white middle private academic 57 62 63 55
## 174 26 female asian high public academic 60 59 62 61
## 176 135 female white low public academic 63 60 65 54
## 177 59 female white middle public academic 65 67 63 55
## 178 78 female white middle public academic 39 54 54 53
## 181 79 female white middle public academic 60 62 49 50
## 182 193 female white middle private academic 44 49 48 39
## 184 160 female white middle public academic 55 65 55 50
## 186 23 female asian low public academic 65 65 64 58
## 189 188 female white high private academic 63 62 56 55
## 190 52 female african-amer low public academic 50 46 53 53
## 194 30 female asian high public academic 41 59 42 34
## 195 179 female white middle private academic 47 65 60 50
## 200 137 female white high public academic 63 65 65 53
## socst
## 5 61
## 6 61
## 8 36
## 10 51
## 12 61
## 13 71
## 14 46
## 15 56
## 17 56
## 19 61
## 23 56
## 24 61
## 27 66
## 29 46
## 32 61
## 33 71
## 35 61
## 37 66
## 38 66
## 41 51
## 42 51
## 43 51
## 48 51
## 49 46
## 50 51
## 51 56
## 52 41
## 54 71
## 55 66
## 59 41
## 61 61
## 62 66
## 65 61
## 67 66
## 69 44
## 72 61
## 73 66
## 76 31
## 77 61
## 80 56
## 81 56
## 83 56
## 84 56
## 86 66
## 87 56
## 90 56
## 91 46
## 93 61
## 94 48
## 97 56
## 98 71
## 100 61
## 101 66
## 103 41
## 104 51
## 105 51
## 106 56
## 107 56
## 110 71
## 112 51
## 113 66
## 114 56
## 115 66
## 118 66
## 119 56
## 123 56
## 126 61
## 127 56
## 131 56
## 132 56
## 135 66
## 136 66
## 137 46
## 140 61
## 142 52
## 144 41
## 145 66
## 146 61
## 148 51
## 149 41
## 150 41
## 151 46
## 152 56
## 156 71
## 160 66
## 161 61
## 162 58
## 163 31
## 164 61
## 165 61
## 167 61
## 169 41
## 174 51
## 176 66
## 177 71
## 178 41
## 181 51
## 182 51
## 184 61
## 186 71
## 189 61
## 190 66
## 194 51
## 195 56
## 200 61
datschvo <- hsb[hsb$prog=="vocation" ,]
datschvo
## id gender race ses schtyp prog read write math science
## 2 121 female white middle public vocation 68 59 53 63
## 4 141 male white high public vocation 63 44 47 53
## 11 75 male white middle public vocation 60 46 51 53
## 22 143 male white middle public vocation 63 63 75 72
## 25 12 male hispanic middle public vocation 37 44 45 39
## 26 53 male african-amer middle public vocation 34 37 46 39
## 28 178 male white middle private vocation 47 57 57 58
## 34 150 male white middle public vocation 42 41 57 72
## 39 16 male hispanic low public vocation 47 31 44 36
## 40 153 male white middle public vocation 39 31 40 39
## 47 49 male african-amer high public vocation 50 40 39 49
## 56 15 male hispanic high public vocation 39 39 44 26
## 57 67 male white low public vocation 37 37 42 33
## 58 22 male hispanic middle public vocation 42 39 39 56
## 60 9 male hispanic middle public vocation 48 49 52 44
## 66 140 male white middle public vocation 44 41 40 50
## 68 107 male white low public vocation 47 39 47 42
## 70 18 male hispanic middle public vocation 50 33 49 44
## 75 56 male white middle public vocation 55 45 46 58
## 79 164 male white middle public vocation 31 36 46 39
## 82 165 male white low public vocation 36 49 54 61
## 85 58 male white middle public vocation 55 41 40 44
## 88 117 male white high public vocation 34 49 39 42
## 89 133 male white middle public vocation 50 31 40 34
## 99 1 female hispanic low public vocation 34 44 40 39
## 108 89 female white low public vocation 35 35 40 51
## 111 162 female white middle public vocation 57 52 40 61
## 116 106 female white middle public vocation 36 44 37 42
## 120 37 female african-amer low public vocation 41 47 40 39
## 124 151 female white middle public vocation 47 46 52 48
## 125 44 female african-amer low public vocation 47 62 45 34
## 129 91 female white high public vocation 50 49 56 47
## 130 45 female african-amer low public vocation 34 35 41 29
## 133 66 female white middle public vocation 68 62 56 50
## 134 72 female white middle public vocation 42 54 47 47
## 138 42 female african-amer middle public vocation 46 52 55 44
## 139 2 female hispanic middle public vocation 39 41 33 42
## 143 142 female white middle public vocation 47 42 52 39
## 147 83 female white middle public vocation 50 62 41 55
## 153 138 female white middle public vocation 43 57 40 50
## 157 110 female white middle public vocation 52 55 50 54
## 158 148 female white middle public vocation 42 57 51 47
## 166 69 female white low public vocation 44 44 40 40
## 170 98 female white low public vocation 57 60 51 53
## 172 13 female hispanic middle public vocation 47 46 39 47
## 179 64 female white high public vocation 50 52 45 58
## 185 32 female asian high public vocation 50 67 66 66
## 191 124 female white low public vocation 42 54 41 42
## 193 184 female white middle private vocation 50 52 53 55
## 197 145 female white middle public vocation 42 46 38 36
## socst
## 2 61
## 4 56
## 11 61
## 22 66
## 25 46
## 26 31
## 28 46
## 34 31
## 39 36
## 40 51
## 47 47
## 56 42
## 57 32
## 58 46
## 60 51
## 66 26
## 68 26
## 70 36
## 75 51
## 79 46
## 82 36
## 85 41
## 88 56
## 89 31
## 99 41
## 108 33
## 111 56
## 116 41
## 120 51
## 124 46
## 125 46
## 129 46
## 130 26
## 133 51
## 134 46
## 138 56
## 139 41
## 143 51
## 147 31
## 153 51
## 157 61
## 158 61
## 166 31
## 170 37
## 172 61
## 179 36
## 185 56
## 191 41
## 193 56
## 197 46
data1 <-rbind(datschac, datschvo)
data1
## id gender race ses schtyp prog read write math science
## 5 172 male white middle public academic 47 52 57 53
## 6 113 male white middle public academic 44 52 51 63
## 8 11 male hispanic middle public academic 34 46 45 39
## 10 48 male african-amer middle public academic 57 55 52 50
## 12 60 male white middle public academic 57 65 51 63
## 13 95 male white high public academic 73 60 71 61
## 14 104 male white high public academic 54 63 57 55
## 15 38 male african-amer low public academic 45 57 50 31
## 17 76 male white high public academic 47 52 51 50
## 19 114 male white high public academic 68 65 62 55
## 23 41 male african-amer middle public academic 50 40 45 55
## 24 20 male hispanic high public academic 60 52 57 61
## 27 154 male white high public academic 65 65 66 61
## 29 196 male white high private academic 44 38 49 39
## 32 103 male white high public academic 76 52 64 64
## 33 192 male white high private academic 65 67 63 66
## 35 199 male white high private academic 52 59 50 61
## 37 200 male white middle private academic 68 54 75 66
## 38 80 male white high public academic 65 62 68 66
## 41 176 male white middle private academic 47 47 41 42
## 42 177 male white middle private academic 55 59 62 58
## 43 168 male white middle public academic 52 54 57 55
## 48 136 male white middle public academic 65 59 70 63
## 49 189 male white middle private academic 47 59 63 53
## 50 7 male hispanic middle public academic 57 54 59 47
## 51 27 male asian middle public academic 53 61 61 57
## 52 128 male white high public academic 39 33 38 47
## 54 183 male white middle private academic 63 59 49 55
## 55 132 male white middle public academic 73 62 73 69
## 59 185 male white middle private academic 63 57 55 58
## 61 181 male white middle private academic 50 46 45 58
## 62 170 male white high public academic 47 62 61 69
## 65 197 male white high private academic 50 42 50 36
## 67 171 male white middle public academic 60 54 60 55
## 69 81 male white low public academic 63 43 59 65
## 72 97 male white high public academic 60 54 58 58
## 73 68 male white middle public academic 73 67 71 63
## 76 5 male hispanic low public academic 47 40 43 45
## 77 159 male white high public academic 55 61 54 49
## 80 14 male hispanic high public academic 47 41 54 42
## 81 127 male white high public academic 63 59 57 55
## 83 174 male white middle private academic 68 59 71 66
## 84 3 male hispanic low public academic 63 65 48 63
## 86 146 male white high public academic 55 62 64 63
## 87 102 male white high public academic 52 41 51 53
## 90 94 male white high public academic 55 49 61 61
## 91 24 male asian middle public academic 52 62 66 47
## 93 82 female white high public academic 68 62 65 69
## 94 8 female hispanic low public academic 39 44 52 44
## 97 57 female white middle public academic 71 65 72 66
## 98 100 female white high public academic 63 65 71 69
## 100 194 female white high private academic 63 63 69 61
## 101 88 female white high public academic 68 60 64 69
## 103 47 female african-amer low public academic 47 46 49 33
## 104 120 female white high public academic 63 52 54 50
## 105 166 female white middle public academic 52 59 53 61
## 106 65 female white middle public academic 55 54 66 42
## 107 101 female white high public academic 60 62 67 50
## 110 180 female white high private academic 71 65 69 58
## 112 4 female hispanic low public academic 44 50 41 39
## 113 131 female white high public academic 65 59 57 46
## 114 125 female white low public academic 68 65 58 59
## 115 34 female hispanic high private academic 73 61 57 55
## 118 93 female white high public academic 73 67 62 58
## 119 163 female white low public academic 52 57 64 58
## 123 73 female white middle public academic 50 52 53 39
## 126 152 female white high public academic 55 57 56 58
## 127 105 female white middle public academic 50 41 45 44
## 131 116 female white middle public academic 57 59 54 50
## 132 33 female asian low public academic 57 65 72 54
## 135 77 female white low public academic 61 59 49 44
## 136 61 female white high public academic 76 63 60 67
## 137 190 female white middle private academic 47 59 54 58
## 140 55 female african-amer middle private academic 52 49 49 44
## 142 90 female white high public academic 42 54 50 50
## 144 17 female hispanic middle public academic 47 57 48 44
## 145 122 female white middle public academic 52 59 58 53
## 146 191 female white high private academic 47 52 43 48
## 148 182 female white middle private academic 44 52 43 44
## 149 6 female hispanic low public academic 47 41 46 40
## 150 46 female african-amer low public academic 45 55 44 34
## 151 43 female african-amer low public academic 47 37 43 42
## 152 96 female white high public academic 65 54 61 58
## 156 139 female white middle public academic 68 59 61 55
## 160 39 female african-amer high public academic 66 67 67 61
## 161 147 female white low public academic 47 62 53 53
## 162 74 female white middle public academic 57 50 50 51
## 163 198 female white high private academic 47 61 51 63
## 164 161 female white low public academic 57 62 72 61
## 165 112 female white middle public academic 52 59 48 55
## 167 156 female white middle public academic 50 59 53 61
## 169 186 female white middle private academic 57 62 63 55
## 174 26 female asian high public academic 60 59 62 61
## 176 135 female white low public academic 63 60 65 54
## 177 59 female white middle public academic 65 67 63 55
## 178 78 female white middle public academic 39 54 54 53
## 181 79 female white middle public academic 60 62 49 50
## 182 193 female white middle private academic 44 49 48 39
## 184 160 female white middle public academic 55 65 55 50
## 186 23 female asian low public academic 65 65 64 58
## 189 188 female white high private academic 63 62 56 55
## 190 52 female african-amer low public academic 50 46 53 53
## 194 30 female asian high public academic 41 59 42 34
## 195 179 female white middle private academic 47 65 60 50
## 200 137 female white high public academic 63 65 65 53
## 2 121 female white middle public vocation 68 59 53 63
## 4 141 male white high public vocation 63 44 47 53
## 11 75 male white middle public vocation 60 46 51 53
## 22 143 male white middle public vocation 63 63 75 72
## 25 12 male hispanic middle public vocation 37 44 45 39
## 26 53 male african-amer middle public vocation 34 37 46 39
## 28 178 male white middle private vocation 47 57 57 58
## 34 150 male white middle public vocation 42 41 57 72
## 39 16 male hispanic low public vocation 47 31 44 36
## 40 153 male white middle public vocation 39 31 40 39
## 47 49 male african-amer high public vocation 50 40 39 49
## 56 15 male hispanic high public vocation 39 39 44 26
## 57 67 male white low public vocation 37 37 42 33
## 58 22 male hispanic middle public vocation 42 39 39 56
## 60 9 male hispanic middle public vocation 48 49 52 44
## 66 140 male white middle public vocation 44 41 40 50
## 68 107 male white low public vocation 47 39 47 42
## 70 18 male hispanic middle public vocation 50 33 49 44
## 75 56 male white middle public vocation 55 45 46 58
## 79 164 male white middle public vocation 31 36 46 39
## 82 165 male white low public vocation 36 49 54 61
## 85 58 male white middle public vocation 55 41 40 44
## 88 117 male white high public vocation 34 49 39 42
## 89 133 male white middle public vocation 50 31 40 34
## 99 1 female hispanic low public vocation 34 44 40 39
## 108 89 female white low public vocation 35 35 40 51
## 111 162 female white middle public vocation 57 52 40 61
## 116 106 female white middle public vocation 36 44 37 42
## 120 37 female african-amer low public vocation 41 47 40 39
## 124 151 female white middle public vocation 47 46 52 48
## 125 44 female african-amer low public vocation 47 62 45 34
## 129 91 female white high public vocation 50 49 56 47
## 130 45 female african-amer low public vocation 34 35 41 29
## 133 66 female white middle public vocation 68 62 56 50
## 134 72 female white middle public vocation 42 54 47 47
## 138 42 female african-amer middle public vocation 46 52 55 44
## 139 2 female hispanic middle public vocation 39 41 33 42
## 143 142 female white middle public vocation 47 42 52 39
## 147 83 female white middle public vocation 50 62 41 55
## 153 138 female white middle public vocation 43 57 40 50
## 157 110 female white middle public vocation 52 55 50 54
## 158 148 female white middle public vocation 42 57 51 47
## 166 69 female white low public vocation 44 44 40 40
## 170 98 female white low public vocation 57 60 51 53
## 172 13 female hispanic middle public vocation 47 46 39 47
## 179 64 female white high public vocation 50 52 45 58
## 185 32 female asian high public vocation 50 67 66 66
## 191 124 female white low public vocation 42 54 41 42
## 193 184 female white middle private vocation 50 52 53 55
## 197 145 female white middle public vocation 42 46 38 36
## socst
## 5 61
## 6 61
## 8 36
## 10 51
## 12 61
## 13 71
## 14 46
## 15 56
## 17 56
## 19 61
## 23 56
## 24 61
## 27 66
## 29 46
## 32 61
## 33 71
## 35 61
## 37 66
## 38 66
## 41 51
## 42 51
## 43 51
## 48 51
## 49 46
## 50 51
## 51 56
## 52 41
## 54 71
## 55 66
## 59 41
## 61 61
## 62 66
## 65 61
## 67 66
## 69 44
## 72 61
## 73 66
## 76 31
## 77 61
## 80 56
## 81 56
## 83 56
## 84 56
## 86 66
## 87 56
## 90 56
## 91 46
## 93 61
## 94 48
## 97 56
## 98 71
## 100 61
## 101 66
## 103 41
## 104 51
## 105 51
## 106 56
## 107 56
## 110 71
## 112 51
## 113 66
## 114 56
## 115 66
## 118 66
## 119 56
## 123 56
## 126 61
## 127 56
## 131 56
## 132 56
## 135 66
## 136 66
## 137 46
## 140 61
## 142 52
## 144 41
## 145 66
## 146 61
## 148 51
## 149 41
## 150 41
## 151 46
## 152 56
## 156 71
## 160 66
## 161 61
## 162 58
## 163 31
## 164 61
## 165 61
## 167 61
## 169 41
## 174 51
## 176 66
## 177 71
## 178 41
## 181 51
## 182 51
## 184 61
## 186 71
## 189 61
## 190 66
## 194 51
## 195 56
## 200 61
## 2 61
## 4 56
## 11 61
## 22 66
## 25 46
## 26 31
## 28 46
## 34 31
## 39 36
## 40 51
## 47 47
## 56 42
## 57 32
## 58 46
## 60 51
## 66 26
## 68 26
## 70 36
## 75 51
## 79 46
## 82 36
## 85 41
## 88 56
## 89 31
## 99 41
## 108 33
## 111 56
## 116 41
## 120 51
## 124 46
## 125 46
## 129 46
## 130 26
## 133 51
## 134 46
## 138 56
## 139 41
## 143 51
## 147 31
## 153 51
## 157 61
## 158 61
## 166 31
## 170 37
## 172 61
## 179 36
## 185 56
## 191 41
## 193 56
## 197 46
str(data1)
## 'data.frame': 155 obs. of 11 variables:
## $ id : chr "172" "113" "11" "48" ...
## $ gender : Factor w/ 2 levels "female","male": 2 2 2 2 2 2 2 2 2 2 ...
## $ race : Factor w/ 4 levels "african-amer",..: 4 4 3 1 4 4 4 1 4 4 ...
## $ ses : Factor w/ 3 levels "high","low","middle": 3 3 3 3 3 1 1 2 1 1 ...
## $ schtyp : Factor w/ 2 levels "private","public": 2 2 2 2 2 2 2 2 2 2 ...
## $ prog : Factor w/ 3 levels "academic","general",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ read : int 47 44 34 57 57 73 54 45 47 68 ...
## $ write : int 52 52 46 55 65 60 63 57 52 65 ...
## $ math : int 57 51 45 52 51 71 57 50 51 62 ...
## $ science: int 53 63 39 50 63 61 55 31 50 55 ...
## $ socst : int 61 61 36 51 61 71 46 56 56 61 ...
levels(data1$prog)
## [1] "academic" "general" "vocation"
view(data1$prog)
se relacionan con **la elección del tipo de programa (academico, vocacional ) que los estudiantes cursan el bachillerato.
¿Que factores se relacionan con la elección del tipo de programa (acádemico, vocacional) que los estudiantes cursan en bachillerato?
Ahora si consideramos la puntuación del lectura del estudiante tenemos el contraste de hipoteis
\(H_{0}:\) La puntuación de lectura promedio de los estudiantes de bachillerato academico es igual a la puntuación de lectura promedio de los estudiantes de bachillerato vocacional
\(H_{1}:\)La puntuación de lectura promedio de los estudiantes de bachillerato academico es diferente a la puntuación de lectura promedio de los estudiantes de bachillerato vocacional
o bien, sean :
\(\mu_{1}:\) Puntuación promedio de lectura de los estudiantes de bachillerato academico
\(\mu_{2}:\) Puntuacion promedio de lectura de los estudiantes de bachillerato vocacional
entonces el contrate de hipotesis es:
\(H_0: \mu_{1} = \mu_{2}\)
\(H_{1}: \mu_{1}\neq \mu_{2}\)
t.test(data1$read ~ data1$prog)
##
## Welch Two Sample t-test
##
## data: data1$read by data1$prog
## t = 6.3481, df = 103.19, p-value = 5.922e-09
## alternative hypothesis: true difference in means between group academic and group vocation is not equal to 0
## 95 percent confidence interval:
## 6.84970 13.07411
## sample estimates:
## mean in group academic mean in group vocation
## 56.1619 46.2000
Se tiene un \(p-valor = 5.922e-09\) siendo Menor al nivel de \(0.05\) de significancia SE RECHAZA LA HIPOTESIS NULA , por lo que se tiene suficiente evidencia en los datos que nos haga rechazar el supuesto de que el la puntuación de lectura promedio de los estudiantes de bachillerato academico, difiere de forma significativa de la puntuación de lectura promedio de los estudiantes de bachillerato voacional.
Gráficamente
boxplot(read ~ prog, data = data1,
main = "Distribución de puntuación promedio de los estudiantes ",
xlab = "Tipo de programa ",
ylab = "Puntuación",
col = c("blue", "purple"),
border = "gray40")
Notemos que los estudiabntes del¿ bachillerato academico tienen una
puntuación de lectura mas alta que los de programa de vocación.
Ahora si consideramos la puntuación del escritura del estudiante tenemos el contraste de hipoteis
\(H_{0}:\) La puntuación de lescritura promedio de los estudiantes de bachillerato academico es igual a la puntuación de escritura promedio de los estudiantes de bachillerato vocacional
\(H_{1}:\)La puntuación de escritura promedio de los estudiantes de bachillerato academico es diferente a la puntuación de escritura promedio de los estudiantes de bachillerato vocacional
\(H_0: \mu_{1} = \mu_{2}\)
\(H_{1}: \mu_{1}\neq \mu_{2}\)
t.test(data1$write ~ data1$prog)
##
## Welch Two Sample t-test
##
## data: data1$write by data1$prog
## t = 6.2115, df = 84.034, p-value = 1.924e-08
## alternative hypothesis: true difference in means between group academic and group vocation is not equal to 0
## 95 percent confidence interval:
## 6.456665 12.537620
## sample estimates:
## mean in group academic mean in group vocation
## 56.25714 46.76000
Se tiene un \(p-valor = 1.924e-08\) siendo Menor al nivel de \(0.05\) de significancia SE RECHAZA LA HIPOTESIS NULA , por lo que se tiene suficiente evidencia en los datos que nos haga rechazar el supuesto de que el la puntuación de escritura promedio de los estudiantes de bachillerato academico, difiere de forma significativa de la puntuacion de escritura promedio de los estudiantes de bachillerato voacional.
Gráficamente
boxplot(write~ prog, data = data1,
main = "Distribución de puntuación promedio de los estudiantes ",
xlab = "Tipo de programa ",
ylab = "Puntuación",
col = c("blue", "purple"),
border = "gray40")
Notemos que el promedio de puntuacion de escritura es mas en los estudiantes del programa academico que los alumnos con el tipo de programa vocation.
Ahora si consideramos la puntuación del matematicas del estudiante tenemos el contraste de hipoteis
\(H_{0}:\) La puntuación de m,atematicas promedio de los estudiantes de bachillerato academico es igual a la puntuación de matematicas promedio de los estudiantes de bachillerato vocacional
\(H_{1}:\)La puntuación de matematicas promedio de los estudiantes de bachillerato academico es diferente a la puntuación de matematicas promedio de los estudiantes de bachillerato vocacional
\(H_0: \mu_{1} = \mu_{2}\)
\(H_{1}: \mu_{1}\neq \mu_{2}\)
t.test(data1$math ~ data1$prog)
##
## Welch Two Sample t-test
##
## data: data1$math by data1$prog
## t = 7.3086, df = 105.05, p-value = 5.506e-11
## alternative hypothesis: true difference in means between group academic and group vocation is not equal to 0
## 95 percent confidence interval:
## 7.515365 13.111302
## sample estimates:
## mean in group academic mean in group vocation
## 56.73333 46.42000
Se tiene un \(p-valor = 5.506e-11\) siendo Menor al nivel de \(0.05\) de significancia SE RECHAZA LA HIPOTESIS NULA , por lo que se tiene suficiente evidencia en los datos que nos haga rechazar el supuesto de que el la puntuación de matematicas promedio de los estudiantes de bachillerato academico, difiere de forma significativa de la puntuacion de matematicas promedio de los estudiantes de bachillerato voacional.
Gráficamente
boxplot(math~ prog, data = data1,
main = "Distribución de puntuación promedio de los estudiantes ",
xlab = "Tipo de programa ",
ylab = "Puntuación",
col = c("blue", "purple"),
border = "gray40")
Notemos que la puntuación de matematicas de los estudiantes del programa academic es diferente a la puntuación promedio de los estudiantes con programa vocatión.
Ahora si consideramos la puntuación del Ciencia del estudiante tenemos el contraste de hipoteis
\(H_{0}:\) La puntuación de ciencia promedio de los estudiantes de bachillerato academico es igual a la puntuación de ciencia promedio de los estudiantes de bachillerato vocacional
\(H_{1}:\)La puntuación de ciencias promedio de los estudiantes de bachillerato academico es diferente a la puntuación de ciencia promedio de los estudiantes de bachillerato vocacional
\(H_0: \mu_{1} = \mu_{2}\)
\(H_{1}: \mu_{1}\neq \mu_{2}\)
t.test(data1$science ~ data1$prog)
##
## Welch Two Sample t-test
##
## data: data1$science by data1$prog
## t = 3.8446, df = 86.544, p-value = 0.00023
## alternative hypothesis: true difference in means between group academic and group vocation is not equal to 0
## 95 percent confidence interval:
## 3.177959 9.982041
## sample estimates:
## mean in group academic mean in group vocation
## 53.80 47.22
Se tiene un \(p-valor = 0.00023\) siendo Menor al nivel de \(0.05\) de significancia SE RECHAZA LA HIPOTESIS NULA , por lo que se tiene suficiente evidencia en los datos que nos haga rechazar el supuesto de que el la puntuación de ciencias promedio de los estudiantes de bachillerato academico, difiere de forma significativa de la puntuacion de ciencias promedio de los estudiantes de bachillerato voacional.
Gráficamente
boxplot(science~ prog, data = data1,
main = "Distribución de puntuación promedio de los estudiantes ",
xlab = "Tipo de programa ",
ylab = "Puntuación",
col = c("blue", "purple"),
border = "gray40")
Notemos que la puntución de ciencias promedio de los estudiantes de programa academic, es mayor a los estudiantes del programa vocation.
Para las variables cualitativas se plantean los siguientes contrastes de hipótesis:
\(H_{0}: La \ elecciión \ tipo \ de \ programa \ del \ estudiante \ es \ independiente \ del \ sexo \ del \ estudiante\)
\(H_{1}: La \ elecciión \ tipo \ de \ programa \ del \ estudiante \ NO \ es \ independiente \ del \ sexo \ del \ estudiante\)
CrossTable(data1$gender,data1$prog,chisq = TRUE,prop.c=FALSE, prop.chisq = FALSE,prop.t = FALSE)
##
##
## Cell Contents
## |-------------------------|
## | N |
## | N / Row Total |
## |-------------------------|
##
##
## Total Observations in Table: 155
##
##
## | data1$prog
## data1$gender | academic | vocation | Row Total |
## -------------|-----------|-----------|-----------|
## female | 58 | 27 | 85 |
## | 0.682 | 0.318 | 0.548 |
## -------------|-----------|-----------|-----------|
## male | 47 | 23 | 70 |
## | 0.671 | 0.329 | 0.452 |
## -------------|-----------|-----------|-----------|
## Column Total | 105 | 50 | 155 |
## -------------|-----------|-----------|-----------|
##
##
## Statistics for All Table Factors
##
##
## Pearson's Chi-squared test
## ------------------------------------------------------------
## Chi^2 = 0.02096439 d.f. = 1 p = 0.884876
##
## Pearson's Chi-squared test with Yates' continuity correction
## ------------------------------------------------------------
## Chi^2 = 4.853752e-31 d.f. = 1 p = 1
##
##
Tomando en cuenta nuestra prueba, tenemos un $p-valor= 0.884876 $ siendo MAYOR a \(0.05\), es decir NO se tiene evidencia estadististicamente significativa para RECHAZAR LA HIPÓTESIS NULA, es decir, La eleccion del tipo de programa del estudiante NO ES DEPENDIENTE del sexo del estudiante.
\(H_{0}: La \ elecciión \ tipo \ de \ programa \ del \ estudiante \ es \ independiente \ a la \ raza\ del \ estudiante\)
\(H_{1}: La \ elecciión \ tipo \ de \ programa \ del \ estudiante \ NO \ es \ independiente \ a la \ raza \ del \ estudiante\)
CrossTable(data1$race,data1$prog,chisq = TRUE,prop.c=FALSE, prop.chisq = FALSE,prop.t = FALSE)
## Warning in chisq.test(t, correct = FALSE, ...): Chi-squared approximation may
## be incorrect
##
##
## Cell Contents
## |-------------------------|
## | N |
## | N / Row Total |
## |-------------------------|
##
##
## Total Observations in Table: 155
##
##
## | data1$prog
## data1$race | academic | vocation | Row Total |
## -------------|-----------|-----------|-----------|
## african-amer | 9 | 6 | 15 |
## | 0.600 | 0.400 | 0.097 |
## -------------|-----------|-----------|-----------|
## asian | 6 | 1 | 7 |
## | 0.857 | 0.143 | 0.045 |
## -------------|-----------|-----------|-----------|
## hispanic | 11 | 9 | 20 |
## | 0.550 | 0.450 | 0.129 |
## -------------|-----------|-----------|-----------|
## white | 79 | 34 | 113 |
## | 0.699 | 0.301 | 0.729 |
## -------------|-----------|-----------|-----------|
## Column Total | 105 | 50 | 155 |
## -------------|-----------|-----------|-----------|
##
##
## Statistics for All Table Factors
##
##
## Pearson's Chi-squared test
## ------------------------------------------------------------
## Chi^2 = 3.17548 d.f. = 3 p = 0.3653529
##
##
##
Tomando en cuenta nuestra prueba, tenemos un $p-valor= 0.3653529 $ siendo MAYOR a \(0.05\), es decir NO se tiene evidencia estadististicamente significativa para RECHAZAR LA HIPÓTESIS NULA, es decir, La eleccion del tipo de programa del estudiante ES INDPENDIENTE de LA RAZA del estudiante.
\(H_{0}: La \ elecciión \ tipo \ de \ programa \ del \ estudiante \ es \ independiente \ a la \ clase socioeconomica \ del \ estudiante\)
\(H_{1}: La \ elecciión \ tipo \ de \ programa \ del \ estudiante \ NO \ es \ independiente \ del \ a la \ clase socioeconomica del \ estudiante\)
CrossTable(data1$ses,data1$prog,chisq = TRUE,prop.c=FALSE, prop.chisq = FALSE,prop.t = FALSE)
##
##
## Cell Contents
## |-------------------------|
## | N |
## | N / Row Total |
## |-------------------------|
##
##
## Total Observations in Table: 155
##
##
## | data1$prog
## data1$ses | academic | vocation | Row Total |
## -------------|-----------|-----------|-----------|
## high | 42 | 7 | 49 |
## | 0.857 | 0.143 | 0.316 |
## -------------|-----------|-----------|-----------|
## low | 19 | 12 | 31 |
## | 0.613 | 0.387 | 0.200 |
## -------------|-----------|-----------|-----------|
## middle | 44 | 31 | 75 |
## | 0.587 | 0.413 | 0.484 |
## -------------|-----------|-----------|-----------|
## Column Total | 105 | 50 | 155 |
## -------------|-----------|-----------|-----------|
##
##
## Statistics for All Table Factors
##
##
## Pearson's Chi-squared test
## ------------------------------------------------------------
## Chi^2 = 10.66006 d.f. = 2 p = 0.004843916
##
##
##
Tomando en cuenta nuestra prueba, tenemos un $p-valor = 0.004843916 $ siendo menor a \(0.05\), es decir se tiene evidencia estadististicamente significativa para RECHAZAR LA HIPÓTESIS NULA, es decir, La ELECCION DEL PROGRAMA ES DEPENDIENTE de la clase socioecnomica del estudiante.
\(H_{0}: La \ elecciión \ tipo \ de \ programa \ del \ estudiante \ es \ independiente \ del \ tipo de escuale \ del \ estudiante\)
\(H_{1}: La \ elecciión \ tipo \ de \ programa \ del \ estudiante \ NO \ es \ independiente \ del \ tipo de escuela \ del \ estudiante\)
CrossTable(data1$schtyp,data1$prog,chisq = TRUE,prop.c=FALSE, prop.chisq = FALSE,prop.t = FALSE)
##
##
## Cell Contents
## |-------------------------|
## | N |
## | N / Row Total |
## |-------------------------|
##
##
## Total Observations in Table: 155
##
##
## | data1$prog
## data1$schtyp | academic | vocation | Row Total |
## -------------|-----------|-----------|-----------|
## private | 24 | 2 | 26 |
## | 0.923 | 0.077 | 0.168 |
## -------------|-----------|-----------|-----------|
## public | 81 | 48 | 129 |
## | 0.628 | 0.372 | 0.832 |
## -------------|-----------|-----------|-----------|
## Column Total | 105 | 50 | 155 |
## -------------|-----------|-----------|-----------|
##
##
## Statistics for All Table Factors
##
##
## Pearson's Chi-squared test
## ------------------------------------------------------------
## Chi^2 = 8.627396 d.f. = 1 p = 0.003311446
##
## Pearson's Chi-squared test with Yates' continuity correction
## ------------------------------------------------------------
## Chi^2 = 7.329512 d.f. = 1 p = 0.006783145
##
##
Tomando en cuenta nuestra prueba, tenemos un $p-valor = 0.003311446 $ siendo menor a \(0.05\), es decir se tiene evidencia estadististicamente significativa para RECHAZAR LA HIPÓTESIS NULA, es decir, La ELECCION DEL PROGRAMA ES DEPENDIENTE del tipo de escuela del estudiante.
EN RESUMEN
De acuerdo con el p-valor el clase socioeconomica del estudiante así como su el tipo de escuela esta relacionada con la eleccion del tipo de programa
El modelo logístico que se estima está dado en la siguiente instrucción:
# modelo logistico simple
modelo <- glm(prog ~ ses + schtyp,
data = data1, family = binomial)
modelo
##
## Call: glm(formula = prog ~ ses + schtyp, family = binomial, data = data1)
##
## Coefficients:
## (Intercept) seslow sesmiddle schtyppublic
## -3.648 1.105 1.548 2.083
##
## Degrees of Freedom: 154 Total (i.e. Null); 151 Residual
## Null Deviance: 194.9
## Residual Deviance: 172.5 AIC: 180.5
SIGNIFICANCIA DEL MODELO GLOBAL
deviance.modelo<-modelo$deviance
deviance.base<-modelo$null.deviance
chi<-deviance.base - deviance.modelo
gl_chi <- modelo$df.null - modelo$df.residual
sig.chi <- 1-pchisq(chi, df= gl_chi)
cat("Deviance del Modelo:", deviance.modelo, "\n",
"Deviance base:", deviance.base, "\n",
"Estadístico Ji-cuadrado:", chi, "\n",
"Grados de libertad:", gl_chi, "\n",
"p-valor:", sig.chi, "\n")
## Deviance del Modelo: 172.4898
## Deviance base: 194.9278
## Estadístico Ji-cuadrado: 22.43802
## Grados de libertad: 3
## p-valor: 5.287853e-05
Notemos que el $pvalor =5.287853e-05 $ es MENOR al nivel de significancia \(0.0\) por lo que el modelo ES SIGNIFICATIVO GLOBAL
Significancia de cada variable
library(stargazer)
##
## Please cite as:
## Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
## R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
stargazer(modelo, type= "text")
##
## =============================================
## Dependent variable:
## ---------------------------
## prog
## ---------------------------------------------
## seslow 1.105**
## (0.556)
##
## sesmiddle 1.548***
## (0.484)
##
## schtyppublic 2.083***
## (0.780)
##
## Constant -3.648***
## (0.854)
##
## ---------------------------------------------
## Observations 155
## Log Likelihood -86.245
## Akaike Inf. Crit. 180.490
## =============================================
## Note: *p<0.1; **p<0.05; ***p<0.01
Notemos que todas las variables son significativas.
$H_0: _{i} = 0 $
\(H_{1}: \beta_{1}\neq0\)
anova(modelo)
## Analysis of Deviance Table
##
## Model: binomial, link: logit
##
## Response: prog
##
## Terms added sequentially (first to last)
##
##
## Df Deviance Resid. Df Resid. Dev Pr(>Chi)
## NULL 154 194.93
## ses 2 11.648 152 183.28 0.002955 **
## schtyp 1 10.790 151 172.49 0.001021 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Notemos que todas las variables con un p-valor<0.05, es decir todas las variables son significativas.
summary(modelo)
##
## Call:
## glm(formula = prog ~ ses + schtyp, family = binomial, data = data1)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.6476 0.8540 -4.271 1.94e-05 ***
## seslow 1.1051 0.5556 1.989 0.04669 *
## sesmiddle 1.5480 0.4844 3.196 0.00140 **
## schtyppublic 2.0830 0.7799 2.671 0.00757 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 194.93 on 154 degrees of freedom
## Residual deviance: 172.49 on 151 degrees of freedom
## AIC: 180.49
##
## Number of Fisher Scoring iterations: 5
El modelo logistico es el siguente
$Academico = -3.6476+ 1.1051seslow + 1.5480sesmiddle +2.0830*schtyppublic $
Veamos que todas las variables son significativas, los positivos, Para interpretar una variable cualitativa se necesita ser más cuidadoso, por ejemplo la calse socioconomica, con las variables baja y media que son las que estan en el modelo , implica que ser de clase baja y media , aumenta la probabilidad de elegir la el programa de bachillerato academico.
Para el tipo de escuela, notemos que ser de escuekla publica aumenta la probabilidad de elegir el progrma de bachillerato academico.
Carlitos
$Academico = -3.6476+ 1.1051seslow + 1.5480sesmiddle +2.0830*schtyppublic $
Tomando en cuenta la que carlitos es un alumno de clase media y va en escuela publica
\(P(Y=1)=\dfrac{1}{1+e^{-Y}}=\dfrac{1}{1+e^{-(-3.6476+ + 1.5480*1 +2.0830*1)}}\)=0.38
La probabilidad de que carlitos sea un estudiantes de clase media y quiie vaya en escuela publica, tiene una probabilidad de 38% de que elija el programa academico.
Calculamos la probabilidad de elegir el programa academico de cada estudiante así como la probabilidad de no eliha el programa academico
data2<- data.frame(data1, modelo$fitted.values)
head(data2)
## id gender race ses schtyp prog read write math science socst
## 5 172 male white middle public academic 47 52 57 53 61
## 6 113 male white middle public academic 44 52 51 63 61
## 8 11 male hispanic middle public academic 34 46 45 39 36
## 10 48 male african-amer middle public academic 57 55 52 50 51
## 12 60 male white middle public academic 57 65 51 63 61
## 13 95 male white high public academic 73 60 71 61 71
## modelo.fitted.values
## 5 0.4958290
## 6 0.4958290
## 8 0.4958290
## 10 0.4958290
## 12 0.4958290
## 13 0.1729767
data1$ProbEstimSob <- as.numeric(modelo$fitted.values)
head(data1)
## id gender race ses schtyp prog read write math science socst
## 5 172 male white middle public academic 47 52 57 53 61
## 6 113 male white middle public academic 44 52 51 63 61
## 8 11 male hispanic middle public academic 34 46 45 39 36
## 10 48 male african-amer middle public academic 57 55 52 50 51
## 12 60 male white middle public academic 57 65 51 63 61
## 13 95 male white high public academic 73 60 71 61 71
## ProbEstimSob
## 5 0.4958290
## 6 0.4958290
## 8 0.4958290
## 10 0.4958290
## 12 0.4958290
## 13 0.1729767
NO_aca<-1-data1$ProbEstimSob
data1$ProbFrac<-NO_aca
data1$Odd<- (data1$ProbEstimSob)/(data1$ProbFrac)
head(data1)
## id gender race ses schtyp prog read write math science socst
## 5 172 male white middle public academic 47 52 57 53 61
## 6 113 male white middle public academic 44 52 51 63 61
## 8 11 male hispanic middle public academic 34 46 45 39 36
## 10 48 male african-amer middle public academic 57 55 52 50 51
## 12 60 male white middle public academic 57 65 51 63 61
## 13 95 male white high public academic 73 60 71 61 71
## ProbEstimSob ProbFrac Odd
## 5 0.4958290 0.5041710 0.9834539
## 6 0.4958290 0.5041710 0.9834539
## 8 0.4958290 0.5041710 0.9834539
## 10 0.4958290 0.5041710 0.9834539
## 12 0.4958290 0.5041710 0.9834539
## 13 0.1729767 0.8270233 0.2091557
library(gmodels)
#CrossTable(data1$prog, predict.modelo, prop.chisq = FALSE,
# prop.c = FALSE, prop.r = FALSE)
library(Epi)
ROC(data=data1, form= prog ~ ses + schtyp )
Corte optimo para maximizar el modelo es 0.173
Con una sensinibilidad de 82%
##13 Que representa las Razon odd en un modelo de regresion logistica binomial
La razón odd representa cuánto cambia la probabilidad relativa de que ocurra un evento cuando una variable independiente aumenta en una unidad o cambia de categoría.
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.