# Map 1-based optional input ports to variables dataset1 <- maml.mapInputPort(1) #dataset2 is dataset1 minus the last 3 lines of data dataset2 <- head(dataset1, n=-3) #dataset3 is the last 3 lines of data used for ci dataset3 <- tail(dataset1, n=3) #statistical model model <- lm(energyuse ~ housesize1 + housesize2, data=dataset2) f1 <- c(summary(model)) #title row t1 <- cbind('estimates', 'std errors', 't values', 'prob..Ts') #store the coefficients in the summary as a matrix f2 <- round(as.matrix(f1$coefficients), 4) #store the r stats f3 <- cbind('R squared', round(f1$r.squared, 4), 'Adj R squared', round(f1$adj.r.squared, 4)) #store the fstats f4 <- cbind('F statistic:', round(f1$fstatistic, 4), 'N/A', 'N/A') ci <- predict(model, dataset3, interval='confidence') #title row t5 <- cbind('estimate', 'lower ci ', 'upper ci', '') f5 <- cbind(round(ci, 4), 'N/A') #convert to dataframe for export (tratios, rstats, fstats, cis) df1 <- data.frame(rbind(t1, f2, f3, f4, t5, f5)) # Select data.frame to be sent to the output Dataset port maml.mapOutputPort('df1');