Publications by muhamad johar arifin
Partical Aplicationst
library(mvtnorm) library(ggplot2) library(matlib) set.seed(123) n <- 100 mu <- c(1, 2) sigma <- matrix(c(1, 0.5, 0.5, 2), nrow = 2) data <- rmvnorm(n, mean = mu, sigma = sigma) pca_result <- prcomp(data) pc_scores <- pca_result$x pc_loadings <- pca_result$rotation variance_ratio <- pca_result$sdev^2 / sum(pca_result$sdev^2) cat("Explained Var...
19 sym R (671 sym/15 pcs) 1 img
MASS untuk logistic regretion
library(MASS) data(menarche) model <- glm(cbind(Menarche, Total - Menarche) ~ Age, data = menarche, family = binomial()) summary(model) ## ## Call: ## glm(formula = cbind(Menarche, Total - Menarche) ~ Age, family = binomial(), ## data = menarche) ## ## Coefficients: ## Estimate Std. Error z value Pr(>|z|) ...
11 sym R (1035 sym/8 pcs)
MASS untuk operasi matrix
library(MASS) mat <- matrix(1:9, nrow = 3, ncol = 3) print("Original Matrix:") ## [1] "Original Matrix:" print(mat) ## [,1] [,2] [,3] ## [1,] 1 4 7 ## [2,] 2 5 8 ## [3,] 3 6 9 inverse <- ginv(mat) print("Inverse Matrix:") ## [1] "Inverse Matrix:" print(inverse) ## [,1] [,2] [,3] ## [1,...
24 sym R (1029 sym/21 pcs)
Ruang Eigen dan Diagonalisasi
library(Matrix) library(ggplot2) A <- matrix(c(1, 2, 3, 4), nrow = 2, ncol = 2) eigen_result <- eigen(A) diagonal_matrix <- diag(eigen_result$values) eigenvector_df <- data.frame(x = c(0, eigen_result$vectors[1, 1]), y = c(0, eigen_result$vectors[2, 1])) eigenvector_plot <- ggplot(eigenvector_df, aes(x = x, y = y)) + ...
32 sym R (1464 sym/27 pcs) 2 img
Ruang Invarian
library(Matrix) library(ggplot2) M <- matrix(c(1+2i, 3-4i, 5+6i, 2+3i, 4-5i, 6+7i, 1-2i, 3+4i, 5-6i), nrow = 3, byrow = TRUE) eigen_result <- eigen(M) eigenvectors <- eigen_result$vectors D <- diag(eigen_result$values) inv_eigenvectors <- solve(eigenvectors) invariant_matrix <- eigenvectors %*% D %*% inv_eigenvectors print(invariant_matrix) ## ...
19 sym R (2357 sym/14 pcs) 2 img
Tugas 1
library(ISLR) data(Auto) model <- lm(mpg ~ cylinders + displacement + horsepower + weight, data = Auto) summary(model) ## ## Call: ## lm(formula = mpg ~ cylinders + displacement + horsepower + weight, ## data = Auto) ## ## Residuals: ## Min 1Q Median 3Q Max ## -11.5248 -2.7964 -0.3568 2.2577 16.3221 ## ...
22 sym R (2556 sym/19 pcs)
Persamaan aljabar linear
library(ISLR) A <- as.matrix(mtcars[, c("wt", "disp", "hp")]) B <- mtcars$mpg x <- solve(t(A) %*% A, t(A) %*% B) print(x) ## [,1] ## wt 12.06390563 ## disp -0.11686153 ## hp 0.04382227 prediksi <- A %*% x hasil <- cbind(prediksi, B) colnames(hasil) <- c("Prediksi", "Mpg") print(hasil) ## Prediksi Mpg ## Ma...
20 sym R (2055 sym/14 pcs) 3 img
Operasi Pada Matrix
library(matlib) mendefinisikan dua matrix` A <- matrix(c(1+2i, 2-3i, 0+4i, 5-2i), nrow=2, ncol=2) B <- matrix(c(-1-2i, 3+1i, 2-1i, 0+2i), nrow=2, ncol=2) print("Matriks A:") ## [1] "Matriks A:" print(A) ## [,1] [,2] ## [1,] 1+2i 0+4i ## [2,] 2-3i 5-2i print("Matriks B:") ## [1] "Matriks B:" print(B) ## [,1] [,2] ## [1,] -1-2i 2-1i ##...
222 sym R (1311 sym/44 pcs)
Materi 1
library(ISLR) ISLR (Introduction to Statistical Learning with Applications in R) adalah sebuah buku teks yang ditulis oleh Gareth James, Daniela Witten, Trevor Hastie, dan Robert Tibshirani, yang membahas pengantar tentang pembelajaran statistik dan pembelajaran mesin. Library ISLR pada R merupakan salah satu library yang berisi dataset dan fun...
1027 sym R (93846 sym/28 pcs)
OPERASI MATRIX menggunakan library MASS
library(MASS) Definisikan matriks A <- matrix(1:25, nrow=5, ncol=5) B <- matrix(26:50, nrow=5, ncol=5) Cetak matriks A dan B print(A) ## [,1] [,2] [,3] [,4] [,5] ## [1,] 1 6 11 16 21 ## [2,] 2 7 12 17 22 ## [3,] 3 8 13 18 23 ## [4,] 4 9 14 19 24 ## [5,] 5 10 15 20 25 print(B) ## ...
269 sym R (2656 sym/37 pcs)