在使用R在html输出中查看矩阵时正确查看矩阵的问题

ivqmmu1c  于 2023-04-03  发布在  其他
关注(0)|答案(1)|浏览(93)

当我在r markdown控制台中时,矩阵看起来很好,但当我将其转换为html输出时,我得到了r代码。

class: title-slide, center, middle
background-image: url(https://us.123rf.com/450wm/giddavr/giddavr1405/giddavr140500043/28389662-en-diagonal-graduado-resumen-antecedentes-sin-forma-difusa-pink.jpg?ver=6)
background-size: cover

# EXERCISE 12

## Ana

### University
`r format(Sys.Date(), '%B %e, %Y')`

---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(leaps)
library(ggplot2)
library(ggthemes)
library(xaringanthemer)
library(xaringanExtra)
download.file(
  "https://raw.githubusercontent.com/daneden/animate.css/master/animate.css",
  "animate.css"
)
knitr::opts_chunk$set(echo = TRUE,message = F,warning = F)
options(htmltools.dir.version = FALSE)
library(ISLR)
library(xaringanthemer)
library(xaringanExtra)
library(tidyverse)
style_solarized_light(
  text_bold_color = "#000000",
  header_color = "#D65DB1",
  inverse_text_color = "#ffffff",
  background_color = "#FBEAFF",
  code_highlight_color = "#D65DB1",
  text_color = "#000000"
)

class: middle, center, animated, fadeIn

STATEMENT

This problem is a continuation of the previous exercise. In a toy example with p=100, show that estimates of the multiple linear regression coefficients can be approximated by repeatedly performing simple linear regression in a backfitting procedure. How many backfitting iterations are needed to get a "good" approximation to the estimates of the multiple regression coefficients? Create a graph to justify your answer.


title: "Exercise 12"
subtitle: "statistics"
author: "Ana"
institute: "Universisity"
date: "27/03/2023"
output:
xaringan::moon_reader:
lib_dir: libs
css:
- xaringan-themer.css
- xaringan-themer.css
- "https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css"
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
seal: false


class: middle, animated, bounceInRight


我显示beta_matrix的前20 × 6个条目,现在它的形式是:
其中$\hat{β}_{j(k)}$ es la estimación de $β_j$ en la iteración k.

$$
\begin{equation}
\begin{pmatrix}
\hat{β}{0(1)} & \hat{β}{1(1)} & \cdots & \hat{β}{100(1)}\
\hat{β}
{0(2)} & \ddots & & \
\vdots & & \ddots & \
\hat{β}{0(50)} & & & \hat{β}{100(50)}
\end{pmatrix}
\end{equation}
$$


我应该怎么做?谢谢。我看到矩阵在r markdown视图中显示得很好,但当我编织成html时,它看起来很好。
643ylb08

643ylb081#

pmatrix环境位于LaTeX包amsmath中,因此它对html渲染器不可用。您可以使用如下数组:

$$\begin{equation}
\left(
\begin{array}{cccc}
\hat{\beta}_{0(1)} & \hat{\beta}_{1(1)} & \cdots & \hat{\beta}_{100(1)}\\
\hat{\beta}_{0(2)} & \ddots &  & \\
\vdots &  & \ddots & \\
\hat{\beta}_{0(50)} &  &  & \hat{\beta}_{100(50)}
\end{array}
\right)
\end{equation}$$

其产生类似类型的输出并以HTML适当地呈现。

相关问题