“Przelicz z R na Python” Kod odpowiedzi

Przelicz z R na Python

# Ucitavanje podataka
creditdata = read.csv('creditdata.csv')
summary(creditdata)


# Priprema podataka
creditdata$education = factor(creditdata$education,levels = c(1,2,3),labels = c('elementary','secondary', 'university'))
creditdata$marriage = factor(creditdata$marriage,levels = c(1,2),labels = c('single','married'))
creditdata$apartment = factor(creditdata$apartment,levels = c(1,2),labels = c('rent','own'))
creditdata$default = factor(creditdata$default,levels = c(0,1),labels = c(FALSE,TRUE))
summary(creditdata)

require(nortest)

lillie.test(creditdata$income)
lillie.test(creditdata$income[creditdata$education=='elementary'])
lillie.test(creditdata$income[creditdata$education=='secondary'])
lillie.test(creditdata$income[creditdata$education=='university'])


hist(creditdata$income[creditdata$education=='elementary'])
hist(creditdata$income[creditdata$education=='secondary'])
hist(creditdata$income[creditdata$education=='university'])

# Testiranje homogenosti varijance uzoraka Bartlettovim testom
bartlett.test(creditdata$income ~ creditdata$education)
var((creditdata$income[creditdata$education=='elementary']))
var((creditdata$income[creditdata$education=='secondary']))
var((creditdata$income[creditdata$education=='university']))

# Graficki prikaz podataka
boxplot(creditdata$income ~ creditdata$education)

# Test
a = aov(creditdata$income ~ creditdata$education)
summary(a)

# Linearni model
model = lm(income ~ education, data = creditdata)
summary(model)

anova(model)
Fancy Flamingo

Przelicz z R na Python

x <- c(46 , 54, 42, 46, 32)
sample _ mean <- mean (x)
cat (" Sample mean f o r x i s ",sample _ mean )
Elnare Memmedova

Odpowiedzi podobne do “Przelicz z R na Python”

Pytania podobne do “Przelicz z R na Python”

Więcej pokrewnych odpowiedzi na “Przelicz z R na Python” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu