小编Jua*_*chi的帖子

使用ggplot绘制非线性回归列表

作为此链接的非线性回归分析的输出图

https://stats.stackexchange.com/questions/209087/non-linear-regression-mixed-model

使用此数据集:

zz <-(" iso temp diam
 Itiquira   22  5.0
 Itiquira   22  4.7
 Itiquira   22  5.4
 Itiquira   25  5.8
 Itiquira   25  5.4
 Itiquira   25  5.0
 Itiquira   28  4.9
 Itiquira   28  5.2
 Itiquira   28  5.2
 Itiquira   31  4.2
 Itiquira   31  4.0
 Itiquira   31  4.1
 Londrina   22  4.5
 Londrina   22  5.0
 Londrina   22  4.4
 Londrina   25  5.0
 Londrina   25  5.5
 Londrina   25  5.3
 Londrina   28  4.6
 Londrina   28  4.3
 Londrina   28  4.9
 Londrina   31  4.4
 Londrina   31  4.1
 Londrina   31  4.4 …
Run Code Online (Sandbox Code Playgroud)

r list ggplot2 nlme

7
推荐指数
1
解决办法
883
查看次数

从lme中提取系数及其标准误差

如何在线性混合模型中为每个实验单元(图)提取系数(b0和b1)及其各自的标准误差,如下所示:

更适合线性模型

使用相同的数据集(df),对于拟合的模型(fitL1):我怎么能得到一个这样的数据框......

   plot    b0      b0_se   b1    b1_se 
    1    2898.69   53.85   -7.5  4.3

   ...    ...       ...     ...   ...
Run Code Online (Sandbox Code Playgroud)

r mixed-models nlme coefficients

6
推荐指数
1
解决办法
5659
查看次数

编译pdf输出时编译-pandoc-citeproc错误

有人可以帮我解决这个错误吗?当我尝试.Rmd使用外部乳胶.bib文件编译西班牙语文档时,我遇到了下一个错误

---
title: "Untitled"
output: 
  pdf_document: 
    fig_caption: yes
bibliography: biblio.bib
lang: spanish
---
Run Code Online (Sandbox Code Playgroud)

并且错误消息是:

  |.................................................................| 100%
label: unnamed-chunk-3 (with options) 
List of 2
 $ echo   : logi FALSE
 $ results: chr "asis"


/usr/bin/pandoc bib.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output bib.pdf --filter /usr/bin/pandoc-citeproc --template /home/juanchi/R/x86_64-pc-linux-gnu-library/3.2/rmarkdown/rmd/latex/default.tex --highlight-style tango --latex-engine pdflatex --variable 'geometry:margin=1in' --bibliography biblio.bib 
output file: bib.knit.md

pandoc-citeproc: could not find locale data for spanish
pandoc: Error running filter /usr/bin/pandoc-citeproc
Filter returned error status 1
Error: pandoc document …
Run Code Online (Sandbox Code Playgroud)

r pandoc knitr r-markdown

5
推荐指数
1
解决办法
1409
查看次数

在Ubuntu中为R安装"devtools"软件包时出错

有人可以帮我找出这个错误的解决方案吗?

install.packages(注明 "DevTools")

  > * installing *source* package ‘RCurl’ ...
    > ** package ‘RCurl’ successfully unpacked and MD5 sums checked checking for curl-config... no Cannot find curl-config ERROR: configuration
    > failed for package ‘RCurl’
    > * removing ‘/home/juanchi/R/x86_64-pc-linux-gnu-library/3.0/RCurl’ Warning in install.packages :   installation of package ‘RCurl’ had
    > non-zero exit status ERROR: dependency ‘RCurl’ is not available for
    > package ‘httr’
    > * removing ‘/home/juanchi/R/x86_64-pc-linux-gnu-library/3.0/httr’ Warning in install.packages :   installation of package ‘httr’ had
    > non-zero exit status ERROR: dependencies …
Run Code Online (Sandbox Code Playgroud)

ubuntu devtools rstudio

4
推荐指数
1
解决办法
9098
查看次数

在R中安装PKI包时出错

我想在RPubs中发布一个slidify演示文稿,但它需要PKI和rsconnect包.

尝试在R中安装PKI包时,我收到此错误消息

Installing package into ‘/home/juanchi/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
probando la URL 'http://cran.rstudio.com/src/contrib/PKI_0.1-1.tar.gz'
Content type 'application/x-gzip' length 20334 bytes (19 KB)
==================================================
downloaded 19 KB

* installing *source* package ‘PKI’ ...
** package ‘PKI’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c asn1.c -o asn1.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
In file included …
Run Code Online (Sandbox Code Playgroud)

ubuntu r pki

4
推荐指数
1
解决办法
3130
查看次数

Flex 仪表板:不同选项卡中的输入和输出

我\xc2\xb4m是一个使用flex-dashboards的新手...\n如何在两个不同的选项卡中分离输入信息和输出结果?这是一个简单的例子,我试图仅渲染第二个选项卡“输出”中的条形图

\n\n
---\ntitle: "Dashboard"\noutput: \n  flexdashboard::flex_dashboard:\nruntime: shiny\n---\n```{r global, include=FALSE}\n# load data in \'global\' chunk so it can be shared by all users of the dashboard\nlibrary(datasets)\ndata(WorldPhones)\n```\n\nInputs\n=======================================================================\n\n```{r, include=FALSE}\n# Shiny module definition (would typically be defined in a separate R script)\n\n# UI function\nworldPhonesUI <- function(id) {\n  ns <- NS(id)\n  fillCol(height = 600, flex = c(2, 1),\n    inputPanel(\n      selectInput(ns("region"), "Region1:", choices = colnames(WorldPhones))\n    )\n  )\n}\n\n# Server function\nworldPhones <- function(input, output, session) {\n  output$phonePlot <- renderPlot({\n    barplot(WorldPhones[,input$region]*1000, \n            ylab = "Number of Telephones", xlab = …
Run Code Online (Sandbox Code Playgroud)

dashboard r

4
推荐指数
1
解决办法
1810
查看次数

tidyr - 传播多个列

我正在为网络元分析准备数据,而且我很难对列进行分类.

如果我有这个初始数据集:

Study Trt       y    sd   n
1       1   -1.22  3.70  54
1       3   -1.53  4.28  95
2       1   -0.30  4.40  76 
2       2   -2.60  4.30  71
2       4    -1.2   4.3  81
Run Code Online (Sandbox Code Playgroud)

我怎么能完成另一个呢?

Study Treatment1    y1  sd1  n1 Treatment2    y2  sd2  n2 Treatment3   y3 sd3 n3
    1     1          1 -1.22 3.70  54          3 -1.53 4.28  95         NA   NA  NA NA
    2     3          1 -0.30 4.40  76          2 -2.60 4.30  71          4 -1.2 4.3 81
Run Code Online (Sandbox Code Playgroud)

我真的陷入了这一步,我真的很感激一些帮助......

r spread dplyr

4
推荐指数
1
解决办法
4511
查看次数

nls - 收敛错误

对于此数据集:

dat = structure(list(x = c(5L, 5L, 5L, 5L, 10L, 10L, 10L, 10L, 15L, 
15L, 15L, 15L, 17L, 17L, 17L, 17L, 20L, 20L, 20L, 20L, 20L, 20L, 
20L, 20L, 22L, 22L, 22L, 22L, 24L, 24L, 24L, 24L, 25L, 25L, 25L, 
25L, 27L, 27L, 27L, 27L, 30L, 30L, 30L, 30L, 35L, 35L, 35L, 35L), 
y = c(2.2, 2.2, 1.95, 1.9, 4.1, 3.95, 3.75, 3.4, 5.15, 4.6, 
4.75, 5.15, 3.7, 4.1, 3.9, 3.5, 7, 6.7, 6.7, 6.95, 4.95, 6, 6.45, 
6.4, 7, …
Run Code Online (Sandbox Code Playgroud)

r nls convergence

3
推荐指数
1
解决办法
1163
查看次数

R中的分段图中的不同间隔颜色

我需要创建一个具有三个段颜色的segplot:一个用于间隔低于1,一个用于间隔优于1,另一个用于包含1的间隔.

df <- read.table(header=T, text='
             geno       n   rd  lower upper
             A7002      7 1.12   0.94  1.30
             ANTA82RR  12 1.00   0.91  1.09
             BR05-83097 5 0.84   0.41  1.27
             BR05-86275 5 0.64   0.25  0.93
             BRM04-1660 7 1.26   1.02  1.50
             BRN03-1404 5 1.03   0.88  1.18
             BRN05-0656 5 0.57   0.47  0.67
             ')

library(latticeExtra)

segplot(reorder(factor(geno), rd)  ~ lower + upper,
    data = df, 
    xlim=c(-1, 2.5),
    draw.bands = FALSE, centers = rd,
    panel = function (x,y,z,...){
    panel.segplot(x,y,z,...)
    panel.abline(v=1,lty=3)
    }
 ) 
Run Code Online (Sandbox Code Playgroud)

提前致谢.

r lattice

3
推荐指数
1
解决办法
337
查看次数

R:错误安装包UBUNTU - dyn.load中的错误(文件,DLLpath = DLLpath,...):无法加载共享对象

我在安装任何软件包时遇到问题,也是从软件包存档.在这种情况下显示错误尝试安装ggp​​lot2:

* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/juanchi/R/x86_64-pc-linux-gnu-library/3.2/stringi/libs/stringi.so':
  libicui18n.so.52: no se puede abrir el archivo del objeto compartido: No existe el archivo o el directorio
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/home/juanchi/R/x86_64-pc-linux-gnu-library/3.2/ggplot2’
Warning in install.packages :
  installation …
Run Code Online (Sandbox Code Playgroud)

r rstudio

3
推荐指数
1
解决办法
5014
查看次数

`nls`拟合错误:无论起始值如何,总是达到最大迭代次数

将此参数化用于增长曲线逻辑模型

在此输入图像描述

我创建了一些点:K = 0.7; y0 = 0.01; r = 0.3

df = data.frame(x= seq(1, 50, by = 5))
df$y = 0.7/(1+((0.7-0.01)/0.01)*exp(-0.3*df$x))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

有人能告诉我如果用模型启动器创建数据我怎么能有一个拟合错误?

fo = df$y ~ K/(1+((K-y0)/y0)*exp(-r*df$x))

model<-nls(fo,
           start = list(K=0.7, y0=0.01, r=0.3),
           df, 
           nls.control(maxiter = 1000))
Error in nls(fo, start = list(K = 0.7, y0 = 0.01, r = 0.3), df, nls.control(maxiter = 1000)) : 
  number of iterations exceeded maximum of 1000
Run Code Online (Sandbox Code Playgroud)

regression r nls non-linear-regression

2
推荐指数
1
解决办法
1224
查看次数

r按组计算正值的比例

使用此数据框:

table <- "
    trt rep ss  d1  d4  d5  d6  d7
    1   1   1   0   0   0   0   0
    1   1   2   0   0   0   0   0
    1   1   3   0   0   1   2   2
    1   2   1   0   0   1   3   6
    1   2   2   0   1   1   2   4
    1   2   3   0   0   0   1   1
    1   3   1   0   0   0   0   0
    1   3   2   0   0   0   0   0
    1   3   3   0 …
Run Code Online (Sandbox Code Playgroud)

r

1
推荐指数
1
解决办法
120
查看次数

在ggplot中绘制函数 - 参数列表

功能绘图的简单示例:

p <- ggplot(data = data.frame(x = 0), mapping = aes(x = x))
p + stat_function(fun = function(x) x^2 + 1*2)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

是否可以在ggplot中的绘图代码中添加参数列表?像这样的东西?

fun1 <- function(x) x^2 + a*b
p <- ggplot(data = data.frame(x = 0), mapping = aes(x = x))
p + stat_function(fun = fun1, par=list(a=1, b=2)) + xlim(-5,5)
Run Code Online (Sandbox Code Playgroud)

r ggplot2

1
推荐指数
1
解决办法
448
查看次数