Publications by Real R Application
PLS
PCR combines predictors in an unsupervised way.1010 The response, Y, is not used to generate the principal component Partial Least Squares (PLS) is a supervised alternative.11 We can apply PCR to the Hitters dataset in order to predict Salary. First, we must remove any missing values. Data preparation names(Hitters) #column names ## [1] "AtBat"...
2017 sym R (5738 sym/38 pcs) 3 img
Survival Analysis
1. Upload library 2.Upload data data(package="survival") bc<-cancer head(bc) ## inst time status age sex ph.ecog ph.karno pat.karno meal.cal wt.loss ## 1 3 306 2 74 1 1 90 100 1175 NA ## 2 3 455 2 68 1 0 90 90 1225 15 ## 3 3 1010 1 56 1 0 ...
120 sym R (3087 sym/8 pcs) 1 img
Propensity Score Method
1.Load data csch <- read.csv("d:/UPWORK-COX/csch.csv") dim(csch) ## [1] 1000 7 head(csch) ## X race_white wkincome p1numpla wkmomed_1 catholic c5r2mtsc_std ## 1 1 1 -0.58432647 2 0 0 -1.1348567 ## 2 2 0 0.06801235 1 1 0 0.6970083 ## 3 3 0 -0.10415629 5...
375 sym R (82363 sym/29 pcs) 1 img
Bayes Network
library ("bnlearn") # example using learning.test data set tan = tree.bayes (ac, "A") tan$arcs # graph structure, arcs plot(tan) fitted = bn.fit(tan, ac, method = "bayes") pred = predict(fitted, ac) ACC <- sum(diag(table(pred, ac[,"A"])))/sum((table(pred, ac[,"A"]))) learning.test for 5000 observation ## Warning: package 'bnlearn' was buil...
124 sym R (950 sym/9 pcs)
UBFC HBFC Model
## [1] 24938 101 ## Min. 1st Qu. Median Mean 3rd Qu. Max. ## 15.00 20.00 25.00 24.92 30.00 35.00 ## [1] -9.95 ## [1] 9.81 Plot histogram hist(as.vector(as.matrix(jester)), main = "Distribution of Jester Ratings", col = "yellow", xlab = "Ratings")#ok boxplot(as.vector(as.matrix(jester)), col = "yellow", main = "Di...
2020 sym R (5221 sym/26 pcs) 5 img
Portfolio saham saat pandemi
Performance of Portfolio stock TKIM.JK = Pabrik Kertas Tjiwi Kimia Tbk. (TKIM) INKP.JK = Indah Kiat Pulp & Paper Tbk AGRO.JK = (AGRO) Bank Rakyat Indonesia Agroniaga Tbk. KAEF.JK = Kimia Farma Tbk. (KAEF) scraping from yahoo.finance start from 2018-01-01 to 2021-07-01 1 Load Libraries 1.1 Library(ask author) 2 Get Stock Data stocks <- ...
377 sym R (5437 sym/19 pcs) 4 img
Network Plot
Ulpoad library edges <- data.frame( from = sample(1:12, 8), to = sample(1:12, 8), label = paste("interaction type", 1:8), length = c(100, 500), width = c(4, 1), arrows = c("to", "from", "middle", "middle;to"), dashes = c(TRUE, FALSE), title = paste("interaction name", 1:8), smooth =...
107 sym R (2067 sym/8 pcs)
EBA
The function eba(), however, also offers a great deal of flexibility for researchers who might be interested in conducting a different kind of extreme bounds analysis. Every aspect of EBA is fully customizable: eba() can estimate any type of regression model (argument reg.fun), not just Ordinary Least Squares (OLS). Researchers can thus easily pe...
857 sym R (7313 sym/13 pcs) 1 img
Network map
Ulpoad library g <-visNetwork::visNetwork(nodes, edges, height = "500px", width = "100%") %>% visNetwork::visIgraphLayout(layout = "layout_as_tree") # access the x and y co-ordinates to arrange the groups coords <- g$x$nodes %>% dplyr::mutate(x = abs(x)) %>% dplyr::mutate(y = abs(y)) %>% dplyr::mutate(x = i...
26 sym R (907 sym/3 pcs)
Example Network Chart
Ulpoad library visNetwork::visNetwork(nodes, edges, height = "500px", width = "100%") %>% visNetwork::visIgraphLayout( layout = "layout.norm", layoutMatrix = coords, randomSeed = 1, smooth = T) Select by group visNetwork(nodes, edges, width = "100%") %>% visOptions(selectedBy = "group") Select by id visNetwor...
61 sym R (368 sym/3 pcs)