Storge changes
This commit is contained in:
		
							parent
							
								
									87fdc8ad53
								
							
						
					
					
						commit
						1c3c443cec
					
				
							
								
								
									
										1
									
								
								lecture/Exercise/.Rhistory
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								lecture/Exercise/.Rhistory
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
q()
 | 
			
		||||
							
								
								
									
										25
									
								
								lecture/Exercise/exercise.r
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								lecture/Exercise/exercise.r
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
			
		||||
# Setzen des Pfades und Einlesen der Daten
 | 
			
		||||
library(httpgd)
 | 
			
		||||
hgd(port = getOption("httpgd.port", 11111),
 | 
			
		||||
    token = getOption("httpgd.token", FALSE),)
 | 
			
		||||
 | 
			
		||||
setwd("/config/workspace/assistenz-r/lecture")
 | 
			
		||||
Daten <- read.csv("Mietspiegel.csv",header=TRUE,sep=";",fill=TRUE)
 | 
			
		||||
 | 
			
		||||
Daten[,"bad"] <- as.factor(Daten[,"bad"])
 | 
			
		||||
Daten[,"kueche"] <- as.factor(Daten[,"kueche"])
 | 
			
		||||
Daten[,"lage"] <- as.factor(Daten[,"lage"])
 | 
			
		||||
Daten[,"zh"] <- as.factor(Daten[,"zh"])
 | 
			
		||||
 | 
			
		||||
# Berechnung der linearen Regression
 | 
			
		||||
 | 
			
		||||
model <- lm( mieteqm ~ flaeche + bjahr + bad + kueche + lage + zh, data=Daten)
 | 
			
		||||
 | 
			
		||||
plot(model)
 | 
			
		||||
 | 
			
		||||
y <- Daten[,"mieteqm"] 
 | 
			
		||||
Prognosen <- model$fitted.values 
 | 
			
		||||
Prognosefehler <- mean( abs( y - Prognosen ) )
 | 
			
		||||
Prognosefehler
 | 
			
		||||
 | 
			
		||||
Sys.sleep(10000)
 | 
			
		||||
							
								
								
									
										50
									
								
								project/App-Kredit/app.r
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								project/App-Kredit/app.r
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,50 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################
 | 
			
		||||
# Im folgenden Abschnitt wird das User Interface (UI) definiert
 | 
			
		||||
ui <- fluidPage(
 | 
			
		||||
 | 
			
		||||
  # Titel der App
 | 
			
		||||
  titlePanel("Kredit"),
 | 
			
		||||
 | 
			
		||||
  # Layout für die Eingaben in die App und die Ausgaben
 | 
			
		||||
  sidebarLayout(
 | 
			
		||||
 | 
			
		||||
    # Die Definition der Eingabefelder auf der linken Seite
 | 
			
		||||
    sidebarPanel(
 | 
			
		||||
      sliderInput("obs", 
 | 
			
		||||
                  "Number of observations:", 
 | 
			
		||||
                  min = 1, 
 | 
			
		||||
                  max = 1000, 
 | 
			
		||||
                  value = 500),
 | 
			
		||||
      selectInput("select", h3("status"), 
 | 
			
		||||
                  choices = list("no checking account" = 1, "... < 0 DM" = 2,
 | 
			
		||||
                                 "0<= ... < 200 DM" = 3, "... >= 200 DM / salary for at least 1 year" = 4 ), selected = 1),
 | 
			
		||||
      selectInput("select", h3("credit_history"), 
 | 
			
		||||
                  choices = list("delay in paying off in the past" = 0, "critical account/other credits elsewhere" = 1,
 | 
			
		||||
                                 "no credits taken/all credits paid back duly" = 2, "existing credits paid back duly till now" = 3,
 | 
			
		||||
                                 "all credits at this bank paid back duly" = 4), selected = 0),
 | 
			
		||||
      selectInput("select", h3("purpose"), 
 | 
			
		||||
                  choices = list("others" = 0, "car (new)" = 1, "car (used)" = 2, "furniture/equipment" = 3, "radio/television" = 4,
 | 
			
		||||
                                 "domestic appliances" = 5, "repairs" = 6, "education" = 7, "vacation" = 8, "retraining" = 9,
 | 
			
		||||
                                 "business" = 10), selected = 0),
 | 
			
		||||
    ),
 | 
			
		||||
    # der Hauptbereich der Nutzeroberfläche für die Ausgabe der Ergebnisse
 | 
			
		||||
    mainPanel(
 | 
			
		||||
      plotOutput("distPlot")
 | 
			
		||||
    )
 | 
			
		||||
  )
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
############
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
server <- function(input, output) {
 | 
			
		||||
  output$distPlot <- renderPlot({
 | 
			
		||||
    # generate an rnorm distribution and plot it
 | 
			
		||||
    dist <- rnorm(input$obs)
 | 
			
		||||
    hist(dist)
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
shinyApp(ui = ui, server = server)
 | 
			
		||||
@ -3,7 +3,7 @@ dat <- read.table("SouthGermanCredit.asc", header=TRUE)
 | 
			
		||||
 | 
			
		||||
## dat contains numbers for all variables.
 | 
			
		||||
 | 
			
		||||
## variables duration, amount and age are truly quantitative
 | 
			
		||||
## variables durtion, amount and age are truly quantitative
 | 
			
		||||
## variables installment_rate, present_residence and number_credits are
 | 
			
		||||
    ### quantitative in the data, but are in fact discretized scores for 
 | 
			
		||||
    ### an underlying quantitative variable
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								project/run-Kredit.r
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								project/run-Kredit.r
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
			
		||||
  setwd("/config/workspace/assistenz-r/project")
 | 
			
		||||
  library(shiny)
 | 
			
		||||
 | 
			
		||||
  runApp("App-Kredit",port = 12345)
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user