confidence-interval

How to get confidence interval for smooth.spline?

血红的双手。 提交于 2019-12-04 14:51:49
I have used smooth.spline to estimate a cubic spline for my data. But when I calculate the 90% point-wise confidence interval using equation, the results seems to be a little bit off. Can someone please tell me if I did it wrongly? I am just wondering if there is a function that can automatically calculate a point-wise interval band associated with smooth.spline function. boneMaleSmooth = smooth.spline( bone[males,"age"], bone[males,"spnbmd"], cv=FALSE) error90_male = qnorm(.95)*sd(boneMaleSmooth$x)/sqrt(length(boneMaleSmooth$x)) plot(boneMaleSmooth, ylim=c(-0.5,0.5), col="blue", lwd=3, type=

How to obtain a confidence interval or a measure of prediction dispersion when using xgboost for classification?

北战南征 提交于 2019-12-04 12:32:33
How to obtain a confidence interval or a measure of prediction dispersion when using xgboost for classification? So for example, if xgboost predicts a probability of an event is 0.9, how can the confidence in that probability be obtained? Also is this confidence assumed to be heteroskedastic? To produce confidence intervals for xgboost model you should train several models (you can use bagging for this). Each model will produce a response for test sample - all responses will form a distribution from which you can easily compute confidence intervals using basic statistics. You should produce

Gnuplot: linespoint with confidence interval

耗尽温柔 提交于 2019-12-04 09:23:48
I've following data: I want to plot a graph shows for all x the mean connected with lines (linespoint) and also showing all the confidence interval [ci_lower, ci_upper]. I managed to do that using 2 plots. set xrange [0:1100000] set yrange [0:5000] plot \ '2011-06-16_1n_result.txt' using 1:7 title '1 node' with lines, \ '2011-06-16_1n_result.txt' using 1:7:10:11 notitle with errorbars However it doesn't look nice with two colors and I have the feeling that there should be a way to do that with a single plot. What's the solution code to that? Best, Will I think you are looking for the

R proportion confidence interval factor

落花浮王杯 提交于 2019-12-04 07:19:26
I am trying to summarise data from a household survey and as such most of my data is categorical (factor) data. I was looking to summarise it with plots of frequencies of responses to certain questions (e.g., a bar plot of percentages of households answering certain questions, with error bars showing confidence intervals). I found this excellent tutorial which I had thought was the answer to my prayers ( http://www.cookbook-r.com/Manipulating_data/Summarizing_data/ ) but turns out this is only going to help with continuous data. What I need is something similar that will allow me to calculate

Plot predicted probabilities and confidence intervals in R

扶醉桌前 提交于 2019-12-04 05:55:30
问题 This is a plot I did, I want the confidence intervals for the plot, both upper and lower. I have come so far that I have produced both the upper and lower range but I have problems with the plot that includes the confidence interval. Here are a few lines of my data, gdk is my binary response and the second variable is the age gdk age prog calender 29 FALSE 59 NASTK 11 30 FALSE 59 NASTK 10 91 TRUE 49 NMATK 9 129 TRUE 47 NFYSK 8 227 FALSE 46 LARAA 13 244 TRUE 44 LARAA 11 256 TRUE 41 LARAA 9 311

How to calculate the 95% confidence interval for the slope in a linear regression model in R

狂风中的少年 提交于 2019-12-03 18:21:57
问题 Here is an exercise from Introductory Statistics with R: With the rmr data set, plot metabolic rate versus body weight. Fit a linear regression model to the relation. According to the fitted model, what is the predicted metabolic rate for a body weight of 70 kg? Give a 95% confidence interval for the slope of the line. rmr data set is in the 'ISwR' package. It looks like this: > rmr body.weight metabolic.rate 1 49.9 1079 2 50.8 1146 3 51.8 1115 4 52.6 1161 5 57.6 1325 6 61.4 1351 7 62.3 1402

Two Factor ANOVA Errorbar plot in R

柔情痞子 提交于 2019-12-03 18:01:29
We're teaching a stats class for biology students and trying to use R as the computing and data visualization platform. As much as possible, we'd like to avoid using extra packages and doing anything terribly "fancy" in R; the focus of the course is on the statistics, not the programming. Nevertheless, we haven't found a very good way of generating an errorbar plot in R for a two factor ANOVA design. We're using the ggplot2 package to make the plot, and while it does have a built-in stat_summary method of generating 95% CI errorbars, the way these are calculated may not always be the right way

Calculating 95% confidence intervals in quantile regression in R using rq function

守給你的承諾、 提交于 2019-12-03 14:05:16
I would like to get 95% confidence intervals for the regression coefficients of a quantile regression. You can calculate quantile regressions using the rq function of the quantreg package in R (compared to an OLS model): library(quantreg) LM<-lm(mpg~disp, data = mtcars) QR<-rq(mpg~disp, data = mtcars, tau=0.5) I am able to get 95% confidence intervals for the linear model using the confint function: confint(LM) When I use quantile regression I understand that the following code produces bootstrapped standard errors: summary.rq(QR,se="boot") But actually I would like something like 95%

Calculate confidence band of least-square fit

ⅰ亾dé卋堺 提交于 2019-12-03 13:29:43
问题 I got a question that I fight around for days with now. How do I calculate the (95%) confidence band of a fit? Fitting curves to data is the every day job of every physicist -- so I think this should be implemented somewhere -- but I can't find an implementation for this neither do I know how to do this mathematically. The only thing I found is seaborn that does a nice job for linear least-square. import numpy as np from matplotlib import pyplot as plt import seaborn as sns import pandas as

Calculating length of 95%-CI using dplyr

断了今生、忘了曾经 提交于 2019-12-03 12:25:22
问题 Last time I asked how it was possible to calculate the average score per measurement occasion (week) for a variable (procras) that has been measured repeatedly for multiple respondents. So my (simplified) dataset in long format looks for example like the following (here two students, and 5 time points, no grouping variable): studentID week procras 1 0 1.4 1 6 1.2 1 16 1.6 1 28 NA 1 40 3.8 2 0 1.4 2 6 1.8 2 16 2.0 2 28 2.5 2 40 2.8 Using dplyr I would get the average score per measurement