PHP中是否有相等的R语言GDINA函数?

is there any equal R language GDINA function in PHP?

提问人:user3819396 提问时间:4/6/2023 更新时间:4/6/2023 访问量:20

问:

我需要在 php 中使用 CDM GDINA 方法计算一些值。我已经尝试用 R 编程语言学习库 GDINA,但我发现我很难理解,因为我从不学习统计学,这对我来说非常复杂。PHP中是否有相等的R语言GDINA函数?

先谢谢你。

PHP R Math 统计数据

评论


答:

0赞 protune222 4/6/2023 #1

# Find pairs of nodes with two shared neighbors
B <- A %*% A
pairs_two <- which(B == 2, arr.ind=TRUE)
cat("Pairs with two shared neighbors:\n")
cat(paste(paste(pairs_two[,1], pairs_two[,2], sep=" - "), collapse="\n"))
cat("\n")

# Find pairs of nodes with three shared neighbors
pairs_three <- which(B == 3, arr.ind=TRUE)
cat("Pairs with three shared neighbors:\n")
cat(paste(paste(pairs_three[,1], pairs_three[,2], sep=" - "), collapse="\n"))
cat("\n")

# Compute Laplacian matrix
D <- diag(rowSums(A))
L <- D - A

# Check for isolated vertices
isolated <- sum(diag(D) == 0) > 0
cat("Isolated vertices present: ")
cat(ifelse(isolated, "TRUE", "FALSE"))

评论

0赞 Community 4/8/2023
您的答案可以通过额外的支持信息得到改进。请编辑以添加更多详细信息,例如引文或文档,以便其他人可以确认您的答案是正确的。您可以在帮助中心找到有关如何写出好答案的更多信息。