Easy Function to plot equation of abline [closed] - r

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am beginner in R and i have a simple regression. Now i want to plot the equation of the regression line into the plot. The most easiest way. I already tried to get it done by following some ideas here.
DICE_Quartal<-read.csv("")
attach(DICE_Quartal)
plot(Preise.Fernbusmarkt ~ Auskunftpflichtige.Unternehmen) + abline(cor_preis_unternehmen, col = "red")

Related

Standard Deviation in R [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am trying to calculate the standard deviation from scratch in R (I do know R has a build-in function for that), but I'm not getting the correct results, so I don't know what I'm doing wrong.
My.SD<-function(X) {
M<-(sum(X)/length(X))
my.var<-sum((X-M)^2)
StanDev<-sqrt(my.var/length(X))
print(StanDev)
}
I guess you might need to use (length(X)-1) rather than length(x), i.e.,
My.SD<-function(X) {
M<-(sum(X)/length(X))
my.var<-sum((X-M)^2)
StanDev<-sqrt(my.var/(length(X)-1))
print(StanDev)
}
since here it should be sample standard deviation.

How to create this chart in R? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I have a task a bit complicated for my knowledge in R. I need to reproduce this graphic of the figure in R, I performed several searches and could not find anything. The main thing is to be able to reproduce the graphic (it doesn't have to be identical), subtitles are not so important. Any ideas on how to do it or just using another program? Thanks!!
Check also the facet_share() function of the ggpol package, very handy for population pyramids/comparisons

Can someone explain the following snippet of R code? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Specifically, what the 3rd line of code does and how does 'train[train$label==1,]' work
train <- read.csv("../input/train.csv")
set.seed(71)
data <- sample(as.integer(row.names(train[train$label==1,])),100)
par(mfrow=c(10,10),mar=c(0.1,0.1,0.1,0.1)) ---- 3
It subsets the train dataset to only observations where label = 1.

Plot non-linear data points with line in R [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I simulate some data with R code and want to plot these data.
scatter plot is no problem with code plot(SX,Quant),
but when I use plot(SX,Quant,type='l'), the result is
I just want the line through every point.
I try different type of plot, also use ggplot2 to try to modification,
but has same result, plz help me to solve this problem.
Sort your data by the x-value of your plot:
F_inverse=function(x) log((exp(1)-1)*x+1)
U = runif(100)
SX = F_inverse(U)
Quant=rank(SX)/100
ord <- order(SX)
SX <- SX[ord]
Quant <- Quant[ord]
plot(SX,Quant, type="l")

Residuals against fitted values show pattern [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am going to fit a model using linear and quadratic model.
If the graphs of residuals against fitted values show pattern(not random pattern),what is the cause and how can i fix it?
This should be a comment, but I have insufficient rep for that.
The cause of the pattern is that your model doesn't account for something.
The fix is to find what that is, and include it in your model.

Resources