Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to present (draw) a flow of decisions starting from root continue decision nodes up to 6 layers.
The decision root (R) will splits into 2 decision options X1 and X2, each of these Xs then divided into 3 new branches of Y1, Y2, and Y3,
then Ys divided into 3 branches Z1, Z2, and Z3, and so on.
Please note that I am not going to classify or doing recursive analysis.
Any help please?
You could use rpart.plot package in R which is used to plot Classification and Regression Trees. One such example is
This link would be helpful for examples.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have two different variables which are both categorical. One of them is the seriousness of the sickness in terms of degrees. The other one is the type of surgery.And my dependent variable is their recovery day after the surgery. Because the days of surgery is not normally distributed I have to use a non-parametric method.
So I need to combine the independent variables into a new variable: 1:sickness1Surgery1 2:sickness1Surgery2, 3:sickness2Surgery1, sickness2Surgery1. By this way I will be able to test it.
I have checked the Youtube but, they are all about how to bin scales into categories.
If you provide more details about the structure of your data (preferably with some sample data) we could provide better suited code. Still, the basic idea should be the same:
if sickness=1 and surgery=1 combinedVar=1.
if sickness=2 and surgery=1 combinedVar=2.
if sickness=1 and surgery=2 combinedVar=3.
if sickness=2 and surgery=2 combinedVar=4.
value labels combinedVar
1 "sickness=1, surgery=1"
2 "sickness=2, surgery=1"
3 "sickness=1, surgery=2"
4 "sickness=2, surgery=2".
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Is it possible to calculate the Approximate Weight of Evidence (AWE) from information obtained via the mclust R package?
According to R documentation, you should have access to function awe(tree, data) since version R1.1.7.
From the example on the linked page (in case of broken link),
data(iris)
iris.m _ iris[,1:4]
awe.val <- awe(mhtree(iris.m), iris.m)
plot(awe.val)
Following the formula from Banfield, J. and Raftery, A. (1993) Model-based Gaussian and non-Gaussian clustering. Biometrics, 49, 803-821. -2*model$loglik + model$d*(log(model$n)+1.5) Where model represents the model with number of cluster solutions selected. Keeping this question in the hope that it may help someone in the future.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
How can I constrain my regression coefficient (only the slope, not the intercept) to be positive? It's a general statistical question, but specifically, I would like to have an r solution, and even more specifically when using model 2 regression (major axis regression).
You could do linear regression with nls, and limit the paramater range there.
Example: Using the nl2sol algorithm from the Port library we want to find a data set with x and y values with a negative Y-intercept and slope between 1.5 and 1.6:
nls(y~a+b*x,algorithm="port",start=c(a=0,b=1.5),lower=c(a=-Inf,b=1.4),upper=c(a=Inf,b=1.6))
This solution and others are explained in the more general question at https://stats.stackexchange.com/questions/61733/linear-regression-with-slope-constraint
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
For one of my projects I would like to create several random matrices, which have full rank. Does anybody know a quick way to do this in R or has an idea how to proceed?
You are overwhelmingly likely to get a full-rank matrix if you generate a matrix with iid elements, with no additional constraints:
library(Matrix)
set.seed(101)
r <- replicate(1000,rankMatrix(matrix(rnorm(10000),100)))
table(r) ## all values are equal to 100
(Someone who spent more time on the math might be able to prove that the set of reduced-rank matrices within this space of matrices actually has measure 0 ...)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I would like to implement a revolve tool for 2d splines in 3d. The geometry computation already works but the normals are a bit tricky.
The problem is the angle between 2 points like the following image:
Here P1 is the previous point P2 the current point and P3 the next point.
How would I calculate the vector N.
Are you looking for the inverse angle bisector?
dir1 = normalize(p1 - p2)
dir2 = normalize(p3 - p2)
n = normalize(-dir1 - dir2)